Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/rename-chronological-feed-to-latest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@audius/web': patch
'@audius/mobile': patch
'@audius/common': patch
---

Rename the Feed page's "Chronological" tab to "Latest" on web and mobile. The persisted `feed-page:tab` localStorage value is migrated transparently so existing users land on the same tab they had selected.
9 changes: 6 additions & 3 deletions packages/common/src/api/tan-query/feed/useFeedPreferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ const FEED_TAB_LS_KEY = 'feed-page:tab'
const FEED_FILTER_LS_KEY = 'feed-page:filter'

const isFeedTab = (value: string | null): value is FeedTab =>
value === FeedTab.FOR_YOU || value === FeedTab.CHRONOLOGICAL
value === FeedTab.FOR_YOU || value === FeedTab.LATEST

const isFeedFilter = (value: string | null): value is FeedFilter =>
value === FeedFilter.ALL ||
value === FeedFilter.ORIGINAL ||
value === FeedFilter.REPOST

/**
* Persisted active tab on the Feed page (For You vs Chronological). Backed by
* Persisted active tab on the Feed page (For You vs Latest). Backed by
* the tan-query cache so reads in any component see the same value, with
* localStorage as the durable store.
*/
Expand All @@ -31,6 +31,9 @@ export const useFeedTab = (): [FeedTab, (tab: FeedTab) => void] => {
queryKey: [QUERY_KEYS.feedTab],
queryFn: async () => {
const stored = await localStorage.getItem(FEED_TAB_LS_KEY)
// Migrate the pre-rename persisted value so existing users land on the
// same tab they had selected.
if (stored === 'CHRONOLOGICAL') return FeedTab.LATEST
return isFeedTab(stored) ? stored : FeedTab.FOR_YOU
},
staleTime: Infinity,
Expand All @@ -49,7 +52,7 @@ export const useFeedTab = (): [FeedTab, (tab: FeedTab) => void] => {
}

/**
* Persisted post-type filter for the Chronological feed. Same tan-query
* Persisted post-type filter for the Latest feed. Same tan-query
* shared-store pattern as {@link useFeedTab}.
*/
export const useFeedFilter = (): [FeedFilter, (filter: FeedFilter) => void] => {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/models/FeedTab.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum FeedTab {
FOR_YOU = 'FOR_YOU',
CHRONOLOGICAL = 'CHRONOLOGICAL'
LATEST = 'LATEST'
}
4 changes: 2 additions & 2 deletions packages/mobile/src/screens/feed-screen/FeedTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Flex, SelectablePill, useTheme } from '@audius/harmony-native'

const tabLabels: Record<FeedTab, string> = {
[FeedTab.FOR_YOU]: 'For You',
[FeedTab.CHRONOLOGICAL]: 'Chronological'
[FeedTab.LATEST]: 'Latest'
}

const tabs: FeedTab[] = [FeedTab.FOR_YOU, FeedTab.CHRONOLOGICAL]
const tabs: FeedTab[] = [FeedTab.FOR_YOU, FeedTab.LATEST]

type FeedTabsProps = {
currentTab: FeedTab
Expand Down
6 changes: 3 additions & 3 deletions packages/web/src/pages/feed-page/components/FeedTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ type FeedTabsProps = {

const messages = {
forYou: 'For You',
chronological: 'Chronological'
latest: 'Latest'
}

const tabToLabel: Record<FeedTab, string> = {
[FeedTab.FOR_YOU]: messages.forYou,
[FeedTab.CHRONOLOGICAL]: messages.chronological
[FeedTab.LATEST]: messages.latest
}

const tabs: FeedTab[] = [FeedTab.FOR_YOU, FeedTab.CHRONOLOGICAL]
const tabs: FeedTab[] = [FeedTab.FOR_YOU, FeedTab.LATEST]

export const FeedTabs = ({ currentTab, onSelectTab }: FeedTabsProps) => {
const handleChange = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const FeedPageContent = ({ containerRef }: FeedPageContentProps) => {

const isForYou = feedTab === FeedTab.FOR_YOU

// Chronological lineup. Disabled while For You is active.
// Latest lineup. Disabled while For You is active.
const feedArgs = useMemo(
() => ({
userId: currentUserId,
Expand Down
Loading