Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA-1295] Fix mobile-web edit playlist page #8525

Merged
merged 1 commit into from
May 16, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const EditPlaylistPage = g(

// Close the page if the route was changed
useHasChangedRoute(onClose)

const initialMetadata = {
...(metadata as Collection),
artwork: { url: '' }
Expand All @@ -88,7 +89,7 @@ const EditPlaylistPage = g(
)

const [showRemoveTrackDrawer, setShowRemoveTrackDrawer] = useState(false)
const onDrawerClose = () => setShowRemoveTrackDrawer(false)
const onDrawerClose = useCallback(() => setShowRemoveTrackDrawer(false), [])

// Holds all tracks to be removed on save
const [removedTracks, setRemovedTracks] = useState<
Expand Down Expand Up @@ -228,16 +229,7 @@ const EditPlaylistPage = g(
}
refreshLineup()

const editPlaylistData: any = {
playlist_name: formFields.playlist_name,
description: formFields.description,
artwork: formFields.artwork,
tracks: formFields.tracks as any,
track_ids: formFields.playlist_contents.track_ids,
removedTracks: []
}

editPlaylist(metadata.playlist_id, editPlaylistData)
editPlaylist(metadata.playlist_id, formFields)

track({
eventName: Name.COLLECTION_EDIT,
Expand Down Expand Up @@ -315,12 +307,16 @@ const EditPlaylistPage = g(
tracks.filter((trackIndex) => trackIndex !== removeIdx)
)
onDrawerClose()
}, [metadata, confirmRemoveTrack, setRemovedTracks, setReorderedTracks])
}, [
confirmRemoveTrack,
metadata?.playlist_contents.track_ids,
onDrawerClose
])

const setters = useCallback(
() => ({
left: (
<TextElement text='Cancel' type={Type.SECONDARY} onClick={close} />
<TextElement text='Cancel' type={Type.SECONDARY} onClick={onClose} />
),
center: messages.editPlaylist,
right: (
Expand All @@ -332,7 +328,7 @@ const EditPlaylistPage = g(
/>
)
}),
[formFields.playlist_name, messages.editPlaylist, onSave]
[formFields.playlist_name, messages.editPlaylist, onClose, onSave]
)

useTemporaryNavContext(setters)
Expand Down
22 changes: 9 additions & 13 deletions packages/web/src/pages/modals/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,20 @@ const Modals = () => {

return (
<>
{commonModals.map(([modalName, Modal]) => {
return <AppModal key={modalName} name={modalName} modal={Modal} />
})}
<PasswordResetModal />
<FirstUploadModal />
<UnloadDialog />
<CollectibleDetailsModal />

{!isMobile && (
{isMobile ? (
<>
<ConnectedMobileOverflowModal />
<UnfollowConfirmationModal />
</>
) : (
<>
{commonModals.map(([modalName, Modal]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just double-checking this logic - we don't need these modals on mobile-web?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would hope not since none of them are formatted to work correctly, will double check git history though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we chillin

return <AppModal key={modalName} name={modalName} modal={Modal} />
})}
<EmbedModal />
<ConnectedUserListModal />
<AppCTAModal />
Expand All @@ -148,14 +152,6 @@ const Modals = () => {
<FeatureFlagOverrideModal />
</>
)}

{isMobile && (
<>
<ConnectedMobileOverflowModal />
<UnfollowConfirmationModal />
</>
)}

<TipAudioModal />
</>
)
Expand Down