-
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 1 commit
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,86 @@ | ||||||
| <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 | ||||||
| :loop="loop" | ||||||
|
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. Optional:
Suggested change
|
||||||
| class="w-full rounded-lg" | ||||||
| :src="videoUrl" | ||||||
| > | ||||||
| {{ $t('g.videoFailedToLoad') }} | ||||||
| </video> | ||||||
luke-mino-altherr marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| </div> | ||||||
| </Dialog> | ||||||
| </template> | ||||||
|
|
||||||
| <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 | ||||||
| loop?: boolean | ||||||
| showControls?: boolean | ||||||
| }>(), | ||||||
| { | ||||||
| loop: true, | ||||||
| showControls: false | ||||||
| } | ||||||
| ) | ||||||
| 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 }) | ||||||
| } | ||||||
| }) | ||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| onUnmounted(() => { | ||||||
| document.removeEventListener('keydown', handleEscapeKey, { capture: true }) | ||||||
| }) | ||||||
|
Comment on lines
69
to
95
Contributor
Author
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. had to do some finagling so that esc wouldn't close the modal underneath this
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. |
||||||
| </script> | ||||||
Uh oh!
There was an error while loading. Please reload this page.