From 451649b38190c3c4627ea843991190ceffc53521 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Thu, 14 May 2026 21:17:53 +0200 Subject: [PATCH] efficiency fix --- src/App.tsx | 47 ++++--- src/components/PostEditor/PostContent.tsx | 75 +---------- .../Sidebar/SidebarCalendarWeekWidget.tsx | 13 +- src/constants.ts | 1 - src/lib/discussion-thread-composer.ts | 20 +-- src/lib/nip05.ts | 14 ++- src/lib/optional-proxy-session.ts | 34 +++++ src/lib/translate-client.ts | 59 +++++++-- .../DiscussionsPage/discussionTopics.ts | 3 +- .../FavoriteRelaysActivityProvider.tsx | 8 ++ src/providers/GroupListProvider.tsx | 118 ------------------ src/providers/LiveActivitiesProvider.tsx | 5 +- src/providers/group-list-context.tsx | 18 --- src/services/client.service.ts | 63 +++++++--- .../live-activities-prewarm-bridge.ts | 18 --- src/services/rss-feed.service.ts | 9 +- .../session-interactive-prewarm-bridge.ts | 27 ++++ src/services/web.service.ts | 44 ++++--- 18 files changed, 251 insertions(+), 325 deletions(-) create mode 100644 src/lib/optional-proxy-session.ts delete mode 100644 src/providers/GroupListProvider.tsx delete mode 100644 src/providers/group-list-context.tsx delete mode 100644 src/services/live-activities-prewarm-bridge.ts create mode 100644 src/services/session-interactive-prewarm-bridge.ts diff --git a/src/App.tsx b/src/App.tsx index 550e53af..d0c03be2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,7 +12,6 @@ import { FavoriteRelaysProvider } from '@/providers/FavoriteRelaysProvider' import { FeedProvider } from '@/providers/FeedProvider' import { FontSizeProvider } from '@/providers/FontSizeProvider' import { FollowListProvider } from '@/providers/FollowListProvider' -import { GroupListProvider } from '@/providers/GroupListProvider' import { InterestListProvider } from '@/providers/InterestListProvider' import { KindFilterProvider } from '@/providers/KindFilterProvider' import { MediaUploadServiceProvider } from '@/providers/MediaUploadServiceProvider' @@ -50,30 +49,28 @@ export default function App(): JSX.Element { - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/PostEditor/PostContent.tsx b/src/components/PostEditor/PostContent.tsx index 9fd39e93..e10fd142 100644 --- a/src/components/PostEditor/PostContent.tsx +++ b/src/components/PostEditor/PostContent.tsx @@ -60,7 +60,6 @@ import { ListTodo, MessageCircle, MessagesSquare, - Users, X, Highlighter, FileText, @@ -94,7 +93,6 @@ import { import { prefixNostrAddresses } from '@/lib/nostr-address' import dayjs from 'dayjs' import { TDraftEvent } from '@/types' -import { useGroupList } from '@/providers/group-list-context' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover' import { Switch } from '@/components/ui/switch' import { DISCUSSION_TOPICS } from '@/pages/primary/DiscussionsPage/discussionTopics' @@ -194,7 +192,6 @@ export default function PostContent({ }) { const { t, i18n } = useTranslation() const { pubkey, publish, checkLogin } = useNostr() - const { userGroups } = useGroupList() const { addReplies } = useReply() const mergePublishedReplyIntoThread = useCallback( @@ -308,13 +305,11 @@ export default function PostContent({ return row?.label ?? 'general' }) const [threadSelectedTopic, setThreadSelectedTopic] = useState('general') - const [threadSelectedGroup, setThreadSelectedGroup] = useState('') const [threadIsReadingGroup, setThreadIsReadingGroup] = useState(false) const [threadReadingAuthor, setThreadReadingAuthor] = useState('') const [threadReadingSubject, setThreadReadingSubject] = useState('') const [threadShowReadingsPanel, setThreadShowReadingsPanel] = useState(false) const [threadTopicPopoverOpen, setThreadTopicPopoverOpen] = useState(false) - const [threadGroupPopoverOpen, setThreadGroupPopoverOpen] = useState(false) const [threadErrors, setThreadErrors] = useState<{ title?: string content?: string @@ -322,7 +317,6 @@ export default function PostContent({ relay?: string author?: string subject?: string - group?: string }>({}) const [mediaNoteKind, setMediaNoteKind] = useState(null) const [mediaImetaTags, setMediaImetaTags] = useState([]) @@ -438,7 +432,6 @@ export default function PostContent({ processedContent: prefixNostrAddresses(text.trim()), topicForTags: resolved, title: threadTitle, - selectedGroup: threadSelectedGroup, dynamicTopics: discussionDynamicTopics, isReadingGroup: threadIsReadingGroup, author: threadReadingAuthor, @@ -451,7 +444,6 @@ export default function PostContent({ allAvailableTopics, text, threadTitle, - threadSelectedGroup, discussionDynamicTopics, threadIsReadingGroup, threadReadingAuthor, @@ -485,8 +477,7 @@ export default function PostContent({ !!text.trim() && text.length <= 5000 && additionalRelayUrls.length > 0 && - (!threadIsReadingGroup || (!!threadReadingAuthor.trim() && !!threadReadingSubject.trim())) && - (threadTopicResolved !== 'groups' || !!threadSelectedGroup.trim())) + (!threadIsReadingGroup || (!!threadReadingAuthor.trim() && !!threadReadingSubject.trim()))) const result = ( !!pubkey && !posting && @@ -537,7 +528,6 @@ export default function PostContent({ threadIsReadingGroup, threadReadingAuthor, threadReadingSubject, - threadSelectedGroup, relayCapBlockInfo ]) @@ -805,7 +795,6 @@ export default function PostContent({ processedContent: processed, topicForTags: topicResolved, title: threadTitle, - selectedGroup: threadSelectedGroup, dynamicTopics: discussionDynamicTopics, isReadingGroup: threadIsReadingGroup, author: threadReadingAuthor, @@ -1130,7 +1119,6 @@ export default function PostContent({ allAvailableTopics, threadSelectedTopic, threadTitle, - threadSelectedGroup, discussionDynamicTopics, threadIsReadingGroup, threadReadingAuthor, @@ -1299,9 +1287,6 @@ export default function PostContent({ newErrors.subject = t('Subject (book title) is required for reading groups') } } - if (topicResolved === 'groups' && !threadSelectedGroup.trim()) { - newErrors.group = t('Please select a group') - } setThreadErrors(newErrors) if (Object.keys(newErrors).length > 0) { return @@ -2246,7 +2231,6 @@ export default function PostContent({ setThreadSelectedTopic('general') const gRow = DISCUSSION_TOPICS.find((x) => x.id === 'general') setThreadTopicInput(gRow?.label ?? 'general') - setThreadSelectedGroup('') setThreadIsReadingGroup(false) setThreadReadingAuthor('') setThreadReadingSubject('') @@ -2420,63 +2404,6 @@ export default function PostContent({

- {threadTopicResolved === 'groups' && ( -
- - - - - - -
- {userGroups.length === 0 ? ( -
- {t('No groups available. Join some groups first.')} -
- ) : ( - userGroups.map((groupId) => ( -
{ - setThreadSelectedGroup(groupId) - setThreadGroupPopoverOpen(false) - }} - > - - - {groupId} -
- )) - )} -
-
-
- {threadErrors.group &&

{threadErrors.group}

} -

- {t('Select the group where you want to create this discussion.')} -

-
- )} -