From 8a7ffaf3c3b6a1968ded7ee4dd86f6c86fd8e003 Mon Sep 17 00:00:00 2001 From: Gordon Lin <75815453+gordlin@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:45:48 -0400 Subject: [PATCH] Add config option dropdown menu --- package-lock.json | 12 +- package.json | 2 +- src/components/editor.vue | 15 +- src/components/helpers/dropdown-menu.vue | 201 +++++++++++++++++++ src/components/helpers/toc-options.vue | 124 ++++++++++++ src/components/metadata-editor.vue | 35 ++-- src/components/preview.vue | 11 ++ src/components/slide-toc.vue | 239 ++++++++++------------- src/definitions.ts | 4 +- src/lang/lang.csv | 17 +- 10 files changed, 473 insertions(+), 187 deletions(-) create mode 100644 src/components/helpers/dropdown-menu.vue create mode 100644 src/components/helpers/toc-options.vue diff --git a/package-lock.json b/package-lock.json index 4389b719..586bf9e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "nouislider": "^15.5.0", "ramp-config-editor_editeur-config-pcar": "^3.6.0", "ramp-pcar": "^4.8.0", - "ramp-storylines_demo-scenarios-pcar": "^3.2.4", + "ramp-storylines_demo-scenarios-pcar": "^3.2.8", "throttle-debounce": "^5.0.0", "url": "^0.11.3", "uuid": "^9.0.0", @@ -8072,9 +8072,10 @@ } }, "node_modules/ramp-storylines_demo-scenarios-pcar": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/ramp-storylines_demo-scenarios-pcar/-/ramp-storylines_demo-scenarios-pcar-3.2.4.tgz", - "integrity": "sha512-lj8lJrPcoFTk7s5RXx++c7Jw12Kt220jj+OVUqnoNccT496JRua4PkG/24PBPNEPH/n9tBq38yTbCYhMBZGtSg==", + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/ramp-storylines_demo-scenarios-pcar/-/ramp-storylines_demo-scenarios-pcar-3.2.8.tgz", + "integrity": "sha512-GChEZiJQKWdzciSj0P5uSpzvayfiJ7AmClDF5y+gv/RcM9dBPFJkVPW0egSmFcf1pHbaR9Ln9sElkL/ab+Sg0A==", + "license": "MIT", "dependencies": { "@rollup/plugin-dsv": "^3.0.4", "@tailwindcss/typography": "^0.4.0", @@ -8540,7 +8541,8 @@ "node_modules/scrollama": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/scrollama/-/scrollama-3.2.0.tgz", - "integrity": "sha512-PIPwB1kYBnbw/ezvPBJa5dCN5qEwokfpAkI3BmpZWAwcVID4nDf1qH6WV16A2fQaJmsKx0un5S/zhxN+PQeKDQ==" + "integrity": "sha512-PIPwB1kYBnbw/ezvPBJa5dCN5qEwokfpAkI3BmpZWAwcVID4nDf1qH6WV16A2fQaJmsKx0un5S/zhxN+PQeKDQ==", + "license": "MIT" }, "node_modules/section-matter": { "version": "1.0.0", diff --git a/package.json b/package.json index 4642315d..c16e8598 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "nouislider": "^15.5.0", "ramp-config-editor_editeur-config-pcar": "^3.6.0", "ramp-pcar": "^4.8.0", - "ramp-storylines_demo-scenarios-pcar": "^3.2.4", + "ramp-storylines_demo-scenarios-pcar": "^3.2.8", "throttle-debounce": "^5.0.0", "url": "^0.11.3", "uuid": "^9.0.0", diff --git a/src/components/editor.vue b/src/components/editor.vue index ae5b5e29..1c14dadd 100644 --- a/src/components/editor.vue +++ b/src/components/editor.vue @@ -336,7 +336,7 @@ import { HelpSection, MetadataContent, Slide, - SlideForBothLanguages, + MultiLanguageSlide, SourceCounts, StoryRampConfig, TextPanel @@ -371,7 +371,7 @@ export default class EditorV extends Vue { @Prop() sourceCounts!: SourceCounts; @Prop() metadata!: MetadataContent; - @Prop() slides!: SlideForBothLanguages[]; + @Prop() slides!: MultiLanguageSlide[]; @Prop() configLang!: string; @Prop() saving!: boolean; @Prop() unsavedChanges!: boolean; @@ -379,7 +379,7 @@ export default class EditorV extends Vue { // Form properties. uuid = ''; logoImage: undefined | File = undefined; - loadSlides: undefined | SlideForBothLanguages[] = undefined; + loadSlides: undefined | MultiLanguageSlide[] = undefined; currentSlide: Slide | string = ''; slideIndex = -1; helpSections: HelpSection[] = []; @@ -471,8 +471,7 @@ export default class EditorV extends Vue { if (index === -1 || !this.loadSlides) { this.currentSlide = ''; } else { - const selectedLang = - (lang as keyof SlideForBothLanguages) ?? (this.configLang as keyof SlideForBothLanguages); + const selectedLang = (lang ?? this.configLang) as keyof MultiLanguageSlide; const selectedSlide = this.loadSlides[index][selectedLang]; this.currentSlide = selectedSlide ?? ''; } @@ -489,9 +488,7 @@ export default class EditorV extends Vue { */ updateCustomSlide(slideConfig: Slide, save?: boolean, lang?: string): void { this.currentSlide = slideConfig; - this.slides[this.slideIndex][ - (lang as keyof SlideForBothLanguages) ?? (this.configLang as keyof SlideForBothLanguages) - ] = slideConfig; + this.slides[this.slideIndex][(lang ?? this.configLang) as keyof MultiLanguageSlide] = slideConfig; // save changes emitted from advanced editor if (save) { this.$emit('save-changes'); @@ -501,7 +498,7 @@ export default class EditorV extends Vue { /** * Updates slides after adding, removing, or reordering. */ - updateSlides(slides: SlideForBothLanguages[]): void { + updateSlides(slides: MultiLanguageSlide[]): void { this.loadSlides = slides; this.slideIndex = this.loadSlides.findIndex( (bothSlides) => diff --git a/src/components/helpers/dropdown-menu.vue b/src/components/helpers/dropdown-menu.vue new file mode 100644 index 00000000..b41e1dc2 --- /dev/null +++ b/src/components/helpers/dropdown-menu.vue @@ -0,0 +1,201 @@ + + + + + diff --git a/src/components/helpers/toc-options.vue b/src/components/helpers/toc-options.vue new file mode 100644 index 00000000..f8edc398 --- /dev/null +++ b/src/components/helpers/toc-options.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/src/components/metadata-editor.vue b/src/components/metadata-editor.vue index 6fff70bd..e7f0fb9b 100644 --- a/src/components/metadata-editor.vue +++ b/src/components/metadata-editor.vue @@ -283,13 +283,6 @@ - -