Skip to content

Commit

Permalink
[C-3697, C-3713, C-3714] Copy updates; add missing overflow menu items (
Browse files Browse the repository at this point in the history
  • Loading branch information
amendelsohn committed Jan 24, 2024
1 parent bed6b71 commit 997a7fa
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/common/src/store/ui/mobile-overflow-menu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum OverflowAction {
REMOVE_FROM_PLAYLIST = 'REMOVE_FROM_PLAYLIST',
EDIT_ALBUM = 'EDIT_ALBUM',
EDIT_PLAYLIST = 'EDIT_PLAYLIST',
DELETE_ALBUM = 'DELETE_ALBUM',
DELETE_PLAYLIST = 'DELETE_PLAYLIST',
PUBLISH_PLAYLIST = 'PUBLISH_PLAYLIST',
EDIT_TRACK = 'EDIT_TRACK',
Expand Down
20 changes: 16 additions & 4 deletions packages/mobile/src/components/lineup-tile/CollectionTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ import {
OverflowSource,
mobileOverflowMenuUIActions,
shareModalUIActions,
RepostType
RepostType,
FeatureFlags
} from '@audius/common'
import { useDispatch, useSelector } from 'react-redux'

import { CollectionImage } from 'app/components/image/CollectionImage'
import { useNavigation } from 'app/hooks/useNavigation'
import { useFeatureFlag } from 'app/hooks/useRemoteConfig'
import { setVisibility } from 'app/store/drawers/slice'
import { getIsCollectionMarkedForDownload } from 'app/store/offline-downloads/selectors'

Expand Down Expand Up @@ -121,6 +123,10 @@ const CollectionTileComponent = ({
return tracks.some((track) => track.uid === uid)
})

const { isEnabled: isEditAlbumsEnabled } = useFeatureFlag(
FeatureFlags.EDIT_ALBUMS
)

const {
has_current_user_reposted,
has_current_user_saved,
Expand Down Expand Up @@ -176,8 +182,14 @@ const CollectionTileComponent = ({
is_album
? OverflowAction.VIEW_ALBUM_PAGE
: OverflowAction.VIEW_PLAYLIST_PAGE,
isOwner && !is_album ? OverflowAction.PUBLISH_PLAYLIST : null,
isOwner && !is_album ? OverflowAction.DELETE_PLAYLIST : null,
isOwner && (!is_album || isEditAlbumsEnabled)
? OverflowAction.PUBLISH_PLAYLIST
: null,
isOwner && (!is_album || isEditAlbumsEnabled)
? is_album
? OverflowAction.DELETE_ALBUM
: OverflowAction.DELETE_PLAYLIST
: null,
OverflowAction.VIEW_ARTIST_PAGE
].filter(removeNullable)

Expand All @@ -188,7 +200,7 @@ const CollectionTileComponent = ({
overflowActions
})
)
}, [playlist_id, dispatch, isOwner, is_album])
}, [playlist_id, is_album, isOwner, isEditAlbumsEnabled, dispatch])

