Skip to content

Commit

Permalink
For chapters that have been flipped, show the correct orientation in …
Browse files Browse the repository at this point in the history
…the edit chapter form.
  • Loading branch information
johndoknjas committed Nov 8, 2024
1 parent 2df19a5 commit 7069222
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions ui/analyse/src/study/chapterEditForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ import { confirm, snabDialog } from 'common/dialog';
import { h, VNode } from 'snabbdom';
import { Redraw } from '../interfaces';
import { StudySocketSend } from '../socket';
import AnalyseCtrl from '../ctrl';

export class StudyChapterEditForm {
current = prop<ChapterPreview | StudyChapterConfig | null>(null);
redraw: Redraw;

constructor(
private readonly send: StudySocketSend,
private readonly chapterConfig: (id: string) => Promise<StudyChapterConfig>,
readonly isBroadcast: boolean,
readonly redraw: Redraw,
) {}
readonly root: AnalyseCtrl,
) {
this.redraw = root.redraw;
}

open = (data: ChapterPreview) => {
this.current(data);
Expand Down Expand Up @@ -116,7 +120,9 @@ function viewLoaded(ctrl: StudyChapterEditForm, data: StudyChapterConfig): VNode
h('label.form-label', { attrs: { for: 'chapter-orientation' } }, i18n.study.orientation),
h(
'select#chapter-orientation.form-control',
(['white', 'black'] as const).map(color => option(color, data.orientation, i18n.site[color])),
(['white', 'black'] as const).map(color =>
option(color, ctrl.root.bottomColor(), i18n.site[color]),
),
),
]),
h('div.form-group.form-half' + (ctrl.isBroadcast ? '.none' : ''), [
Expand Down
2 changes: 1 addition & 1 deletion ui/analyse/src/study/studyChapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class StudyChaptersCtrl {
this.list = new StudyChapters(this.store);
this.loadFromServer(initChapters);
this.newForm = new StudyChapterNewForm(send, this.list, isBroadcast, setTab, root);
this.editForm = new StudyChapterEditForm(send, chapterConfig, isBroadcast, root.redraw);
this.editForm = new StudyChapterEditForm(send, chapterConfig, isBroadcast, root);
}

sort = (ids: string[]) => this.send('sortChapters', ids);
Expand Down

0 comments on commit 7069222

Please sign in to comment.