-
Notifications
You must be signed in to change notification settings - Fork 433
[feat] Add video help dialog to Upload Model flow #7177
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,96 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Dialog | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| v-model:visible="isVisible" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| modal | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :closable="false" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :close-on-escape="false" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :dismissable-mask="true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :pt="{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| root: { class: 'video-help-dialog' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| header: { class: '!hidden' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| content: { class: '!p-0' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mask: { class: '!bg-black/70' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :style="{ width: '90vw', maxWidth: '800px' }" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div class="relative"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <IconButton | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| class="absolute top-4 right-6 z-10" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :aria-label="$t('g.close')" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| @click="isVisible = false" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <i class="pi pi-times text-sm" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </IconButton> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <video | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :controls="showControls" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| autoplay | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| muted | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :loop="loop" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :aria-label="ariaLabel" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| class="w-full rounded-lg" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :src="videoUrl" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{ $t('g.videoFailedToLoad') }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </video> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Dialog> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Component behavior looks solid; consider making the default Overall the dialog is well-structured: PrimeVue One minor improvement: the withDefaults(defineProps<...>(), {
ariaLabel: 'Help video',
loop: true,
showControls: false
})Given the i18n guidelines, it would be better to either:
- <video
- :controls="showControls"
- autoplay
- muted
- :loop="loop"
- :aria-label="ariaLabel"
+ <video
+ :controls="showControls"
+ autoplay
+ muted
+ :loop="loop"
+ :aria-label="ariaLabel || $t('assetBrowser.uploadModelHelpVideo')"
class="w-full rounded-lg"
:src="videoUrl"
>This ensures that any future use of the component without an explicit Also applies to: 45-91 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| <script setup lang="ts"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Dialog from 'primevue/dialog' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { computed, onUnmounted, watch } from 'vue' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| import IconButton from '@/components/button/IconButton.vue' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const props = withDefaults( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| defineProps<{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| modelValue: boolean | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| videoUrl: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ariaLabel?: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| loop?: boolean | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| showControls?: boolean | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+47
to
+51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If any of these are always the same, I would remove them as props for now and just set them internally. YAGNI |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| }>(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ariaLabel: 'Help video', | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| loop: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| showControls: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+45
to
+58
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: We don't need
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const emit = defineEmits<{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'update:modelValue': [value: boolean] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }>() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+60
to
+62
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const isVisible = computed({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| get: () => props.modelValue, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| set: (value) => emit('update:modelValue', value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const handleEscapeKey = (event: KeyboardEvent) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (event.key === 'Escape' && isVisible.value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| event.stopImmediatePropagation() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| event.stopPropagation() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| event.preventDefault() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| isVisible.value = false | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| watch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| isVisible, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| (visible) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (visible) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Add listener with capture phase to intercept before parent dialogs | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| document.addEventListener('keydown', handleEscapeKey, { capture: true }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| document.removeEventListener('keydown', handleEscapeKey, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| capture: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { immediate: true } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| onUnmounted(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| document.removeEventListener('keydown', handleEscapeKey, { capture: true }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Optional: