-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ToC redesign/refactor, both-language previews #409
Conversation
Your demo site is ready! 🚀 Visit it here: https://ramp4-pcar4.github.io/storylines-editor/redesign-toc |
31fe5df
to
6e0c057
Compare
986809d
to
a7c1458
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 8 files reviewed, 1 unresolved discussion
a discussion (no related file):
Added a mobile version of the ToC.
Now, the ToC will be auto-hidden on mobile. Clicking the new hamburger menu up top will open a new mobile ToC drawer, featuring larger buttons and more visual dividers to make it better for touch devices. To access an item's tooltips, you simply long-press it to simulate a hover. Dragging slides to reorder is disabled so users can scroll properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 8 files reviewed, 2 unresolved discussions
a discussion (no related file):
Added reasonably comprehensive comments to editor.vue
and slide-toc.vue
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 8 files reviewed, 3 unresolved discussions
a discussion (no related file):
Ready for review!
b7086e5
to
4079664
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall huge enhancements with the new UI, also great work to get it presentable on mobile as well which was not a priority previously 👍
A few bugs I found:
- selecting the advanced editor on a FR slide and then navigating back to any panel will turn the corresponding English slide into FR:
- I believe tooltips for the panel titles in ToC should only be visible for truncated text
- what is the use case of the delete last config for each lang? May be confusing to users for only one slide to have this option whereas other slides do not
- related to above, need a confirmation before deleting a panel
Additional suggestion - perhaps it would be beneficial to move the template code for mobile ToC to its own Vue component if it is feasible to avoid over cluttering one component, will leave that up to you
Reviewed 2 of 8 files at r1.
Reviewable status: 2 of 8 files reviewed, 14 unresolved discussions (waiting on @gordlin)
src/components/editor.vue
line 373 at r3 (raw file):
@Prop() metadata!: MetadataContent; @Prop() bothLanguageSlides!: SlideForBothLanguages[];
Would suggest just to keep the naming of this to be slides
for clarity
src/components/editor.vue
line 374 at r3 (raw file):
@Prop() bothLanguageSlides!: SlideForBothLanguages[]; @Prop() slides!: Slide[];
This does not look like it is used anymore
src/components/editor.vue
line 455 at r3 (raw file):
setTimeout(() => { if (
To clean up this code a bit for readability, some suggestions:
- first check
if (index == -1 || !this.loadSlides)
->this.currentSlide = ''
- use some helper function or declare:
const selectedLang = lang ?? (this.configLang as keyof SlideForBothLanguages)
followed byconst selectedSlide = this.loadSlides[index][selectedLang]
- then we can just set in the else block:
this.currentSlide = selectedSlide ?? '';
Might need small modifications but this seems like it should work to me
src/components/metadata-editor.vue
line 251 at r3 (raw file):
:sourceCounts="sourceCounts" :metadata="metadata" :bothLanguageSlides="bothLanguageSlides"
same as above, recommend change to slides
src/components/metadata-editor.vue
line 459 at r3 (raw file):
const logoSrc = `assets/${this.configLang}/${this.metadata.logoName}`; const frSlides = props.configs.en?.slides.map((engSlide) => {
How come frSlides
are being assigned English slides here and vice versa?
src/components/metadata-editor.vue
line 470 at r3 (raw file):
}); const maxLength = Math.max(frSlides!.length ?? 0, engSlides!.length ?? 0);
Change to const maxLength = frSlides.length > enSlides.length ? frSlides.length : enSlides.length
. If there are TS complaints, can default the eng and fr slides to [].
src/components/metadata-editor.vue
line 937 at r3 (raw file):
}); const maxLength = Math.max(frSlides!.length ?? 0, engSlides!.length ?? 0);
Same comment as above, but since this is the same block of logic just throw this in a function to avoid duplicate code
src/components/slide-toc.vue
line 271 at r3 (raw file):
<button class="slide-toc-button" v-if="!bothLanguageSlides.slice(index + 1).some((slide) => slide.en)"
change to bothLanguageSlides.slice(index + 1).every((slide) => slide.fr)
src/components/slide-toc.vue
line 462 at r3 (raw file):
<button class="slide-toc-button" v-if="!bothLanguageSlides.slice(index + 1).some((slide) => slide.fr)"
change to bothLanguageSlides.slice(index + 1).every((slide) => slide.en)
src/components/slide-toc.vue
line 617 at r3 (raw file):
}) export default class SlideTocV extends Vue { @Prop() bothLanguageSlides!: SlideForBothLanguages[];
same suggestion change back to slides
src/components/slide-toc.vue
line 648 at r3 (raw file):
: { title: '', panel: [
Set this default slide as a local variable to avoid repeating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selecting the advanced editor on a FR slide and then navigating back to any panel will turn the corresponding English slide into FR
Donethanks!
I believe tooltips for the panel titles in ToC should only be visible for truncated text
Tooltips appearing for all panel titles was the default behaviour before too (notice the v-truncate directive from RAMP isn't in this repo). I can implement this if you think it's worthwhile.
what is the use case of the delete last config for each lang? May be confusing to users for only one slide to have this option whereas other slides do not
There are a few issues that pop up now that we're always showing both configs. Because they're saved independently (as they probably should), the ENG/FR config objects are each meant to be a continuous list of existing slides, without random holes. This means there can't really be "isolated" configs. For example: if Slide 12's French config doesn't exist, but Slide 14 has a French config, then upon save Slide 14's French slide is automatically "slid up" to slide 12 and any holes will be deleted, which could be really confusing if the user expects their slot with no config to stay there. As such, only the final config for each language can be safely deleted without weird behaviour like this occurring.
related to above, need a confirmation before deleting a panel
Donethanks!
Dismissed @yileifeng from 2 discussions.
Reviewable status: 2 of 8 files reviewed, 12 unresolved discussions (waiting on @yileifeng)
src/components/editor.vue
line 373 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
Would suggest just to keep the naming of this to be
slides
for clarity
Donethanks!
src/components/editor.vue
line 374 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
This does not look like it is used anymore
Deleted, donethanks!
src/components/editor.vue
line 455 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
To clean up this code a bit for readability, some suggestions:
- first check
if (index == -1 || !this.loadSlides)
->this.currentSlide = ''
- use some helper function or declare:
const selectedLang = lang ?? (this.configLang as keyof SlideForBothLanguages)
followed byconst selectedSlide = this.loadSlides[index][selectedLang]
- then we can just set in the else block:
this.currentSlide = selectedSlide ?? '';
Might need small modifications but this seems like it should work to me
Donethanks!
src/components/metadata-editor.vue
line 251 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
same as above, recommend change to
slides
Donethanks!
src/components/metadata-editor.vue
line 459 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
How come
frSlides
are being assigned English slides here and vice versa?
Whoops. Donethanks!
src/components/metadata-editor.vue
line 470 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
Change to
const maxLength = frSlides.length > enSlides.length ? frSlides.length : enSlides.length
. If there are TS complaints, can default the eng and fr slides to [].
Donethanks!
src/components/metadata-editor.vue
line 937 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
Same comment as above, but since this is the same block of logic just throw this in a function to avoid duplicate code
Donethanks!
src/components/slide-toc.vue
line 271 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
change to
bothLanguageSlides.slice(index + 1).every((slide) => slide.fr)
As discussed, probably not necessary here.
src/components/slide-toc.vue
line 462 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
change to
bothLanguageSlides.slice(index + 1).every((slide) => slide.en)
As discussed, probably not necessary here.
src/components/slide-toc.vue
line 617 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
same suggestion change back to
slides
Donethanks!
src/components/slide-toc.vue
line 648 at r3 (raw file):
Previously, yileifeng (Yi Lei Feng) wrote…
Set this default slide as a local variable to avoid repeating
Donethanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional suggestion - perhaps it would be beneficial to move the template code for mobile ToC to its own Vue component if it is feasible to avoid over cluttering one component, will leave that up to you
It's not a lot of additional code, just a few additional styles and lines and whatnot. I think it's fine to leave it.
Reviewable status: 2 of 8 files reviewed, 12 unresolved discussions (waiting on @yileifeng)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tooltips appearing for all panel titles was the default behaviour before too (notice the v-truncate directive from RAMP isn't in this repo). I can implement this if you think it's worthwhile.
Would be good to turn this into a new issue 👍
There are a few issues that pop up now that we're always showing both configs. Because they're saved independently (as they probably should), the ENG/FR config objects are each meant to be a continuous list of existing slides, without random holes. This means there can't really be "isolated" configs.
I see, I think this is something that will come up again for sure since it can look confusing from a user perspective for instance to have the option to delete the last ENG config on slide 12 and the last FR config on slide 14. Intuitively, I think we would want a unified lang slide deletion logic, either having the option to delete any EN/FR slide config individually or not having the option to delete any EN/FR slide config individually at all.
Side note: the warning that pops up for isolated undefined config is very helpful and I did not notice this before 👍
A few basic ideas:
- Remove the delete last lang config logic, unless there is a specific reason we need this that I missed? Would be the easiest solution and least amount of work overall.
- Create a placeholder slide in the config if lang is undefined for a slide, then in Storylines code we can have logic to skip past these placeholders but there would no longer be holes when saving. Would need some testing, but initial thought is having an empty
{}
block would suffice - Another low effort option is to default the corresponding lang slide to an empty slide containing the same panel structure as the non-empty lang slide. Probably do not want to go down this route as having an empty/placeholder EN/FR slide is valid.
Would be nice to get some other perspectives from the team on this as well.
Reviewed 1 of 8 files at r1, 5 of 5 files at r4, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions
src/components/slide-toc.vue
line 271 at r3 (raw file):
Previously, gordlin (Gordon Lin) wrote…
As discussed, probably not necessary here.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a placeholder slide in the config if lang is undefined for a slide, then in Storylines code we can have logic to skip past these placeholders but there would no longer be holes when saving.
This feels like the best way to solve the continuity problem. I can see a lot of future headaches popping up if we try to support a different slide length for each language. Considering the new structure of the table of contents, it makes sense to me that we should have some sort of correlation between the configs, even if it's just setting the config for the missing slide to {}
as Yi Lei mentioned.
Reviewed 2 of 8 files at r1, 5 of 5 files at r4.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @gordlin and @yileifeng)
src/definitions.ts
line 146 at r4 (raw file):
} export interface SlideForBothLanguages {
Renaming this to Slides
for more consistency probably makes sense here.
src/components/editor.vue
line 458 at r4 (raw file):
} else { const selectedLang = (lang as keyof SlideForBothLanguages) ?? (this.configLang as keyof SlideForBothLanguages);
Correct me if I'm wrong, but I think this can be replaced with the following for one last cleanup step:
const selectedLang = (lang ?? this.configLang) as keyof SlideForBothLanguages
src/components/editor.vue
line 476 at r4 (raw file):
this.currentSlide = slideConfig; this.slides[this.slideIndex][ (lang as keyof SlideForBothLanguages) ?? (this.configLang as keyof SlideForBothLanguages)
Same as above, I think this can be replaced with
this.slides[this.slideIndex][(lang ?? this.configLang) as keyof SlideForBothLanguages]
21e8a96
to
fc984d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to turn this into a new issue 👍
Donethanks!
I see, I think this is something that will come up again for sure since it can look confusing from a user perspective for instance to have the option to delete the last ENG config on slide 12 and the last FR config on slide 14. Intuitively, I think we would want a unified lang slide deletion logic, either having the option to delete any EN/FR slide config individually or not having the option to delete any EN/FR slide config individually at all...
This feels like the best way to solve the continuity problem. I can see a lot of future headaches popping up if we try to support a different slide length for each language. Considering the new structure of the table of contents, it makes sense to me that we should have some sort of 1-to-1 correlation between the configs, even if it's just setting the config for the missing slide to
{}
as Yi Lei mentioned.
I tried my best to implement empty slides for saving, but it caused a LOT of problems and new bugs. Instead, I've implemented a slightly different but hopefully still acceptable solution:
The app will accept undefined slides on load, and the user can modify them, replace them with content, etc. However, on save, all undefined slides will be replaced with empty slides (not {}, but a simple blank slide with two empty text panels). The user will be warned if any slides will have to be overwritten like this:
Reviewable status: 4 of 11 files reviewed, 7 unresolved discussions (waiting on @RyanCoulsonCA and @yileifeng)
a discussion (no related file):
Newest changes implement a dropdown options menu for each config, where you can modify them individually: copy the contents of the adjoining-language config (e.g. from "EN" to "FR" of slide 12).
Also redesigned many of the warning modals, as displayed below.
Copy other config to current config (shown in mobile viewport):
Clear config (replace with blank config):
src/definitions.ts
line 146 at r4 (raw file):
Previously, RyanCoulsonCA (Ryan Coulson) wrote…
Renaming this to
Slides
for more consistency probably makes sense here.
Donethanks!
src/components/editor.vue
line 458 at r4 (raw file):
Previously, RyanCoulsonCA (Ryan Coulson) wrote…
Correct me if I'm wrong, but I think this can be replaced with the following for one last cleanup step:
const selectedLang = (lang ?? this.configLang) as keyof SlideForBothLanguages
Donethanks!
src/components/editor.vue
line 476 at r4 (raw file):
Previously, RyanCoulsonCA (Ryan Coulson) wrote…
Same as above, I think this can be replaced with
this.slides[this.slideIndex][(lang ?? this.configLang) as keyof SlideForBothLanguages]
Donethanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 of 11 files reviewed, 7 unresolved discussions (waiting on @RyanCoulsonCA and @yileifeng)
a discussion (no related file):
Previously, gordlin (Gordon Lin) wrote…
Newest changes implement a dropdown options menu for each config, where you can modify them individually: copy the contents of the adjoining-language config (e.g. from "EN" to "FR" of slide 12).
Also redesigned many of the warning modals, as displayed below.
Copy other config to current config (shown in mobile viewport):
Updated Copy other config to current config popup:
src/definitions.ts
line 146 at r4 (raw file):
Previously, gordlin (Gordon Lin) wrote…
Donethanks!
Whoops, this isn't exactly correct. My bad.
I decided not to change the name to Slides
because it isn't exactly correct; each SlideForBothLanguages
is still one slide, just with multiple configs. Instead I changed it to MultiLanguageSlide
, which I think is a decent and descriptive name for what the object represents.
Let me know if there's a better name you'd prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 of 11 files reviewed, 8 unresolved discussions (waiting on @gordlin, @RyanCoulsonCA, and @yileifeng)
a discussion (no related file):
Great work!
I noticed that when clearing the contents of a slide, the contents are still visible within the slide editor and the advanced editor. Only upon switching to a different slide and then switching back does the content get cleared. It would be nice for this slide content to be removed right away. If this isn't a simple fix then we can probably just create a new issue for it once this PR is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 12 files reviewed, 9 unresolved discussions (waiting on @RyanCoulsonCA and @yileifeng)
a discussion (no related file):
Newest changes modify undefined slide saving behaviour:
- On save, undefined slides will now be converted to empty objects.
- On initial load, empty objects will be converted to undefined slides (for easy handling while within the editor).
A related StoryRAMP PR (ramp4-pcar4/story-ramp#500) prevents crashes related to these empty object slides. For StoryRAMP and editor preview, undefined/empty objects will be ignored.
206f824
to
8fe77f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 12 files reviewed, 9 unresolved discussions (waiting on @IshavSohal, @RyanCoulsonCA, and @yileifeng)
a discussion (no related file):
Previously, IshavSohal (Ishav Sohal) wrote…
Great work!
I noticed that when clearing the contents of a slide, the contents are still visible within the slide editor and the advanced editor. Only upon switching to a different slide and then switching back does the content get cleared. It would be nice for this slide content to be removed right away. If this isn't a simple fix then we can probably just create a new issue for it once this PR is merged.
Nice catch. I've fixed this for both copy slide from other lang
and clear slide contents
. Let me know if I missed anything.
Donethanks!
8fe77f4
to
8a7ffaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 13 files reviewed, 9 unresolved discussions (waiting on @gordlin, @IshavSohal, and @RyanCoulsonCA)
a discussion (no related file):
Previously, gordlin (Gordon Lin) wrote…
Newest changes modify undefined slide saving behaviour:
- On save, undefined slides will now be converted to empty objects.
- On initial load, empty objects will be converted to undefined slides (for easy handling while within the editor).
A related StoryRAMP PR (ramp4-pcar4/story-ramp#500) prevents crashes related to these empty object slides. For StoryRAMP and editor preview, undefined/empty objects will be ignored.
A bug with the advanced editor, to reproduce:
- Make a change (e.g. slide text change)
- Navigate to a different slide (alternatively, go to preview and notice change is not there)
- Go back to the original slide and the advanced editor, change is reverted
On the current main build, this is not an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 13 files reviewed, 9 unresolved discussions (waiting on @gordlin, @IshavSohal, and @RyanCoulsonCA)
a discussion (no related file):
Previously, yileifeng (Yi Lei Feng) wrote…
A bug with the advanced editor, to reproduce:
- Make a change (e.g. slide text change)
- Navigate to a different slide (alternatively, go to preview and notice change is not there)
- Go back to the original slide and the advanced editor, change is reverted
On the current main build, this is not an issue.
One additional case: If the last slide in the product contains an empty placeholder config for one of the languages, creating a new slide will initialize with a placeholder for that language's config. Is this intentional?
If the slides with placeholders are not the last slide, creating a new slide will just initialize with default configurations for both languages.
8a7ffaf
to
ac8ce1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 13 files reviewed, 9 unresolved discussions (waiting on @IshavSohal, @RyanCoulsonCA, and @yileifeng)
a discussion (no related file):
A bug with the advanced editor, to reproduce:
- Make a change (e.g. slide text change)
- Navigate to a different slide (alternatively, go to preview and notice change is not there)
- Go back to the original slide and the advanced editor, change is reverted
On the current main build, this is not an issue.
Donethanks!
One additional case: If the last slide in the product contains an empty placeholder config for one of the languages, creating a new slide will initialize with a placeholder for that language's config. Is this intentional?
That was intentional before, but with the new changes in handling undefined configs it's no longer necessary. I've refactored the code so that new slides always include two blank (defined) configs. In addition, I've changed undefined slides so the new blank slide
/copy from other config
buttons are always visible even if it's not the first undefined slide (e.g. slide 20 FR in your image above would not have its buttons grayed out).
Donethanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 8 files at r1, 1 of 5 files at r4, 2 of 7 files at r5, 1 of 6 files at r6, 2 of 6 files at r7, 4 of 5 files at r8, 2 of 2 files at r9, all commit messages.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @RyanCoulsonCA and @yileifeng)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 7 files at r5, 1 of 6 files at r6, 2 of 6 files at r7, 4 of 5 files at r8, 2 of 2 files at r9, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @IshavSohal and @yileifeng)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 8 files at r1, 1 of 5 files at r4, 2 of 7 files at r5, 1 of 6 files at r6, 2 of 6 files at r7, 4 of 5 files at r8, 2 of 2 files at r9, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @IshavSohal and @yileifeng)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 7 files at r5, 1 of 6 files at r6, 2 of 6 files at r7, 4 of 5 files at r8, 2 of 2 files at r9, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @IshavSohal, @RyanCoulsonCA, and @szczz)
ac8ce1f
to
6b809c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r10, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @IshavSohal, @RyanCoulsonCA, and @szczz)
Related Item(s)
Issues:
#401
#402
Changes
Notes
Implementing the new ToC required a change in how the
slides
object worked. It's now calledbothLanguageSlides
, and each contains two Slide objects, one for each config, as so:App layout: I've modified the layout so the whole app no longer overshoots the page height (and requires a scrollbar); scrolling is now done only for individual panes (sidebar or slide editor+feedback), when they independently overflow. However, my current solution hardcodes the page height based on the existing elements; it works for different viewport sizes, but will break if there's ANY added/removed page elements in the future that increases/decreases the size given for the ToC or the slide editor half of the page. A future app layout refactor should probably find a better way to do this.
TODO
Mobile ToC (this one doesn't shrink)Comment main codeTesting
Steps:
00000000-0000-0000-0000-000000000000
.This change is