const handlePressShare = useCallback(() => {
if (playlist_id === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ const CollectionOverflowMenuDrawer = ({ render }: Props) => {
[OverflowAction.EDIT_PLAYLIST]: () => {
navigation?.push('EditPlaylist', { id })
},
[OverflowAction.DELETE_ALBUM]: () =>
dispatch(openDeletePlaylist({ playlistId: id })),
[OverflowAction.DELETE_PLAYLIST]: () =>
dispatch(openDeletePlaylist({ playlistId: id })),
[OverflowAction.PUBLISH_PLAYLIST]: () => {
if (is_album) return () => {}
return dispatch(openPublishConfirmation({ playlistId: Number(id) }))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const overflowRowConfig: Record<OverflowAction, ActionDrawerRow> = {
},
[OverflowAction.EDIT_ALBUM]: { text: 'Edit Album' },
[OverflowAction.EDIT_PLAYLIST]: { text: 'Edit Playlist' },
[OverflowAction.DELETE_ALBUM]: {
text: 'Delete Album',
isDestructive: true
},
[OverflowAction.DELETE_PLAYLIST]: {
text: 'Delete Playlist',
isDestructive: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,18 @@ const CollectionScreenComponent = (props: CollectionScreenComponentProps) => {
const handlePressOverflow = useCallback(() => {
const overflowActions = [
(!is_album || isEditAlbumsEnabled) && isOwner
? OverflowAction.EDIT_PLAYLIST
? is_album
? OverflowAction.EDIT_ALBUM
: OverflowAction.EDIT_PLAYLIST
: null,
isOwner && !is_album && is_private
isOwner && (!is_album || isEditAlbumsEnabled) && is_private
? OverflowAction.PUBLISH_PLAYLIST
: null,
isOwner && !is_album ? OverflowAction.DELETE_PLAYLIST : null,
isOwner && (!is_album || isEditAlbumsEnabled)
? is_album
? OverflowAction.DELETE_ALBUM
: OverflowAction.DELETE_PLAYLIST
: null,
OverflowAction.VIEW_ARTIST_PAGE
].filter(removeNullable)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,18 @@ const CollectionHeader = ({
? OverflowAction.UNFAVORITE
: OverflowAction.FAVORITE,
(!isAlbum || isEditAlbumsEnabled) && isOwner
? OverflowAction.EDIT_PLAYLIST
? isAlbum
? OverflowAction.EDIT_ALBUM
: OverflowAction.EDIT_PLAYLIST
: null,
isOwner && !isAlbum && !isPublished
isOwner && (!isAlbum || isEditAlbumsEnabled) && !isPublished
? OverflowAction.PUBLISH_PLAYLIST
: null,
isOwner && !isAlbum ? OverflowAction.DELETE_PLAYLIST : null,
isOwner && (!isAlbum || isEditAlbumsEnabled)
? isAlbum
? OverflowAction.DELETE_ALBUM
: OverflowAction.DELETE_PLAYLIST
: null,
OverflowAction.VIEW_ARTIST_PAGE
].filter(Boolean)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const rowMessageMap = {
[OverflowAction.REMOVE_FROM_PLAYLIST]: 'Remove From This Playlist',
[OverflowAction.EDIT_ALBUM]: 'Edit Album',
[OverflowAction.EDIT_PLAYLIST]: 'Edit Playlist',
[OverflowAction.DELETE_ALBUM]: 'Delete Album',
[OverflowAction.DELETE_PLAYLIST]: 'Delete Playlist',
[OverflowAction.PUBLISH_PLAYLIST]: 'Publish Playlist',
[OverflowAction.VIEW_TRACK_PAGE]: 'View Track Page',
Expand Down Expand Up @@ -92,6 +93,7 @@ const MobileOverflowModal = ({
[OverflowAction.ADD_TO_PLAYLIST]: onAddToPlaylist,
[OverflowAction.EDIT_ALBUM]: onEditPlaylist,
[OverflowAction.EDIT_PLAYLIST]: onEditPlaylist,
[OverflowAction.DELETE_ALBUM]: onDeletePlaylist,
[OverflowAction.DELETE_PLAYLIST]: onDeletePlaylist,
[OverflowAction.PUBLISH_PLAYLIST]: onPublishPlaylist,
[OverflowAction.VIEW_TRACK_PAGE]: onVisitTrackPage,
Expand Down
18 changes: 14 additions & 4 deletions packages/web/src/components/track/mobile/ConnectedPlaylistTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ import {
RepostType,
favoritesUserListActions,
repostsUserListActions,
playerSelectors
playerSelectors,
FeatureFlags
} from '@audius/common'
import { push as pushRoute } from 'connected-react-router'
import { connect } from 'react-redux'
import { Dispatch } from 'redux'

import { useRecord, make } from 'common/store/analytics/actions'
import { PlaylistTileProps } from 'components/track/types'
import { useFlag } from 'hooks/useRemoteConfig'
import { AppState } from 'store/types'
import {
collectionPage,
Expand Down Expand Up @@ -129,6 +131,8 @@ const ConnectedPlaylistTile = ({
return tracks.some((track) => track.uid === playingUid)
}, [tracks, playingUid])

const { isEnabled: isEditAlbumsEnabled } = useFlag(FeatureFlags.EDIT_ALBUMS)

const isOwner = collection.playlist_owner_id === currentUserId

const toggleSave = useCallback(() => {
Expand Down Expand Up @@ -181,8 +185,14 @@ const ConnectedPlaylistTile = ({
collection.is_album
? OverflowAction.VIEW_ALBUM_PAGE
: OverflowAction.VIEW_PLAYLIST_PAGE,
isOwner && !collection.is_album ? OverflowAction.PUBLISH_PLAYLIST : null,
isOwner && !collection.is_album ? OverflowAction.DELETE_PLAYLIST : null,
isOwner && (!collection.is_album || isEditAlbumsEnabled)
? OverflowAction.PUBLISH_PLAYLIST
: null,
isOwner && (!collection.is_album || isEditAlbumsEnabled)
? collection.is_album
? OverflowAction.DELETE_ALBUM
: OverflowAction.DELETE_PLAYLIST
: null,
OverflowAction.VIEW_ARTIST_PAGE
].filter(Boolean)

Expand All @@ -191,7 +201,7 @@ const ConnectedPlaylistTile = ({
// @ts-ignore
overflowActions
)
}, [collection, isOwner, clickOverflow])
}, [collection, isOwner, clickOverflow, isEditAlbumsEnabled])

const togglePlay = useCallback(() => {
if (uploading) return
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/pages/oauth-login-page/OAuthLoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { reportToSentry } from 'store/errors/reportToSentry'
import { SIGN_UP_PAGE } from 'utils/route'

import styles from './OAuthLoginPage.module.css'
import { ApproveTransactionScreen } from './components/ApproveTransactionScreen'
import { CTAButton } from './components/CTAButton'
import { ContentWrapper } from './components/ContentWrapper'
import { PermissionsSection } from './components/PermissionsSection'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const uploadDescriptions = {
[UploadType.PLAYLIST]:
'Create a playlist from your tracks. You can easily modify this playlist later, even adding tracks from other artists.',
[UploadType.ALBUM]:
'Group your tracks into an album. Once created, albums cannot be changed.',
'Upload your songs into an album. Albums can only include your own tracks.',
[UploadType.INDIVIDUAL_TRACKS]:
'Upload single tracks. Each appears separately.',
[UploadType.INDIVIDUAL_TRACK]:
Expand Down

0 comments on commit 997a7fa

Please sign in to comment.