-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
chore: Refactor Edit Album Modal #18653
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,6 @@ | |
|
||
let albumGroupOption: string = $state(AlbumGroupBy.None); | ||
|
||
let albumToEdit: AlbumResponseDto | null = $state(null); | ||
let albumToShare: AlbumResponseDto | null = $state(null); | ||
let albumToDelete: AlbumResponseDto | null = null; | ||
|
||
|
@@ -257,8 +256,11 @@ | |
await deleteSelectedAlbum(); | ||
}; | ||
|
||
const handleEdit = (album: AlbumResponseDto) => { | ||
albumToEdit = album; | ||
const handleEdit = async (album: AlbumResponseDto) => { | ||
await modalManager.show(EditAlbumForm, { | ||
album, | ||
onEditSuccess: successEditAlbumInfo, | ||
}); | ||
closeAlbumContextMenu(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you want to close the context menu before the modal is opened? That's how it was before. (kind of, because before the operation before wasn't blocking) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah, tho I hadn't noticed that, because (for me) the context menu closes automatically when clicking one of the options. Even I completely comment out the close function here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can probably revisit this eventually. For now I don't want to risk running into some random edge cases on some browser due to an unrelated refactor :) |
||
}; | ||
|
||
|
@@ -305,8 +307,6 @@ | |
}; | ||
|
||
const successEditAlbumInfo = (album: AlbumResponseDto) => { | ||
albumToEdit = null; | ||
|
||
notificationController.show({ | ||
message: $t('album_info_updated'), | ||
type: NotificationType.Info, | ||
|
@@ -422,15 +422,3 @@ | |
<MenuOption icon={mdiDeleteOutline} text={$t('delete')} onClick={() => setAlbumToDelete()} /> | ||
{/if} | ||
</RightClickContextMenu> | ||
|
||
{#if allowEdit} | ||
<!-- Edit Modal --> | ||
{#if albumToEdit} | ||
<EditAlbumForm | ||
album={albumToEdit} | ||
onEditSuccess={successEditAlbumInfo} | ||
onCancel={() => (albumToEdit = null)} | ||
onClose={() => (albumToEdit = null)} | ||
/> | ||
{/if} | ||
{/if} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looked at this again and you should get rid of
onEditSuccess
. EditAlbumForm should have anonClose(album?: ...) => void
; if album is provided it was a success, otherwise it was cancelled. That's how we treat those generally now