From bf2e9427418a02ed6ee8fb7b7171abf5811bb138 Mon Sep 17 00:00:00 2001 From: danidfra Date: Wed, 26 Feb 2025 23:02:33 -0300 Subject: [PATCH] Rename timeline "My Nostr" to "Home" --- src/actions/timelines.ts | 12 +++++------ src/components/sidebar-navigation.tsx | 12 +++++------ src/components/thumb-navigation.tsx | 10 +++++----- .../community-timeline.tsx | 0 .../follows-timeline.tsx} | 14 ++++++------- .../index.tsx | 20 +++++++++---------- src/features/ui/components/navbar.tsx | 2 +- src/features/ui/index.tsx | 8 ++++---- src/features/ui/util/async-components.ts | 4 +++- src/locales/en.json | 8 ++++---- 10 files changed, 45 insertions(+), 45 deletions(-) rename src/features/{my-nostr-timeline => home-timeline}/community-timeline.tsx (100%) rename src/features/{my-nostr-timeline/home-timeline.tsx => home-timeline/follows-timeline.tsx} (90%) rename src/features/{my-nostr-timeline => home-timeline}/index.tsx (60%) diff --git a/src/actions/timelines.ts b/src/actions/timelines.ts index efbc988e6..fc9f83cf0 100644 --- a/src/actions/timelines.ts +++ b/src/actions/timelines.ts @@ -100,7 +100,7 @@ const dequeueTimeline = (timelineId: string, expandFunc?: (lastStatusId: string) } else { if (timelineId === 'home') { dispatch(clearTimeline(timelineId)); - dispatch(expandHomeTimeline(optionalExpandArgs)); + dispatch(expandFollowsTimeline(optionalExpandArgs)); } else if (timelineId === 'community') { dispatch(clearTimeline(timelineId)); dispatch(expandCommunityTimeline(optionalExpandArgs)); @@ -194,20 +194,20 @@ const expandTimeline = (timelineId: string, path: string, params: Record { +const expandFollowsTimeline = ({ url, maxId }: ExpandFollowsTimelineOpts = {}, done = noOp) => { const endpoint = url || '/api/v1/timelines/home'; - const params: HomeTimelineParams = {}; + const params: FollowsTimelineParams = {}; if (!url && maxId) { params.max_id = maxId; @@ -337,7 +337,7 @@ export { deleteFromTimelines, clearTimeline, expandTimeline, - expandHomeTimeline, + expandFollowsTimeline, expandPublicTimeline, expandRemoteTimeline, expandCommunityTimeline, diff --git a/src/components/sidebar-navigation.tsx b/src/components/sidebar-navigation.tsx index c910840db..cc5a04e19 100644 --- a/src/components/sidebar-navigation.tsx +++ b/src/components/sidebar-navigation.tsx @@ -1,9 +1,8 @@ -import affiliateFilledIcon from '@tabler/icons/filled/affiliate.svg'; import bellFilledIcon from '@tabler/icons/filled/bell.svg'; import circlesFilledIcon from '@tabler/icons/filled/circles.svg'; +import homeFilledIcon from '@tabler/icons/filled/home.svg'; import settingsFilledIcon from '@tabler/icons/filled/settings.svg'; import userFilledIcon from '@tabler/icons/filled/user.svg'; -import affiliateIcon from '@tabler/icons/outline/affiliate.svg'; import bellIcon from '@tabler/icons/outline/bell.svg'; import bookmarkIcon from '@tabler/icons/outline/bookmark.svg'; import calendarEventIcon from '@tabler/icons/outline/calendar-event.svg'; @@ -11,6 +10,7 @@ import circlesIcon from '@tabler/icons/outline/circles.svg'; import codeIcon from '@tabler/icons/outline/code.svg'; import dashboardIcon from '@tabler/icons/outline/dashboard.svg'; import dotsCircleHorizontalIcon from '@tabler/icons/outline/dots-circle-horizontal.svg'; +import homeIcon from '@tabler/icons/outline/home.svg'; import listIcon from '@tabler/icons/outline/list.svg'; import mailIcon from '@tabler/icons/outline/mail.svg'; import messagesIcon from '@tabler/icons/outline/messages.svg'; @@ -148,7 +148,7 @@ const SidebarNavigation = () => { - + @@ -156,9 +156,9 @@ const SidebarNavigation = () => { } + icon={homeIcon} + activeIcon={homeFilledIcon} + text={} /> {account && ( diff --git a/src/components/thumb-navigation.tsx b/src/components/thumb-navigation.tsx index 7384b58bf..e33c235d7 100644 --- a/src/components/thumb-navigation.tsx +++ b/src/components/thumb-navigation.tsx @@ -1,11 +1,11 @@ -import affiliateFilledIcon from '@tabler/icons/filled/affiliate.svg'; import bellFilledIcon from '@tabler/icons/filled/bell.svg'; import circlesFilledIcon from '@tabler/icons/filled/circles.svg'; +import homeFilledIcon from '@tabler/icons/filled/home.svg'; import mailFilledIcon from '@tabler/icons/filled/mail.svg'; -import affiliateIcon from '@tabler/icons/outline/affiliate.svg'; import bellIcon from '@tabler/icons/outline/bell.svg'; import circlesIcon from '@tabler/icons/outline/circles.svg'; import dashboardIcon from '@tabler/icons/outline/dashboard.svg'; +import homeIcon from '@tabler/icons/outline/home.svg'; import mailIcon from '@tabler/icons/outline/mail.svg'; import messagesIcon from '@tabler/icons/outline/messages.svg'; import searchIcon from '@tabler/icons/outline/search.svg'; @@ -66,9 +66,9 @@ const ThumbNavigation: React.FC = (): JSX.Element => { }} > } + src={homeIcon} + activeSrc={homeFilledIcon} + text={} to='/' exact /> diff --git a/src/features/my-nostr-timeline/community-timeline.tsx b/src/features/home-timeline/community-timeline.tsx similarity index 100% rename from src/features/my-nostr-timeline/community-timeline.tsx rename to src/features/home-timeline/community-timeline.tsx diff --git a/src/features/my-nostr-timeline/home-timeline.tsx b/src/features/home-timeline/follows-timeline.tsx similarity index 90% rename from src/features/my-nostr-timeline/home-timeline.tsx rename to src/features/home-timeline/follows-timeline.tsx index 39e03edeb..438034908 100644 --- a/src/features/my-nostr-timeline/home-timeline.tsx +++ b/src/features/home-timeline/follows-timeline.tsx @@ -2,7 +2,7 @@ import { useEffect, useRef } from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; -import { expandHomeTimeline } from 'soapbox/actions/timelines.ts'; +import { expandFollowsTimeline } from 'soapbox/actions/timelines.ts'; import PullToRefresh from 'soapbox/components/pull-to-refresh.tsx'; import { Column } from 'soapbox/components/ui/column.tsx'; import Stack from 'soapbox/components/ui/stack.tsx'; @@ -14,10 +14,10 @@ import { useFeatures } from 'soapbox/hooks/useFeatures.ts'; import { useInstance } from 'soapbox/hooks/useInstance.ts'; const messages = defineMessages({ - title: { id: 'column.my_nostr', defaultMessage: 'My Nostr' }, + title: { id: 'column.home', defaultMessage: 'Home' }, }); -const HomeTimeline: React.FC = () => { +const FollowsTimeline: React.FC = () => { const intl = useIntl(); const dispatch = useAppDispatch(); const features = useFeatures(); @@ -29,7 +29,7 @@ const HomeTimeline: React.FC = () => { const next = useAppSelector(state => state.timelines.get('home')?.next); const handleLoadMore = (maxId: string) => { - dispatch(expandHomeTimeline({ url: next, maxId })); + dispatch(expandFollowsTimeline({ url: next, maxId })); }; // Mastodon generates the feed in Redis, and can return a partial timeline @@ -37,7 +37,7 @@ const HomeTimeline: React.FC = () => { const checkIfReloadNeeded = () => { if (isPartial) { polling.current = setInterval(() => { - dispatch(expandHomeTimeline()); + dispatch(expandFollowsTimeline()); }, 3000); } else { stopPolling(); @@ -52,7 +52,7 @@ const HomeTimeline: React.FC = () => { }; const handleRefresh = () => { - return dispatch(expandHomeTimeline()); + return dispatch(expandFollowsTimeline()); }; useEffect(() => { @@ -111,4 +111,4 @@ const HomeTimeline: React.FC = () => { }; -export default HomeTimeline; \ No newline at end of file +export default FollowsTimeline; \ No newline at end of file diff --git a/src/features/my-nostr-timeline/index.tsx b/src/features/home-timeline/index.tsx similarity index 60% rename from src/features/my-nostr-timeline/index.tsx rename to src/features/home-timeline/index.tsx index 5e5e9894d..325d5f680 100644 --- a/src/features/my-nostr-timeline/index.tsx +++ b/src/features/home-timeline/index.tsx @@ -1,16 +1,14 @@ -import { useState, lazy, Suspense } from 'react'; +import { useState, Suspense } from 'react'; import { FormattedMessage } from 'react-intl'; import Tabs from 'soapbox/components/ui/tabs.tsx'; +import { CommunityTimeline, FollowsTimeline } from 'soapbox/features/ui/util/async-components.ts'; import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts'; import { useInstance } from 'soapbox/hooks/useInstance.ts'; -const HomeTimeline = lazy(() => import('soapbox/features/my-nostr-timeline/home-timeline.tsx')); -const CommunityTimeline = lazy(() => import('soapbox/features/my-nostr-timeline/community-timeline.tsx')); - -const MyNostrTimeline = () => { +const HomeTimeline = () => { const { instance } = useInstance(); - const [activeTab, setActiveTab] = useState('forYou'); + const [activeTab, setActiveTab] = useState('follows'); const notifications = useAppSelector((state) => state.notificationsTab); return ( @@ -18,9 +16,9 @@ const MyNostrTimeline = () => { , - action: () => setActiveTab('forYou'), + name: 'follows', + text: , + action: () => setActiveTab('follows'), notification: notifications.home, }, { @@ -34,10 +32,10 @@ const MyNostrTimeline = () => { /> }> - {activeTab === 'forYou' ? : } + {activeTab === 'follows' ? : } ); }; -export default MyNostrTimeline; \ No newline at end of file +export default HomeTimeline; \ No newline at end of file diff --git a/src/features/ui/components/navbar.tsx b/src/features/ui/components/navbar.tsx index 47d60c7b8..63891cb75 100644 --- a/src/features/ui/components/navbar.tsx +++ b/src/features/ui/components/navbar.tsx @@ -114,7 +114,7 @@ const Navbar = () => { > - + {account && ( diff --git a/src/features/ui/index.tsx b/src/features/ui/index.tsx index 9c61e2079..a73afdc17 100644 --- a/src/features/ui/index.tsx +++ b/src/features/ui/index.tsx @@ -10,7 +10,7 @@ import { expandNotifications } from 'soapbox/actions/notifications.ts'; import { registerPushNotifications } from 'soapbox/actions/push-notifications/registerer.ts'; import { fetchScheduledStatuses } from 'soapbox/actions/scheduled-statuses.ts'; import { fetchSuggestionsForTimeline } from 'soapbox/actions/suggestions.ts'; -import { expandHomeTimeline } from 'soapbox/actions/timelines.ts'; +import { expandFollowsTimeline } from 'soapbox/actions/timelines.ts'; import { useUserStream } from 'soapbox/api/hooks/index.ts'; import { useCustomEmojis } from 'soapbox/api/hooks/useCustomEmojis.ts'; import SidebarNavigation from 'soapbox/components/sidebar-navigation.tsx'; @@ -51,7 +51,7 @@ import { RemoteTimeline, AccountTimeline, AccountGallery, - MyNostrTimeline, + HomeTimeline, Followers, Following, DirectTimeline, @@ -183,7 +183,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => {isLoggedIn ? ( - + ) : ( )} @@ -418,7 +418,7 @@ const UI: React.FC = ({ children }) => { const loadAccountData = () => { if (!account) return; - dispatch(expandHomeTimeline({}, () => { + dispatch(expandFollowsTimeline({}, () => { dispatch(fetchSuggestionsForTimeline()); })); diff --git a/src/features/ui/util/async-components.ts b/src/features/ui/util/async-components.ts index 104b0f66c..28e8d4fe0 100644 --- a/src/features/ui/util/async-components.ts +++ b/src/features/ui/util/async-components.ts @@ -5,7 +5,7 @@ export const EmojiPicker = lazy(() => import('soapbox/features/emoji/components/ export const EmojiPickerModal = lazy(() => import('soapbox/features/ui/components/modals/emoji-picker-modal.tsx')); export const Notifications = lazy(() => import('soapbox/features/notifications/index.tsx')); export const LandingTimeline = lazy(() => import('soapbox/features/landing-timeline/index.tsx')); -export const MyNostrTimeline = lazy(() => import('soapbox/features/my-nostr-timeline/index.tsx')); +export const HomeTimeline = lazy(() => import('soapbox/features/home-timeline/index.tsx')); export const PublicTimeline = lazy(() => import('soapbox/features/public-timeline/index.tsx')); export const RemoteTimeline = lazy(() => import('soapbox/features/remote-timeline/index.tsx')); export const HashtagTimeline = lazy(() => import('soapbox/features/hashtag-timeline/index.tsx')); @@ -181,3 +181,5 @@ export const ZapSplitModal = lazy(() => import('soapbox/features/ui/components/m export const CaptchaModal = lazy(() => import('soapbox/features/ui/components/modals/captcha-modal/captcha-modal.tsx')); export const NostrBunkerLogin = lazy(() => import('soapbox/features/nostr/nostr-bunker-login.tsx')); export const StreakModal = lazy(() => import('soapbox/features/ui/components/modals/streak-modal.tsx')); +export const FollowsTimeline = lazy(() => import('soapbox/features/home-timeline/follows-timeline.tsx')); +export const CommunityTimeline = lazy(() => import('soapbox/features/home-timeline/community-timeline.tsx')); \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index 9778237ad..f59c6ae18 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -408,6 +408,7 @@ "column.group_blocked_members": "Banned Members", "column.group_pending_requests": "Pending requests", "column.groups": "Groups", + "column.home": "Home", "column.import_data": "Import data", "column.info": "Server information", "column.lists": "Lists", @@ -420,7 +421,6 @@ "column.mfa_setup": "Proceed to Setup", "column.migration": "Account migration", "column.mutes": "Mutes", - "column.my_nostr": "My Nostr", "column.notifications": "Notifications", "column.pins": "Pinned posts", "column.preferences": "Preferences", @@ -1120,7 +1120,7 @@ "navigation.dashboard": "Dashboard", "navigation.developers": "Developers", "navigation.direct_messages": "Messages", - "navigation.my_nostr": "My Nostr", + "navigation.home": "Home", "navigation.notifications": "Notifications", "navigation.search": "Discover", "navigation_bar.account_aliases": "Account aliases", @@ -1614,11 +1614,11 @@ "sw.url": "Script URL", "tabs_bar.all": "All", "tabs_bar.dashboard": "Dashboard", - "tabs_bar.for_you": "For You", + "tabs_bar.follows": "Follows", "tabs_bar.global": "Global", "tabs_bar.groups": "Groups", + "tabs_bar.home": "Home", "tabs_bar.more": "More", - "tabs_bar.my_nostr": "My Nostr", "tabs_bar.notifications": "Notifications", "tabs_bar.profile": "Profile", "tabs_bar.search": "Discover",