feat(episode): add ability to override episode title - #1467
Conversation
harshithmohan
left a comment
There was a problem hiding this comment.
The modal and mutation follow the existing series-title-override pattern nicely, and the endpoint contract checks out. A few changes requested below.
|
|
||
| useToggleModalKeybinds(show, 'modal'); | ||
| useToggleModalKeybinds(!show, 'primary'); | ||
| useHotkeys('escape', onRequestClose, { scopes: 'modal' }); |
There was a problem hiding this comment.
Escape closes the modal while the save is pending
The Escape hotkey is bound unconditionally, so it defeats the intent of onRequestClose={isPending ? undefined : onRequestClose} (which only guards the backdrop click). During an in-flight save, Esc still closes the modal:
useHotkeys('escape', () => !isPending && onRequestClose(), { scopes: 'modal' });| useToggleModalKeybinds(show, 'modal'); | ||
| useToggleModalKeybinds(!show, 'primary'); | ||
| useHotkeys('escape', onRequestClose, { scopes: 'modal' }); | ||
| useHotkeys('enter', handleSave, { scopes: 'modal' }); |
There was a problem hiding this comment.
Enter-to-save doesn't fire while the input is focused
react-hotkeys-hook ignores key events whose target is a form tag (input/textarea/select) unless enableOnFormTags is set. Since the title <Input autoFocus> is focused as soon as the modal opens — the normal case — this hotkey never runs, so the Enter shortcut is effectively dead. Either add enableOnFormTags: true or drop the Enter binding:
useHotkeys('enter', handleSave, { scopes: 'modal', enableOnFormTags: true });Adds an edit button next to the episode title that opens a modal for
setting a custom title or picking from AniDB alternate titles, backed
by the existing Episode/{id}/OverrideTitle endpoint.
Guard the Escape hotkey against an in-flight save, enable the Enter hotkey on form tags so it fires while the title input is focused, and add success/error toasts around the save and reset mutations.
Guard escape hotkeys against in-flight mutations and enable Enter on form tags when a modal has a focused text input, per feedback on the episode title override modal.
6b9c07f to
2c1c852
Compare
Summary
Adds a UI for manually overriding an episode's title, closing #922. A pencil icon next to the episode title opens a modal where you can type a custom title or pick from AniDB's alternate titles, with a reset option to clear the override. This is backed by the existing
Episode/{id}/OverrideTitleserver endpoint, mirroring the series title-override pattern already in the app.