Skip to content

Commit

Permalink
[QA-2003] Fix overflow menu share (#11524)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored Mar 6, 2025
1 parent 384f91d commit f50c813
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
13 changes: 11 additions & 2 deletions packages/web/src/components/menu/CollectionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@audius/common/models'
import {
cacheUsersSelectors,
shareModalUIActions,
collectionsSocialActions as socialActions
} from '@audius/common/store'
import { route } from '@audius/common/utils'
Expand All @@ -18,6 +19,8 @@ import { Dispatch } from 'redux'
import * as embedModalActions from 'components/embed-modal/store/actions'
import { AppState } from 'store/types'
import { push } from 'utils/navigation'

const { requestOpen: requestOpenShareModal } = shareModalUIActions
const { getUser } = cacheUsersSelectors
const { profilePage, collectionPage } = route

Expand Down Expand Up @@ -98,7 +101,7 @@ const CollectionMenu = ({
text: 'Share',
onClick: () => {
shareCollection(playlistId)
if (onShare) onShare()
onShare?.()
}
}

Expand Down Expand Up @@ -200,7 +203,13 @@ function mapDispatchToProps(dispatch: Dispatch) {
return {
goToRoute: (route: string) => dispatch(push(route)),
shareCollection: (playlistId: PlaylistId) =>
dispatch(socialActions.shareCollection(playlistId, ShareSource.OVERFLOW)),
dispatch(
requestOpenShareModal({
type: 'collection',
collectionId: playlistId,
source: ShareSource.OVERFLOW
})
),
saveCollection: (playlistId: PlaylistId) =>
dispatch(
socialActions.saveCollection(playlistId, FavoriteSource.OVERFLOW)
Expand Down
27 changes: 18 additions & 9 deletions packages/web/src/components/menu/TrackMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import {
playbackPositionSelectors,
CommonState,
artistPickModalActions,
useDeleteTrackConfirmationModal
useDeleteTrackConfirmationModal,
shareModalUIActions
} from '@audius/common/store'
import { Genre, Nullable, route } from '@audius/common/utils'
import { PopupMenuItem } from '@audius/harmony'
Expand All @@ -32,9 +33,12 @@ import { AppState } from 'store/types'
import { push } from 'utils/navigation'
import { albumPage } from 'utils/route'

const { requestOpen: requestOpenShareModal } = shareModalUIActions

const { profilePage } = route
const { requestOpen: openAddToCollection } = addToCollectionUIActions
const { repostTrack, undoRepostTrack, shareTrack } = tracksSocialActions
const { saveTrack, unsaveTrack, repostTrack, undoRepostTrack } =
tracksSocialActions
const { getCollectionId } = collectionPageSelectors
const { addTrackToPlaylist } = cacheCollectionsActions
const { deleteTrack } = cacheTracksActions
Expand Down Expand Up @@ -179,12 +183,7 @@ const TrackMenu = ({

const shareMenuItem = {
text: messages.share,
onClick: () => {
if (trackId) {
shareTrack(trackId)
toast(messages.copiedToClipboard)
}
}
onClick: () => shareTrack(trackId)
}

const repostMenuItem = {
Expand Down Expand Up @@ -369,7 +368,17 @@ function mapDispatchToProps(dispatch: Dispatch) {
addTrackToPlaylist: (trackId: ID, playlistId: ID) =>
dispatch(addTrackToPlaylist(trackId, playlistId)),
shareTrack: (trackId: ID) =>
dispatch(shareTrack(trackId, ShareSource.OVERFLOW)),
dispatch(
requestOpenShareModal({
type: 'track',
trackId,
source: ShareSource.OVERFLOW
})
),
saveTrack: (trackId: ID) =>
dispatch(saveTrack(trackId, FavoriteSource.OVERFLOW)),
unsaveTrack: (trackId: ID) =>
dispatch(unsaveTrack(trackId, FavoriteSource.OVERFLOW)),
repostTrack: (trackId: ID) =>
dispatch(repostTrack(trackId, RepostSource.OVERFLOW)),
undoRepostTrack: (trackId: ID) =>
Expand Down

0 comments on commit f50c813

Please sign in to comment.