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
2 changes: 0 additions & 2 deletions packages/common/src/services/remote-config/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export enum FeatureFlags {
COLLAPSED_EXPLORE_HEADER = 'collapsed_explore_header',
LAUNCHPAD_VERIFICATION = 'launchpad_verification',
FAN_CLUB_TEXT_POST_POSTING = 'fan_club_text_post_posting',
CONTESTS = 'contests',
QUEUE_NEW_FEATURE_BADGE = 'queue_new_feature_badge'
}

Expand Down Expand Up @@ -50,6 +49,5 @@ export const flagDefaults: FlagDefaults = {
[FeatureFlags.COLLAPSED_EXPLORE_HEADER]: false,
[FeatureFlags.LAUNCHPAD_VERIFICATION]: true,
[FeatureFlags.FAN_CLUB_TEXT_POST_POSTING]: false,
[FeatureFlags.CONTESTS]: false,
[FeatureFlags.QUEUE_NEW_FEATURE_BADGE]: false
}
81 changes: 0 additions & 81 deletions packages/mobile/src/components/remix-carousel/RemixContestCard.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/mobile/src/components/remix-carousel/index.ts

This file was deleted.

17 changes: 3 additions & 14 deletions packages/mobile/src/components/track-flair/TrackFlair.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import type { ReactNode } from 'react'

import { useRemixContest, useTrack } from '@audius/common/api'
import { useFeatureFlag } from '@audius/common/hooks'
import { useTrack } from '@audius/common/api'
import type { ID } from '@audius/common/models'
import { FeatureFlags } from '@audius/common/services'
import type { StyleProp, ViewStyle } from 'react-native'
import { View } from 'react-native'

import { IconCosign, IconContestSign } from '@audius/harmony-native'
import { IconCosign } from '@audius/harmony-native'

import { Size } from './types'

Expand Down Expand Up @@ -81,19 +79,10 @@ export const TrackFlair = ({ size, children, style, trackId }: CoSignProps) => {
)
}
})
const { data: remixContest } = useRemixContest(trackId)
// When CONTESTS is on, the contest experience moved to its own screen
// and the trophy flair on the artwork is an orphaned indicator on what
// should be a clean tile (Figma 2888-16639).
const { isEnabled: isContestsEnabled } = useFeatureFlag(FeatureFlags.CONTESTS)

const { size: iconSize, position } = layoutBySize[size]

const FlairIcon = isCosign
? IconCosign
: remixContest?.endDate && !isContestsEnabled
? IconContestSign
: null
const FlairIcon = isCosign ? IconCosign : null

