Skip to content

Commit

Permalink
feat: show a warning if songs are listed more than once in the media …
Browse files Browse the repository at this point in the history
…list for week-end meetings
  • Loading branch information
sircharlo committed Jan 15, 2025
1 parent 141405b commit 9715f7d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/helpers/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export function updateLookupPeriod(reset = false) {
? 'mw'
: isWeMeetingDay(dayDate)
? 'we'
: false,
: (false as 'mw' | 'we' | boolean),
today: datesAreSame(dayDate, new Date()),
};
},
Expand Down
1 change: 1 addition & 0 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@
"some-media-items-are-hidden": "Some media items have been hidden.",
"some-media-items-are-missing": "Some media files are missing",
"some-media-items-are-missing-explain": "The JWPUB file was imported successfully. However, some media is not included in the file and could not be downloaded automatically. You can add this media manually if needed by using the 'Add media' menu or by dragging it into the media list from your computer.",
"some-songs-are-duplicated": "Some songs appear more than once in the media list. Please check if this is intentional.",
"song": "Song",
"songbook-video-caching": "Songbook video caching",
"stage": "Stage",
Expand Down
29 changes: 29 additions & 0 deletions src/pages/MediaCalendarPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@
</template>
</q-banner>
</div>
<div v-if="duplicateSongsForWeMeeting" class="row">
<q-banner
class="bg-warning text-white full-width"
inline-actions
rounded
>
{{ t('some-songs-are-duplicated') }}
<template #avatar>
<q-avatar class="bg-white text-warning" size="lg">
<q-icon name="mmm-music-note" size="sm" />
</q-avatar>
</template>
</q-banner>
</div>
<div
v-if="
(currentSettings?.disableMediaFetching &&
Expand Down Expand Up @@ -1405,6 +1419,21 @@ const handleMediaSort = (
}
}
};
const duplicateSongsForWeMeeting = computed(() => {
if (!(selectedDateObject.value?.meeting === 'we')) return false;
const songNumbers: (number | string)[] =
selectedDateObject.value?.dynamicMedia
?.filter((m) => !m.hidden && m.tag?.type === 'song' && m.tag?.value)
.map((m) => m.tag?.value)
.filter(
(value): value is number | string =>
typeof value === 'string' || typeof value === 'number',
) || [];
if (songNumbers.length < 2) return false;
const songSet = new Set(songNumbers);
return songSet.size !== songNumbers.length;
});
</script>
<style scoped lang="scss">
.add-media-shortcut {
Expand Down
2 changes: 1 addition & 1 deletion src/types/dates.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export interface DateInfo {
date: Date;
dynamicMedia: DynamicMediaObject[];
error: boolean;
meeting: boolean | string;
meeting: 'mw' | 'we' | boolean;
today: boolean;
}

0 comments on commit 9715f7d

Please sign in to comment.