Skip to content

Commit

Permalink
hide study chapter settings in broadcast context - for #16269
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Nov 6, 2024
1 parent 1c72a34 commit 8475f24
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions ui/analyse/src/study/chapterEditForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class StudyChapterEditForm {
constructor(
private readonly send: StudySocketSend,
private readonly chapterConfig: (id: string) => Promise<StudyChapterConfig>,
readonly isBroadcast: boolean,
readonly redraw: Redraw,
) {}

Expand Down Expand Up @@ -118,15 +119,15 @@ function viewLoaded(ctrl: StudyChapterEditForm, data: StudyChapterConfig): VNode
(['white', 'black'] as const).map(color => option(color, data.orientation, i18n.site[color])),
),
]),
h('div.form-group.form-half', [
h('div.form-group.form-half' + (ctrl.isBroadcast ? '.none' : ''), [
h('label.form-label', { attrs: { for: 'chapter-mode' } }, i18n.study.analysisMode),
h(
'select#chapter-mode.form-control',
chapterForm.modeChoices.map(c => option(c[0], mode, c[1])),
),
]),
]),
h('div.form-group', [
h('div.form-group' + (ctrl.isBroadcast ? '.none' : ''), [
h('label.form-label', { attrs: { for: 'chapter-description' } }, i18n.study.pinnedChapterComment),
h(
'select#chapter-description.form-control',
Expand Down
3 changes: 2 additions & 1 deletion ui/analyse/src/study/chapterNewForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class StudyChapterNewForm {
constructor(
private readonly send: StudySocketSend,
readonly chapters: StudyChapters,
readonly isBroadcast: boolean,
readonly setTab: () => void,
readonly root: AnalyseCtrl,
) {
Expand Down Expand Up @@ -331,7 +332,7 @@ export function view(ctrl: StudyChapterNewForm): VNode {
),
]),
]),
h('div.form-group', [
h('div.form-group' + (ctrl.isBroadcast ? '.none' : ''), [
h('label.form-label', { attrs: { for: 'chapter-mode' } }, i18n.study.analysisMode),
h(
'select#chapter-mode.form-control',
Expand Down
5 changes: 3 additions & 2 deletions ui/analyse/src/study/studyChapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ export default class StudyChaptersCtrl {
constructor(
initChapters: ChapterPreviewFromServer[],
readonly send: StudySocketSend,
readonly isBroadcast: boolean,
setTab: () => void,
chapterConfig: (id: string) => Promise<StudyChapterConfig>,
private readonly federations: () => Federations | undefined,
root: AnalyseCtrl,
) {
this.list = new StudyChapters(this.store);
this.loadFromServer(initChapters);
this.newForm = new StudyChapterNewForm(send, this.list, setTab, root);
this.editForm = new StudyChapterEditForm(send, chapterConfig, root.redraw);
this.newForm = new StudyChapterNewForm(send, this.list, isBroadcast, setTab, root);
this.editForm = new StudyChapterEditForm(send, chapterConfig, isBroadcast, root.redraw);
}

sort = (ids: string[]) => this.send('sortChapters', ids);
Expand Down
1 change: 1 addition & 0 deletions ui/analyse/src/study/studyCtrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export default class StudyCtrl {
this.chapters = new StudyChaptersCtrl(
data.chapters!,
this.send,
defined(relayData),
() => this.setTab('chapters'),
chapterId => xhr.chapterConfig(data.id, chapterId),
() => this.data.federations,
Expand Down

0 comments on commit 8475f24

Please sign in to comment.