add comments in show

This commit is contained in:
2025-01-03 15:59:00 +01:00
parent 802c309679
commit 898c6c4d7e
8 changed files with 42 additions and 43 deletions

View File

@@ -35,6 +35,7 @@
[header]="song.title"
[index]="index??0"
[showSwitch]="false"
[showComments]="false"
[text]="song.text"
chordMode="hide"
></app-song-text>

View File

@@ -8,9 +8,7 @@ import {CardModule} from '../../widget-modules/components/card/card.module';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatSelectModule} from '@angular/material/select';
import {ShowTypeTranslaterModule} from '../../widget-modules/pipes/show-type-translater/show-type-translater.module';
import {
SectionTypeTranslatorModule,
} from '../../widget-modules/pipes/section-type-translator/section-type-translator.module';
import {SectionTypeTranslatorModule} from '../../widget-modules/pipes/section-type-translator/section-type-translator.module';
import {SongTextModule} from '../../widget-modules/components/song-text/song-text.module';
import {LegalComponent} from './monitor/legal/legal.component';
import {MatButtonModule} from '@angular/material/button';
@@ -45,5 +43,4 @@ import {UserNameModule} from '../../services/user/user-name/user-name.module';
UserNameModule,
],
})
export class PresentationModule {
}
export class PresentationModule {}

View File

@@ -12,6 +12,7 @@ import {fade} from '../../../animations';
import {TextRenderingService} from '../../songs/services/text-rendering.service';
import {Section} from '../../songs/services/section';
import {GlobalSettings} from '../../../services/global-settings';
import {LineType} from '../../songs/services/line-type';
export interface PresentationSong {
id: string;
@@ -44,13 +45,12 @@ export class RemoteComponent {
private showSongService: ShowSongService,
private songService: SongService,
private textRenderingService: TextRenderingService,
private globalSettingsService: GlobalSettingsService,
globalSettingsService: GlobalSettingsService,
private cRef: ChangeDetectorRef,
) {
globalSettingsService.get$
.pipe(
filter(_ => !!_),
map(_ => _ as GlobalSettings),
map(_ => _.currentShow),
)
.subscribe(_ => {
@@ -75,7 +75,7 @@ export class RemoteComponent {
const presentationSongs = list.map(song => ({
id: song.id,
title: song.title,
sections: this.textRenderingService.parse(song.text, null),
sections: this.textRenderingService.parse(song.text, null, false),
}));
this.presentationSongs = show?.order.map(_ => presentationSongs.filter(f => f.id === _)[0]) ?? [];
this.cRef.markForCheck();
@@ -83,7 +83,7 @@ export class RemoteComponent {
}
public getFirstLine(section: Section): string {
return section.lines.filter(_ => _.type === 1)[0].text;
return section.lines.filter(_ => _.type === LineType.text)[0].text;
}
public async onSectionClick(id: string, index: number, showId: string): Promise<void> {

View File

@@ -30,12 +30,10 @@ export class DocxService {
public constructor(
private showService: ShowService,
private showSongService: ShowSongService,
private songService: SongService,
private textRenderingService: TextRenderingService,
private userService: UserService,
private configService: ConfigService,
) {
}
) {}
public async create(showId: string, options: DownloadOptions = {}): Promise<void> {
const data = await this.prepareData(showId);
@@ -95,10 +93,14 @@ export class DocxService {
});
}
private renderSongs(songs: {
showSong: ShowSong;
sections: Section[]
}[], options: DownloadOptions, config: Config): Paragraph[] {
private renderSongs(
songs: {
showSong: ShowSong;
sections: Section[];
}[],
options: DownloadOptions,
config: Config
): Paragraph[] {
return songs.reduce((p: Paragraph[], song) => [...p, ...this.renderSong(song.showSong, song.showSong, song.sections, options, config)], []);
}
@@ -203,10 +205,15 @@ export class DocxService {
sections,
};
});
const songsLoaded = (await Promise.all(songsAsync)).filter(_ => !!_).map(_ => _ as {
showSong: ShowSong;
sections: Section[]
});
const songsLoaded = (await Promise.all(songsAsync))
.filter(_ => !!_)
.map(
_ =>
_ as {
showSong: ShowSong;
sections: Section[];
}
);
const songs = show.order.map(_ => songsLoaded.filter(f => f.showSong.id === _)[0]);
return {songs, show, user, config};
}

View File

@@ -10,6 +10,7 @@ import {ShowSongService} from '../services/show-song.service';
import {ShowSong} from '../services/show-song';
import {DocxService} from '../services/docx.service';
import {
faArrowUpRightFromSquare,
faBox,
faBoxOpen,
faExternalLinkAlt,
@@ -19,8 +20,7 @@ import {
faLock,
faMagnifyingGlassMinus,
faMagnifyingGlassPlus,
faShare,
faSliders,
faSliders, faUnlock,
faUser,
faUsers,
} from '@fortawesome/free-solid-svg-icons';
@@ -48,9 +48,9 @@ export class ShowComponent implements OnInit, OnDestroy {
public faBox = faBox;
public faBoxOpen = faBoxOpen;
public faPublish = faExternalLinkAlt;
public faPublish = faUnlock;
public faUnpublish = faLock;
public faShare = faShare;
public faShare = faArrowUpRightFromSquare;
public faDownload = faFileDownload;
public faSliders = faSliders;
public faUser = faUser;

View File

@@ -2,4 +2,5 @@ export enum SectionType {
Verse,
Chorus,
Bridge,
Comment,
}

View File

@@ -13,14 +13,13 @@ import {Line} from './line';
export class TextRenderingService {
private regexSection = /(Strophe|Refrain|Bridge)/;
public constructor(private transposeService: TransposeService) {
}
public constructor(private transposeService: TransposeService) {}
public parse(text: string, transpose: TransposeMode | null): Section[] {
public parse(text: string, transpose: TransposeMode | null, withComments = true): Section[] {
if (!text) {
return [];
}
const arrayOfLines = text.split(/\r?\n/).filter(_ => _);
const arrayOfLines = text.split(/\r?\n/).filter(_ => _ && (!_.startsWith('#') || withComments));
const indices = {
[SectionType.Bridge]: 0,
[SectionType.Chorus]: 0,