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
1 change: 1 addition & 0 deletions packages/common/src/api/tan-query/comments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from './types'
export * from './utils'
export * from './useUserComments'
export * from './useTrackComments'
export * from './useTimestampedComments'
export * from './useComment'
export * from './useComments'
export * from './useTrackCommentCount'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useMemo } from 'react'

import { useTrackComments } from '@audius/common/api'
import type { Comment, ID } from '@audius/common/models'
import type { Comment, ID } from '~/models'

import { useTrackComments } from './useTrackComments'

const PAGE_SIZE = 50
// GetTrackCommentsSortMethodEnum.Timestamp
Expand Down
10 changes: 7 additions & 3 deletions packages/common/src/services/remote-config/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export enum FeatureFlags {
QUEUE_NEW_FEATURE_BADGE = 'queue_new_feature_badge',
WEEKLY_ROTATION = 'weekly_rotation',
TRACK_ROWS = 'track_rows',
NOW_PLAYING_COMMENTS = 'now_playing_comments'
NOW_PLAYING_COMMENTS = 'now_playing_comments',
TRACK_TILE_WAVEFORM = 'track_tile_waveform'
}

type FlagDefaults = Record<FeatureFlags, boolean>
Expand All @@ -28,7 +29,8 @@ export const environmentFlagDefaults: Record<
Partial<FlagDefaults>
> = {
development: {
[FeatureFlags.FAN_CLUB_TEXT_POST_POSTING]: true
[FeatureFlags.FAN_CLUB_TEXT_POST_POSTING]: true,
[FeatureFlags.TRACK_TILE_WAVEFORM]: true
},
production: {}
}
Expand Down Expand Up @@ -59,5 +61,7 @@ export const flagDefaults: FlagDefaults = {
[FeatureFlags.TRACK_ROWS]: false,
// Timestamped comments as markers and bubbles on the Now Playing scrubber.
// Default on; the remote flag is the kill switch.
[FeatureFlags.NOW_PLAYING_COMMENTS]: true
[FeatureFlags.NOW_PLAYING_COMMENTS]: true,
// Waveform with timestamped comment avatars on desktop web track tiles.
[FeatureFlags.TRACK_TILE_WAVEFORM]: false
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useMemo, useState } from 'react'

import { useUser } from '@audius/common/api'
import type { TimestampedComment } from '@audius/common/api'
import type { ID } from '@audius/common/models'
import { playbackSelectors } from '@audius/common/store'
import { Dimensions, Pressable, View } from 'react-native'
Expand All @@ -13,8 +14,6 @@ import { useCommentDrawer } from 'app/components/comments/CommentDrawerContext'
import { ProfilePicture } from 'app/components/core'
import { useNavigation } from 'app/hooks/useNavigation'

import type { TimestampedComment } from './useTimestampedComments'

const { getSeek, getSeekCounter } = playbackSelectors

const messages = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
useState
} from 'react'

import { useUser } from '@audius/common/api'
import { useUser, useTimestampedComments } from '@audius/common/api'
import { useCurrentTrack, useFeatureFlag } from '@audius/common/hooks'
import { FeatureFlags } from '@audius/common/services'
import { playbackActions, playbackSelectors } from '@audius/common/store'
Expand Down Expand Up @@ -60,7 +60,6 @@ import { TitleBar } from './TitleBar'
import { TrackInfo } from './TrackInfo'
import { PLAY_BAR_HEIGHT } from './constants'
import { useCurrentTrackDuration } from './useCurrentTrackDuration'
import { useTimestampedComments } from './useTimestampedComments'
const { seekTo: seek, reset, next, previous } = playbackActions

const { getPlaying, getTrackId, getCounter, getBuffering } = playbackSelectors
Expand Down
50 changes: 43 additions & 7 deletions packages/web/src/components/track/desktop/TrackTile.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { useCallback, useEffect, MouseEvent } from 'react'

import { useCurrentUserId, useTrack, useUser } from '@audius/common/api'
import { useGatedContentAccess } from '@audius/common/hooks'
import { useFeatureFlag, useGatedContentAccess } from '@audius/common/hooks'
import {
ShareSource,
RepostSource,
FavoriteSource,
ID
} from '@audius/common/models'
import { FeatureFlags } from '@audius/common/services'
import {
tracksSocialActions,
shareModalUIActions,
Expand Down Expand Up @@ -51,6 +52,7 @@ import { TrackTileSize } from '../types'

import styles from './TrackTile.module.css'
import { TrackTileDuration } from './TrackTileDuration'
import { TrackTileWaveform } from './TrackTileWaveform'

const { requestOpen: requestOpenShareModal } = shareModalUIActions
const { repostTrack, undoRepostTrack, saveTrack, unsaveTrack } =
Expand All @@ -62,6 +64,8 @@ const {
getPlaying
} = playbackSelectors

const WAVEFORM_ARTWORK_SIZE = 176

// Props from ConnectedTrackTile
export type TrackTileProps = {
id: ID
Expand Down Expand Up @@ -139,7 +143,9 @@ export const TrackTile = ({
permalink,
_co_sign: coSign,
has_current_user_reposted: isReposted,
has_current_user_saved: isFavorited
has_current_user_saved: isFavorited,
duration,
comment_count: commentCount
} = trackWithFallback

const isArtistPick = partialUser?.artist_pick_track_id === trackId
Expand All @@ -148,6 +154,21 @@ export const TrackTile = ({
useGatedContentAccess(trackWithFallback)
const loading = isLoading || isFetchingNFTAccess || isPending

const { isEnabled: isWaveformEnabled } = useFeatureFlag(
FeatureFlags.TRACK_TILE_WAVEFORM
)
const showWaveform =
isWaveformEnabled &&
size === TrackTileSize.LARGE &&
!loading &&
duration > 0
// With the waveform the right column is ~176px tall; the artwork matches it.
const artworkSize = showWaveform
? WAVEFORM_ARTWORK_SIZE
: size === TrackTileSize.LARGE
? 128
: 108

const [, setLockedContentVisibility] = useModalState('LockedContent')

useEffect(() => {
Expand Down Expand Up @@ -319,7 +340,12 @@ export const TrackTile = ({
disableActions && { opacity: 0.5, pointerEvents: 'none' },
{
cursor: canClickTile ? 'pointer' : 'default',
height: size === TrackTileSize.LARGE ? 144 : 128,
// The waveform tile is taller; its height comes from the content.
height: showWaveform
? undefined
: size === TrackTileSize.LARGE
? 144
: 128,
containerType: 'inline-size',
'&:hover .artworkIcon': { opacity: 0.75 },
'&:hover': { transform: 'scale(1.004)' },
Expand All @@ -343,10 +369,7 @@ export const TrackTile = ({
</Flex>
)}
{/* Track tile image */}
<Box
h={size === TrackTileSize.LARGE ? 128 : 108}
w={size === TrackTileSize.LARGE ? 128 : 108}
>
<Box h={artworkSize} w={artworkSize}>
<button
type='button'
aria-label={artworkActionLabel}
Expand Down Expand Up @@ -440,6 +463,19 @@ export const TrackTile = ({
</Flex>
</Flex>
</Flex>
{showWaveform ? (
<TrackTileWaveform
trackId={trackId}
title={title}
permalink={permalink}
duration={duration}
commentCount={commentCount}
isActive={isActive}
isPlaying={isTrackPlaying}
canSeek={hasStreamAccess}
onPlay={onTogglePlay}
/>
) : null}
<TrackTileStats
trackId={trackId}
size={size}
Expand Down
Loading
Loading