diff --git a/.changeset/sdk-weekly-rotation.md b/.changeset/sdk-weekly-rotation.md new file mode 100644 index 00000000000..c03dc01db3c --- /dev/null +++ b/.changeset/sdk-weekly-rotation.md @@ -0,0 +1,5 @@ +--- +'@audius/sdk': minor +--- + +Add `users.getWeeklyRotation`, a hand-written client for `GET /v1/users/{id}/weekly-rotation` — a personalized weekly track mix that is stable for the ISO week. This method has not appeared in a published release before; it was briefly named `getDiscoverWeekly` on `main` only. diff --git a/packages/common/src/api/index.ts b/packages/common/src/api/index.ts index ce42e24032f..43a406801df 100644 --- a/packages/common/src/api/index.ts +++ b/packages/common/src/api/index.ts @@ -48,7 +48,7 @@ export * from './tan-query/lineups/useProfileReposts' export * from './tan-query/lineups/useProfileTracks' export * from './tan-query/lineups/useTrending' export * from './tan-query/lineups/useTrendingUnderground' -export * from './tan-query/lineups/useDiscoverWeekly' +export * from './tan-query/lineups/useWeeklyRotation' export * from './tan-query/lineups/useTrendingWinners' export * from './tan-query/lineups/useTrackPageLineup' diff --git a/packages/common/src/api/tan-query/lineups/useDiscoverWeekly.ts b/packages/common/src/api/tan-query/lineups/useWeeklyRotation.ts similarity index 84% rename from packages/common/src/api/tan-query/lineups/useDiscoverWeekly.ts rename to packages/common/src/api/tan-query/lineups/useWeeklyRotation.ts index e5bdcbe96ba..f295ce56ba7 100644 --- a/packages/common/src/api/tan-query/lineups/useDiscoverWeekly.ts +++ b/packages/common/src/api/tan-query/lineups/useWeeklyRotation.ts @@ -17,20 +17,20 @@ const DEFAULT_LIMIT = 30 // failure or an empty response doesn't stick for the whole session. const STALE_TIME_MS = 30 * 60 * 1000 -export type UseDiscoverWeeklyArgs = { +export type UseWeeklyRotationArgs = { limit?: number } -export const getDiscoverWeeklyQueryKey = ({ +export const getWeeklyRotationQueryKey = ({ userId, limit = DEFAULT_LIMIT -}: UseDiscoverWeeklyArgs & { userId: ID | null | undefined }) => - [QUERY_KEYS.discoverWeekly, userId, { limit }] as unknown as QueryKey< +}: UseWeeklyRotationArgs & { userId: ID | null | undefined }) => + [QUERY_KEYS.weeklyRotation, userId, { limit }] as unknown as QueryKey< LineupData[] > /** - * The current user's Discover Weekly mix: tracks they haven't heard, weighted + * The current user's Weekly Rotation mix: tracks they haven't heard, weighted * toward artists they don't already follow. * * Deliberately a plain `useQuery` rather than an infinite one — the mix is a @@ -43,8 +43,8 @@ export const getDiscoverWeeklyQueryKey = ({ * empty result stayed hidden until the app restarted. A bounded staleTime keeps * the request count low while still letting a bad result heal. */ -export const useDiscoverWeekly = ( - { limit = DEFAULT_LIMIT }: UseDiscoverWeeklyArgs = {}, +export const useWeeklyRotation = ( + { limit = DEFAULT_LIMIT }: UseWeeklyRotationArgs = {}, options?: QueryOptions ) => { const { audiusSdk } = useQueryContext() @@ -52,10 +52,10 @@ export const useDiscoverWeekly = ( const queryClient = useQueryClient() const query = useQuery({ - queryKey: getDiscoverWeeklyQueryKey({ userId: currentUserId, limit }), + queryKey: getWeeklyRotationQueryKey({ userId: currentUserId, limit }), queryFn: async () => { const sdk = await audiusSdk() - const { data = [] } = await sdk.users.getDiscoverWeekly({ + const { data = [] } = await sdk.users.getWeeklyRotation({ id: Id.parse(currentUserId), limit, userId: OptionalId.parse(currentUserId) diff --git a/packages/common/src/api/tan-query/queryKeys.ts b/packages/common/src/api/tan-query/queryKeys.ts index 344931caee7..e2c83b739bd 100644 --- a/packages/common/src/api/tan-query/queryKeys.ts +++ b/packages/common/src/api/tan-query/queryKeys.ts @@ -53,7 +53,7 @@ export const QUERY_KEYS = { trending: 'trending', suggestedArtists: 'suggestedArtists', suggestedFollows: 'suggestedFollows', - discoverWeekly: 'discoverWeekly', + weeklyRotation: 'weeklyRotation', topArtistsInGenre: 'topArtistsInGenre', audioTransactions: 'audioTransactions', audioTransactionsCount: 'audioTransactionsCount', diff --git a/packages/common/src/messages/explore.ts b/packages/common/src/messages/explore.ts index d0b27be8f22..2c4a9db6f0b 100644 --- a/packages/common/src/messages/explore.ts +++ b/packages/common/src/messages/explore.ts @@ -27,13 +27,13 @@ export const exploreMessages = { feelingLucky: 'Feeling Lucky?', imFeelingLucky: "I'm Feeling Lucky", recentlyPlayed: 'Recently Played', - discoverWeekly: 'Your Discover Weekly', - discoverWeeklySubtitle: 'Updated every Monday', - discoverWeeklyBadge: 'New', - discoverWeeklyPitch: + weeklyRotation: 'Your Weekly Rotation', + weeklyRotationSubtitle: 'Updated every Monday', + weeklyRotationBadge: 'New', + weeklyRotationPitch: 'A fresh mix of tracks picked just for you. Updated every Monday.', - discoverWeeklyCta: 'Listen Now', - discoverWeeklyTrackCount: (count: number) => + weeklyRotationCta: 'Listen Now', + weeklyRotationTrackCount: (count: number) => `${count} ${count === 1 ? 'track' : 'tracks'}`, undergroundTrending: 'Underground Trending', verified: 'Verified' diff --git a/packages/common/src/models/Analytics.ts b/packages/common/src/models/Analytics.ts index b35301ffbf9..ed736a7579f 100644 --- a/packages/common/src/models/Analytics.ts +++ b/packages/common/src/models/Analytics.ts @@ -263,11 +263,11 @@ export enum Name { EXPLORE_SECTION_VIEW = 'Explore: Section View', EXPLORE_SECTION_CLICK = 'Explore: Section Click', - // Discover Weekly - DISCOVER_WEEKLY_BANNER_VIEW = 'Discover Weekly: Banner View', - DISCOVER_WEEKLY_BANNER_CLICK = 'Discover Weekly: Banner Click', - DISCOVER_WEEKLY_PAGE_VIEW = 'Discover Weekly: Page View', - DISCOVER_WEEKLY_PLAY_ALL = 'Discover Weekly: Play All', + // Weekly Rotation + WEEKLY_ROTATION_BANNER_VIEW = 'Weekly Rotation: Banner View', + WEEKLY_ROTATION_BANNER_CLICK = 'Weekly Rotation: Banner Click', + WEEKLY_ROTATION_PAGE_VIEW = 'Weekly Rotation: Page View', + WEEKLY_ROTATION_PLAY_ALL = 'Weekly Rotation: Play All', // Errors ERROR_PAGE = 'Error Page', @@ -1318,7 +1318,7 @@ export type ExploreSectionName = | 'Recommended Tracks' | 'Artist Coin Tracks' | 'Recently Played' - | 'Discover Weekly' + | 'Weekly Rotation' | 'Quick Search' | 'Featured Playlists' | 'Fan Clubs' @@ -1356,33 +1356,33 @@ type ExploreSectionClick = { /** * Surface the banner was rendered on. The mix is reachable from more than one - * place, so every Discover Weekly event carries this -- otherwise there's no + * place, so every Weekly Rotation event carries this -- otherwise there's no * way to tell which entry point is actually driving listens. */ -export type DiscoverWeeklySurface = 'explore' | 'feed' +export type WeeklyRotationSurface = 'explore' | 'feed' -type DiscoverWeeklyBannerView = { - eventName: Name.DISCOVER_WEEKLY_BANNER_VIEW - surface: DiscoverWeeklySurface +type WeeklyRotationBannerView = { + eventName: Name.WEEKLY_ROTATION_BANNER_VIEW + surface: WeeklyRotationSurface source: 'web' | 'mobile' trackCount: number } -type DiscoverWeeklyBannerClick = { - eventName: Name.DISCOVER_WEEKLY_BANNER_CLICK - surface: DiscoverWeeklySurface +type WeeklyRotationBannerClick = { + eventName: Name.WEEKLY_ROTATION_BANNER_CLICK + surface: WeeklyRotationSurface source: 'web' | 'mobile' trackCount: number } -type DiscoverWeeklyPageView = { - eventName: Name.DISCOVER_WEEKLY_PAGE_VIEW +type WeeklyRotationPageView = { + eventName: Name.WEEKLY_ROTATION_PAGE_VIEW source: 'web' | 'mobile' trackCount: number } -type DiscoverWeeklyPlayAll = { - eventName: Name.DISCOVER_WEEKLY_PLAY_ALL +type WeeklyRotationPlayAll = { + eventName: Name.WEEKLY_ROTATION_PLAY_ALL source: 'web' | 'mobile' trackCount: number } @@ -2762,10 +2762,10 @@ export type AllTrackingEvents = | SearchResultSelect | ExploreSectionView | ExploreSectionClick - | DiscoverWeeklyBannerView - | DiscoverWeeklyBannerClick - | DiscoverWeeklyPageView - | DiscoverWeeklyPlayAll + | WeeklyRotationBannerView + | WeeklyRotationBannerClick + | WeeklyRotationPageView + | WeeklyRotationPlayAll | ErrorPage | NotFoundPage | PageView diff --git a/packages/common/src/services/remote-config/feature-flags.ts b/packages/common/src/services/remote-config/feature-flags.ts index dcc312d9c87..ed5f92cecba 100644 --- a/packages/common/src/services/remote-config/feature-flags.ts +++ b/packages/common/src/services/remote-config/feature-flags.ts @@ -17,7 +17,7 @@ export enum FeatureFlags { LAUNCHPAD_VERIFICATION = 'launchpad_verification', FAN_CLUB_TEXT_POST_POSTING = 'fan_club_text_post_posting', QUEUE_NEW_FEATURE_BADGE = 'queue_new_feature_badge', - DISCOVER_WEEKLY = 'discover_weekly' + WEEKLY_ROTATION = 'weekly_rotation' } type FlagDefaults = Record @@ -28,7 +28,7 @@ export const environmentFlagDefaults: Record< > = { development: { [FeatureFlags.FAN_CLUB_TEXT_POST_POSTING]: true, - [FeatureFlags.DISCOVER_WEEKLY]: true + [FeatureFlags.WEEKLY_ROTATION]: true }, production: {} } @@ -52,5 +52,5 @@ export const flagDefaults: FlagDefaults = { [FeatureFlags.LAUNCHPAD_VERIFICATION]: true, [FeatureFlags.FAN_CLUB_TEXT_POST_POSTING]: false, [FeatureFlags.QUEUE_NEW_FEATURE_BADGE]: false, - [FeatureFlags.DISCOVER_WEEKLY]: false + [FeatureFlags.WEEKLY_ROTATION]: false } diff --git a/packages/common/src/utils/route.ts b/packages/common/src/utils/route.ts index 16f680e80af..c234fc63489 100644 --- a/packages/common/src/utils/route.ts +++ b/packages/common/src/utils/route.ts @@ -31,7 +31,7 @@ export const TRENDING_PLAYLISTS_PAGE_LEGACY = '/trending/playlists' export const EXPLORE_PAGE = '/explore' export const TRENDING_PLAYLISTS_PAGE = '/explore/playlists' export const TRENDING_UNDERGROUND_PAGE = '/explore/underground' -export const DISCOVER_WEEKLY_PAGE = '/explore/discover-weekly' +export const WEEKLY_ROTATION_PAGE = '/explore/weekly-rotation' export const CONTESTS_PAGE = '/contests' // DEPRECATED - use /library instead. @@ -302,7 +302,7 @@ export const orderedRoutes = [ TRENDING_GENRES, TRENDING_PAGE, EXPLORE_PAGE, - DISCOVER_WEEKLY_PAGE, + WEEKLY_ROTATION_PAGE, CONTESTS_PAGE, EMPTY_PAGE, SEARCH_PAGE, @@ -357,7 +357,7 @@ export const staticRoutes = new Set([ FEED_PAGE, TRENDING_PAGE, EXPLORE_PAGE, - DISCOVER_WEEKLY_PAGE, + WEEKLY_ROTATION_PAGE, CONTESTS_PAGE, HOST_REMIX_CONTEST_ROOT_PAGE, TRENDING_PLAYLISTS_PAGE, diff --git a/packages/mobile/src/assets/images/discoverWeekly.jpg b/packages/mobile/src/assets/images/weeklyRotation.jpg similarity index 100% rename from packages/mobile/src/assets/images/discoverWeekly.jpg rename to packages/mobile/src/assets/images/weeklyRotation.jpg diff --git a/packages/mobile/src/screens/app-screen/AppTabScreen.tsx b/packages/mobile/src/screens/app-screen/AppTabScreen.tsx index 39a99b49a2c..2622f006e18 100644 --- a/packages/mobile/src/screens/app-screen/AppTabScreen.tsx +++ b/packages/mobile/src/screens/app-screen/AppTabScreen.tsx @@ -39,7 +39,6 @@ import { } from 'app/screens/coin-details-screen' import { CoinRedeemScreen } from 'app/screens/coin-redeem-screen' import { CollectionScreen } from 'app/screens/collection-screen/CollectionScreen' -import { DiscoverWeeklyScreen } from 'app/screens/discover-weekly-screen' import { EditProfileScreen } from 'app/screens/edit-profile-screen' import { ProfileScreen } from 'app/screens/profile-screen' import { RewardsScreen } from 'app/screens/rewards-screen' @@ -67,6 +66,7 @@ import { CoinLeaderboardScreen } from 'app/screens/user-list-screen' import { WalletScreen } from 'app/screens/wallet-screen' +import { WeeklyRotationScreen } from 'app/screens/weekly-rotation-screen' import { ContestFollowersScreen, ContestScreen } from '../contest-screen' import { ContestsScreen } from '../contests-screen' @@ -111,7 +111,7 @@ export type AppTabScreenParamList = { SettingsScreen: undefined AboutScreen: undefined ListeningHistoryScreen: undefined - DiscoverWeeklyScreen: undefined + WeeklyRotationScreen: undefined AccountSettingsScreen: undefined ChangeEmail: undefined ChangePassword: undefined @@ -320,8 +320,8 @@ export const AppTabScreen = ({ baseScreen, Stack }: AppTabScreenProps) => { component={FanClubsExploreScreen} /> diff --git a/packages/mobile/src/screens/discover-weekly-screen/index.ts b/packages/mobile/src/screens/discover-weekly-screen/index.ts deleted file mode 100644 index 4d4cd538596..00000000000 --- a/packages/mobile/src/screens/discover-weekly-screen/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './DiscoverWeeklyScreen' diff --git a/packages/mobile/src/screens/explore-screen/components/ExploreContent.tsx b/packages/mobile/src/screens/explore-screen/components/ExploreContent.tsx index ba5182e75dd..2a5ae47b829 100644 --- a/packages/mobile/src/screens/explore-screen/components/ExploreContent.tsx +++ b/packages/mobile/src/screens/explore-screen/components/ExploreContent.tsx @@ -8,7 +8,7 @@ import { useSearchCategory } from 'app/screens/search-screen/searchState' import { ArtistSpotlight } from './ArtistSpotlight' import { BestSellingAlbums } from './BestSellingAlbums' -import { DiscoverWeekly } from './DiscoverWeekly' +import { WeeklyRotation } from './WeeklyRotation' import { FeaturedPlaylists } from './FeaturedPlaylists' import { FeaturedRemixContests } from './FeaturedRemixContests' import { FeelingLucky } from './FeelingLucky' @@ -32,7 +32,7 @@ export const ExploreContent = () => { return ( {showTrackContent && showUserContextualContent && ( - + )} {showPlaylistContent && } {showTrackContent && } diff --git a/packages/mobile/src/screens/explore-screen/components/DiscoverWeekly.tsx b/packages/mobile/src/screens/explore-screen/components/WeeklyRotation.tsx similarity index 70% rename from packages/mobile/src/screens/explore-screen/components/DiscoverWeekly.tsx rename to packages/mobile/src/screens/explore-screen/components/WeeklyRotation.tsx index a5bf2efc0ff..9b6e4a65f3a 100644 --- a/packages/mobile/src/screens/explore-screen/components/DiscoverWeekly.tsx +++ b/packages/mobile/src/screens/explore-screen/components/WeeklyRotation.tsx @@ -1,14 +1,14 @@ import React, { useCallback, useEffect, useRef } from 'react' -import { useDiscoverWeekly } from '@audius/common/api' +import { useWeeklyRotation } from '@audius/common/api' import { useAnalytics, useFeatureFlag } from '@audius/common/hooks' import { exploreMessages as messages } from '@audius/common/messages' -import { Name, type DiscoverWeeklySurface } from '@audius/common/models' +import { Name, type WeeklyRotationSurface } from '@audius/common/models' import { FeatureFlags } from '@audius/common/services' import { Image } from 'react-native' import { Flex, Paper, Text } from '@audius/harmony-native' -import discoverWeeklyArt from 'app/assets/images/discoverWeekly.jpg' +import weeklyRotationArt from 'app/assets/images/weeklyRotation.jpg' import { useNavigation } from 'app/hooks/useNavigation' import { useExploreSectionTracking } from '../hooks/useExploreSectionTracking' @@ -16,30 +16,30 @@ import { useExploreSectionTracking } from '../hooks/useExploreSectionTracking' const ART_SIZE = 96 /** - * Promotional banner for Discover Weekly, pinned to the top of Explore. + * Promotional banner for Weekly Rotation, pinned to the top of Explore. * * Mirrors the web banner: an entry point rather than a content row, so it * navigates to the full mix instead of playing in place. Deliberately not * wrapped in ExploreSection -- it sits above the section stack. */ -type DiscoverWeeklyProps = { +type WeeklyRotationProps = { /** Which surface this instance renders on -- carried on every event so we * can tell which entry point actually drives listens. */ - surface?: DiscoverWeeklySurface + surface?: WeeklyRotationSurface } -export const DiscoverWeekly = ({ +export const WeeklyRotation = ({ surface = 'explore' -}: DiscoverWeeklyProps) => { - const { InViewWrapper, inView } = useExploreSectionTracking('Discover Weekly') +}: WeeklyRotationProps) => { + const { InViewWrapper, inView } = useExploreSectionTracking('Weekly Rotation') const navigation = useNavigation() const { trackEvent } = useAnalytics() - const { isEnabled: isDiscoverWeeklyEnabled } = useFeatureFlag( - FeatureFlags.DISCOVER_WEEKLY + const { isEnabled: isWeeklyRotationEnabled } = useFeatureFlag( + FeatureFlags.WEEKLY_ROTATION ) - const { trackIds, isError, isSuccess } = useDiscoverWeekly( + const { trackIds, isError, isSuccess } = useWeeklyRotation( { limit: 30 }, - { enabled: inView && isDiscoverWeeklyEnabled } + { enabled: inView && isWeeklyRotationEnabled } ) // Fire the impression once, and only once there's a real mix behind it. @@ -48,7 +48,7 @@ export const DiscoverWeekly = ({ if (hasTrackedView.current || !inView || !trackIds.length) return hasTrackedView.current = true trackEvent({ - eventName: Name.DISCOVER_WEEKLY_BANNER_VIEW, + eventName: Name.WEEKLY_ROTATION_BANNER_VIEW, surface, source: 'mobile', trackCount: trackIds.length @@ -57,18 +57,18 @@ export const DiscoverWeekly = ({ const handlePress = useCallback(() => { trackEvent({ - eventName: Name.DISCOVER_WEEKLY_BANNER_CLICK, + eventName: Name.WEEKLY_ROTATION_BANNER_CLICK, surface, source: 'mobile', trackCount: trackIds.length }) - navigation.navigate('DiscoverWeeklyScreen') + navigation.navigate('WeeklyRotationScreen') }, [navigation, trackEvent, surface, trackIds.length]) // The flag check sits with the empty/error case so both surfaces that render // this banner -- Explore and the feed -- are gated by this one return. if ( - !isDiscoverWeeklyEnabled || + !isWeeklyRotationEnabled || isError || (isSuccess && trackIds.length === 0) ) { @@ -79,18 +79,18 @@ export const DiscoverWeekly = ({ - {messages.discoverWeeklyBadge} + {messages.weeklyRotationBadge} - {messages.discoverWeekly} + {messages.weeklyRotation} - {messages.discoverWeeklyPitch} + {messages.weeklyRotationPitch} diff --git a/packages/mobile/src/screens/feed-screen/FeedScreen.tsx b/packages/mobile/src/screens/feed-screen/FeedScreen.tsx index fdcbe496a70..9092bf34e80 100644 --- a/packages/mobile/src/screens/feed-screen/FeedScreen.tsx +++ b/packages/mobile/src/screens/feed-screen/FeedScreen.tsx @@ -35,7 +35,7 @@ import { useResetGlassScroll } from 'app/screens/app-screen/GlassChromeContext' import { MobileRootHeader } from 'app/screens/app-screen/MobileRootHeader' -import { DiscoverWeekly } from 'app/screens/explore-screen/components/DiscoverWeekly' +import { WeeklyRotation } from 'app/screens/explore-screen/components/WeeklyRotation' import { make, track } from 'app/services/analytics' import { FeedFilterButton } from './FeedFilterButton' @@ -272,7 +272,7 @@ export const FeedScreen = () => { source='DISCOVER_FEED' pullToRefresh={false} hideHeaderOnEmpty - header={} + header={} LineupEmptyComponent={} ListFooterComponent={ @@ -287,7 +287,7 @@ export const FeedScreen = () => { source='DISCOVER_FEED' pullToRefresh hideHeaderOnEmpty - header={} + header={} LineupEmptyComponent={} ListFooterComponent={ diff --git a/packages/mobile/src/screens/discover-weekly-screen/DiscoverWeeklyScreen.tsx b/packages/mobile/src/screens/weekly-rotation-screen/WeeklyRotationScreen.tsx similarity index 83% rename from packages/mobile/src/screens/discover-weekly-screen/DiscoverWeeklyScreen.tsx rename to packages/mobile/src/screens/weekly-rotation-screen/WeeklyRotationScreen.tsx index fbd0e33a383..1cf8496bd83 100644 --- a/packages/mobile/src/screens/discover-weekly-screen/DiscoverWeeklyScreen.tsx +++ b/packages/mobile/src/screens/weekly-rotation-screen/WeeklyRotationScreen.tsx @@ -1,6 +1,6 @@ import React, { useCallback, useEffect, useMemo, useRef } from 'react' -import { useDiscoverWeekly } from '@audius/common/api' +import { useWeeklyRotation } from '@audius/common/api' import { useAnalytics } from '@audius/common/hooks' import { exploreMessages } from '@audius/common/messages' import type { ID } from '@audius/common/models' @@ -18,26 +18,26 @@ import { Paper, Text } from '@audius/harmony-native' -import discoverWeeklyArt from 'app/assets/images/discoverWeekly.jpg' +import weeklyRotationArt from 'app/assets/images/weeklyRotation.jpg' import { Screen, ScreenContent } from 'app/components/core' import { TrackLineup } from 'app/components/lineup/TrackLineup' const messages = { - title: 'Discover Weekly' + title: 'Weekly Rotation' } const ART_SIZE = 120 -const DISCOVER_WEEKLY_SOURCE = 'DISCOVER_WEEKLY_TRACKS' +const WEEKLY_ROTATION_SOURCE = 'WEEKLY_ROTATION_TRACKS' /** - * The full Discover Weekly mix. Mirrors the web page: artwork header, then the + * The full Weekly Rotation mix. Mirrors the web page: artwork header, then the * track list. * * The endpoint returns a fixed 30, so there is no pagination -- hasNextPage is * false and loadNextPage is a no-op. */ -export const DiscoverWeeklyScreen = () => { - const { trackIds, isPending, isFetching } = useDiscoverWeekly({ limit: 30 }) +export const WeeklyRotationScreen = () => { + const { trackIds, isPending, isFetching } = useWeeklyRotation({ limit: 30 }) const { trackEvent } = useAnalytics() const dispatch = useDispatch() @@ -50,7 +50,7 @@ export const DiscoverWeeklyScreen = () => { () => trackIds.map((id) => ({ trackId: id, - source: DISCOVER_WEEKLY_SOURCE + source: WEEKLY_ROTATION_SOURCE })), [trackIds] ) @@ -69,7 +69,7 @@ export const DiscoverWeeklyScreen = () => { } trackEvent({ - eventName: Name.DISCOVER_WEEKLY_PLAY_ALL, + eventName: Name.WEEKLY_ROTATION_PLAY_ALL, source: 'mobile', trackCount: playbackQueue.length }) @@ -89,7 +89,7 @@ export const DiscoverWeeklyScreen = () => { if (hasTrackedView.current || !trackIds.length) return hasTrackedView.current = true trackEvent({ - eventName: Name.DISCOVER_WEEKLY_PAGE_VIEW, + eventName: Name.WEEKLY_ROTATION_PAGE_VIEW, source: 'mobile', trackCount: trackIds.length }) @@ -99,19 +99,19 @@ export const DiscoverWeeklyScreen = () => { - {exploreMessages.discoverWeekly} + {exploreMessages.weeklyRotation} - {exploreMessages.discoverWeeklySubtitle} + {exploreMessages.weeklyRotationSubtitle} {trackIds.length ? ( - {exploreMessages.discoverWeeklyTrackCount(trackIds.length)} + {exploreMessages.weeklyRotationTrackCount(trackIds.length)} ) : null} )} diff --git a/packages/web/src/components/weekly-rotation/index.ts b/packages/web/src/components/weekly-rotation/index.ts new file mode 100644 index 00000000000..66011a250c2 --- /dev/null +++ b/packages/web/src/components/weekly-rotation/index.ts @@ -0,0 +1 @@ +export * from './WeeklyRotationBanner' diff --git a/packages/web/src/pages/feed-page/components/desktop/FeedPageContent.tsx b/packages/web/src/pages/feed-page/components/desktop/FeedPageContent.tsx index dcf79782ca6..5e0e3cd6478 100644 --- a/packages/web/src/pages/feed-page/components/desktop/FeedPageContent.tsx +++ b/packages/web/src/pages/feed-page/components/desktop/FeedPageContent.tsx @@ -15,7 +15,7 @@ import { Flex, IconFeed } from '@audius/harmony' import { make, useRecord } from 'common/store/analytics/actions' import { MIN_DESKTOP_CONTENT_WIDTH_PX } from 'common/utils/layout' -import { DiscoverWeeklyBanner } from 'components/discover-weekly' +import { WeeklyRotationBanner } from 'components/weekly-rotation' import { Header } from 'components/header/desktop/Header' import EndOfLineup from 'components/lineup/EndOfLineup' import { TrackLineup } from 'components/lineup/TrackLineup' @@ -164,7 +164,7 @@ const FeedPageContent = ({ containerRef }: FeedPageContentProps) => { {/* Above the lineup so the mix is reachable without leaving the feed: Explore is the only other entry point and it takes a deliberate detour to get to. */} - + + element: }, { key: 'featuredPlaylists', diff --git a/packages/web/src/pages/search-explore-page/components/mobile/SearchExplorePage.tsx b/packages/web/src/pages/search-explore-page/components/mobile/SearchExplorePage.tsx index 1271eda816e..8300d0363e7 100644 --- a/packages/web/src/pages/search-explore-page/components/mobile/SearchExplorePage.tsx +++ b/packages/web/src/pages/search-explore-page/components/mobile/SearchExplorePage.tsx @@ -22,7 +22,7 @@ import { capitalize } from 'lodash' import { useSearchParams } from 'react-router' import { useDebounce, usePrevious } from 'react-use' -import { DiscoverWeeklyBanner } from 'components/discover-weekly' +import { WeeklyRotationBanner } from 'components/weekly-rotation' import Header from 'components/header/mobile/Header' import { HeaderContext } from 'components/header/mobile/HeaderContextProvider' import MobilePageContainer from 'components/mobile-page-container/MobilePageContainer' @@ -229,7 +229,7 @@ const SearchExplorePage = ({ }} > {showTrackContent && showUserContextualContent ? ( - + ) : null} {isTracksTab ? : null} {showTrackContent && showUserContextualContent ? ( diff --git a/packages/web/src/pages/discover-weekly-page/DiscoverWeeklyPage.tsx b/packages/web/src/pages/weekly-rotation-page/WeeklyRotationPage.tsx similarity index 84% rename from packages/web/src/pages/discover-weekly-page/DiscoverWeeklyPage.tsx rename to packages/web/src/pages/weekly-rotation-page/WeeklyRotationPage.tsx index 00fc91c94b8..c9b406adc76 100644 --- a/packages/web/src/pages/discover-weekly-page/DiscoverWeeklyPage.tsx +++ b/packages/web/src/pages/weekly-rotation-page/WeeklyRotationPage.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useMemo, useRef } from 'react' -import { useCurrentUserId, useDiscoverWeekly } from '@audius/common/api' +import { useCurrentUserId, useWeeklyRotation } from '@audius/common/api' import { useAnalytics, useFeatureFlag } from '@audius/common/hooks' import { exploreMessages } from '@audius/common/messages' import { ID, Name, PlaybackSource } from '@audius/common/models' @@ -19,7 +19,7 @@ import { import { useDispatch, useSelector } from 'react-redux' import { Navigate } from 'react-router' -import discoverWeeklyArt from 'assets/img/discoverWeekly.jpg' +import weeklyRotationArt from 'assets/img/weeklyRotation.jpg' import { make } from 'common/store/analytics/actions' import Page from 'components/page/Page' import { RESPONSIVE_TABLE_POLICIES } from 'components/table/responsivePolicies' @@ -28,14 +28,14 @@ import { useIsMobile } from 'hooks/useIsMobile' import { useMainContentRef } from 'pages/MainContentContext' const messages = { - title: 'Discover Weekly', + title: 'Weekly Rotation', description: 'A fresh mix of tracks picked for you, updated every Monday on Audius.' } const { EXPLORE_PAGE } = route -const DISCOVER_WEEKLY_SOURCE = 'DISCOVER_WEEKLY_TRACKS' +const WEEKLY_ROTATION_SOURCE = 'WEEKLY_ROTATION_TRACKS' const PAGE_SIZE = 30 const ARTWORK_SIZE = 200 @@ -49,7 +49,7 @@ const columns: TracksTableColumn[] = [ ] /** - * The full Discover Weekly mix. + * The full Weekly Rotation mix. * * Structured like a collection page -- artwork, title, play-all, track list -- * but it isn't backed by a collection entity, so it's assembled from the same @@ -59,7 +59,7 @@ const columns: TracksTableColumn[] = [ * * The endpoint returns a fixed 30, so there is no pagination. */ -export const DiscoverWeeklyPage = () => { +export const WeeklyRotationPage = () => { const dispatch = useDispatch() const isMobile = useIsMobile() const { trackEvent } = useAnalytics() @@ -69,12 +69,12 @@ export const DiscoverWeeklyPage = () => { // The route stays registered while the flag is off -- the URL is public and // shareable, so a link that predates the rollout should land somewhere real // rather than 404. - const { isEnabled: isDiscoverWeeklyEnabled, isLoaded: isFlagLoaded } = - useFeatureFlag(FeatureFlags.DISCOVER_WEEKLY) + const { isEnabled: isWeeklyRotationEnabled, isLoaded: isFlagLoaded } = + useFeatureFlag(FeatureFlags.WEEKLY_ROTATION) - const { trackIds, isPending, isFetching, isLoading } = useDiscoverWeekly( + const { trackIds, isPending, isFetching, isLoading } = useWeeklyRotation( { limit: PAGE_SIZE }, - { enabled: isDiscoverWeeklyEnabled } + { enabled: isWeeklyRotationEnabled } ) // Fired once the mix resolves rather than on mount, so trackCount is real @@ -84,7 +84,7 @@ export const DiscoverWeeklyPage = () => { if (hasTrackedView.current || !trackIds.length) return hasTrackedView.current = true trackEvent({ - eventName: Name.DISCOVER_WEEKLY_PAGE_VIEW, + eventName: Name.WEEKLY_ROTATION_PAGE_VIEW, source: isMobile ? 'mobile' : 'web', trackCount: trackIds.length }) @@ -99,7 +99,7 @@ export const DiscoverWeeklyPage = () => { () => trackIds.map((id) => ({ trackId: id, - source: DISCOVER_WEEKLY_SOURCE + source: WEEKLY_ROTATION_SOURCE })), [trackIds] ) @@ -124,7 +124,7 @@ export const DiscoverWeeklyPage = () => { } trackEvent({ - eventName: Name.DISCOVER_WEEKLY_PLAY_ALL, + eventName: Name.WEEKLY_ROTATION_PLAY_ALL, source: isMobile ? 'mobile' : 'web', trackCount: playbackQueue.length }) @@ -155,7 +155,7 @@ export const DiscoverWeeklyPage = () => { // Nothing until remote config resolves, so an enabled user doesn't get // bounced to Explore on the first frame. if (!isFlagLoaded) return null - if (!isDiscoverWeeklyEnabled) return + if (!isWeeklyRotationEnabled) return return ( @@ -166,7 +166,7 @@ export const DiscoverWeeklyPage = () => { alignItems={isMobile ? 'center' : 'flex-end'} > { size='s' textAlign={isMobile ? 'center' : undefined} > - {exploreMessages.discoverWeekly} + {exploreMessages.weeklyRotation} - {exploreMessages.discoverWeeklySubtitle} + {exploreMessages.weeklyRotationSubtitle} {trackIds.length - ? ` · ${exploreMessages.discoverWeeklyTrackCount(trackIds.length)}` + ? ` · ${exploreMessages.weeklyRotationTrackCount(trackIds.length)}` : ''}