return (
<View style={style}>
Expand Down
1 change: 0 additions & 1 deletion packages/mobile/src/harmony-native/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export { default as IconCloudDownloadPaused } from '@audius/harmony/src/assets/i
export { default as IconNotificationOn } from '@audius/harmony/src/assets/icons/NotificationOn.svg'
export { default as IconTrophy } from '@audius/harmony/src/assets/icons/Trophy.svg'
export { default as IconCosign } from '@audius/harmony/src/assets/icons/Cosign.svg'
export { default as IconContestSign } from '@audius/harmony/src/assets/icons/ContestSign.svg'
export { default as IconCloudDownloadQueued } from '@audius/harmony/src/assets/icons/CloudDownloadQueued.svg'
export { default as IconPause } from '@audius/harmony/src/assets/icons/Pause.svg'
export { default as IconTurntable } from '@audius/harmony/src/assets/icons/Turntable.svg'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import React from 'react'

import { useFeatureFlag } from '@audius/common/hooks'
import { FeatureFlags } from '@audius/common/services'

import { IconTrophy } from '@audius/harmony-native'

import { LeftNavLink } from './LeftNavLink'
Expand All @@ -12,12 +9,6 @@ const messages = {
}

export const ContestsNavItem = () => {
const { isEnabled: isContestsPageEnabled } = useFeatureFlag(
FeatureFlags.CONTESTS
)

if (!isContestsPageEnabled) return null

return (
<LeftNavLink icon={IconTrophy} label={messages.contests} to='Contests' />
)
Expand Down
10 changes: 0 additions & 10 deletions packages/mobile/src/screens/contest-screen/ContestScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import {
useUnfollowEvent,
useUser
} from '@audius/common/api'
import { useFeatureFlag } from '@audius/common/hooks'
import { Name, ShareSource } from '@audius/common/models'
import { FeatureFlags } from '@audius/common/services'
import { shareModalUIActions } from '@audius/common/store'
import { dayjs, getLocalTimezone } from '@audius/common/utils'
import { PortalHost } from '@gorhom/portal'
Expand Down Expand Up @@ -164,9 +162,6 @@ export const ContestScreen = () => {
const navigation = useNavigation()
const insets = useSafeAreaInsets()

const { isEnabled: isContestsEnabled, isLoaded: isFlagLoaded } =
useFeatureFlag(FeatureFlags.CONTESTS)

const { data: track } = useTrackByParams(params ?? {})
const trackId = track?.track_id
const { data: user } = useUser(track?.owner_id)
Expand Down Expand Up @@ -338,11 +333,6 @@ export const ContestScreen = () => {
navigation.setOptions({ headerShown: false })
}, [navigation])

if (isFlagLoaded && !isContestsEnabled) {
navigation.goBack()
return null
}

if (!track || !user || !contest || !eventId || trackId == null) {
return (
<Screen>
Expand Down
12 changes: 3 additions & 9 deletions packages/mobile/src/screens/contests-screen/ContestsScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { useCallback } from 'react'

import { useAllRemixContests } from '@audius/common/api'
import { useFeatureFlag } from '@audius/common/hooks'
import { FeatureFlags } from '@audius/common/services'

import {
Box,
Expand All @@ -23,9 +21,6 @@ const HERO_SKELETON_COUNT = 1
const GRID_SKELETON_COUNT = 4

export const ContestsScreen = () => {
const { isEnabled: isContestsPageEnabled } = useFeatureFlag(
FeatureFlags.CONTESTS
)
const {
data,
isPending,
Expand All @@ -34,12 +29,11 @@ export const ContestsScreen = () => {
hasNextPage,
fetchNextPage,
isFetchingNextPage
} = useAllRemixContests(undefined, { enabled: isContestsPageEnabled })
} = useAllRemixContests()

const contests = isContestsPageEnabled ? (data ?? []) : []
const contests = data ?? []
const [heroTrackId, ...gridTrackIds] = contests
const showSkeletons =
isContestsPageEnabled && (isPending || (!isSuccess && !isError))
const showSkeletons = isPending || (!isSuccess && !isError)
const showEmpty = isSuccess && contests.length === 0

const handleEndReached = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import React from 'react'

import {
useAllRemixContests,
useExploreContent,
useTracks
} from '@audius/common/api'
import { useFeatureFlag } from '@audius/common/hooks'
import { useAllRemixContests } from '@audius/common/api'
import { exploreMessages as messages } from '@audius/common/messages'
import { FeatureFlags } from '@audius/common/services'

import { useTheme } from '@audius/harmony-native'
import { ContestCard } from 'app/components/contest-card'
import { CardList } from 'app/components/core'
import { RemixContestCard } from 'app/components/remix-carousel/RemixContestCard'
import { TrackCardSkeleton } from 'app/components/track/TrackCardSkeleton'

import { useDeferredElement } from '../../../hooks/useDeferredElement'
Expand All @@ -22,59 +15,21 @@ import { ExploreSection } from './ExploreSection'
export const FeaturedRemixContests = () => {
const { spacing } = useTheme()
const { InViewWrapper, inView } = useDeferredElement()
const { isEnabled: isContestsPageEnabled } = useFeatureFlag(
FeatureFlags.CONTESTS
)

// When the contests feature is on the section title is just
// "Contests" — switch the data source from the curated featured
// list to the full live list so the carousel actually matches the
// label (Julian: "the full list of contests isn't showing on the
// mobile discovery page"). Backed by `useAllRemixContests`, the same
// source the dedicated /contests screen uses.
const { data: allContestTrackIds, isPending: isAllContestsPending } =
useAllRemixContests(undefined, { enabled: inView && isContestsPageEnabled })

const { data: exploreContent, isPending: isExplorePending } =
useExploreContent({ enabled: inView && !isContestsPageEnabled })

// Old-card path needs the hydrated track list; new-card path resolves per
// card internally so we skip this fetch when the flag is enabled.
const { data: remixContests } = useTracks(
exploreContent?.featuredRemixContests,
{ enabled: inView && !isContestsPageEnabled }
)
useAllRemixContests(undefined, { enabled: inView })

return (
<InViewWrapper>
<ExploreSection
title={
isContestsPageEnabled
? messages.contests
: messages.featuredRemixContests
}
>
{isContestsPageEnabled ? (
<CardList
data={(allContestTrackIds ?? []).map((trackId) => ({ trackId }))}
renderItem={({ item }) => <ContestCard trackId={item.trackId} />}
horizontal
carouselSpacing={spacing.l}
isLoading={isAllContestsPending}
LoadingCardComponent={TrackCardSkeleton}
/>
) : (
<CardList
data={remixContests?.map((track) => ({ trackId: track.track_id }))}
renderItem={({ item }) => (
<RemixContestCard trackId={item.trackId} />
)}
horizontal
carouselSpacing={spacing.l}
isLoading={isExplorePending}
LoadingCardComponent={TrackCardSkeleton}
/>
)}
<ExploreSection title={messages.contests}>
<CardList
data={(allContestTrackIds ?? []).map((trackId) => ({ trackId }))}
renderItem={({ item }) => <ContestCard trackId={item.trackId} />}
horizontal
carouselSpacing={spacing.l}
isLoading={isAllContestsPending}
LoadingCardComponent={TrackCardSkeleton}
/>
</ExploreSection>
</InViewWrapper>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { ReactElement } from 'react'

import { useProfileUser, useUserHasRemixContest } from '@audius/common/api'
import { useFeatureFlag, useIsArtist } from '@audius/common/hooks'
import { FeatureFlags } from '@audius/common/services'
import { useIsArtist } from '@audius/common/hooks'
import { ProfilePageTabs } from '@audius/common/store'
import { useSafeAreaInsets } from 'react-native-safe-area-context'

Expand Down Expand Up @@ -56,11 +55,10 @@ export const ProfileTabNavigator = ({
handle: params.handle
}
const isArtist = useIsArtist(params)
const { isEnabled: isContestsEnabled } = useFeatureFlag(FeatureFlags.CONTESTS)
const { hasContest: profileHasContest } = useUserHasRemixContest(
isArtist && isContestsEnabled ? user_id : null
isArtist ? user_id : null
)
const showContestsTab = isContestsEnabled && profileHasContest
const showContestsTab = profileHasContest

const trackScreen = collapsibleTabScreen({
name: ProfilePageTabs.TRACKS,
Expand Down Expand Up @@ -118,9 +116,9 @@ export const ProfileTabNavigator = ({
{albumsScreen}
{playlistsScreen}
{repostsScreen}
{/* Contests tab — gated by the CONTESTS flag AND on whether this
host actually runs any remix contest. Hidden otherwise so the
tab doesn't lead to an empty/unreachable destination. */}
{/* Contests tab — gated on whether this host actually runs any
remix contest. Hidden otherwise so the tab doesn't lead to an
empty/unreachable destination. */}
{showContestsTab ? contestsScreen : null}
</CollapsibleTabNavigator>
)
Expand Down
Loading
Loading