Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/platform/assets/components/UploadModelFooter.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<template>
<div class="flex justify-end gap-2 w-full">
<span
<button
v-if="currentStep === 1"
class="text-muted-foreground mr-auto underline flex items-center gap-2"
class="text-muted-foreground mr-auto underline flex items-center gap-2 cursor-pointer bg-transparent border-0 p-0"
data-attr="upload-model-step1-help-link"
@click="showVideoHelp = true"
>
<i class="icon-[lucide--circle-question-mark]" />
<a
href="#"
target="_blank"
class="text-muted-foreground"
data-attr="upload-model-step1-help-link"
>{{ $t('How do I find this?') }}</a
>
</span>
<span>{{ $t('How do I find this?') }}</span>
</button>
<TextButton
v-if="currentStep === 1"
:label="$t('g.cancel')"
Expand Down Expand Up @@ -73,12 +69,23 @@
data-attr="upload-model-step3-finish-button"
@click="emit('close')"
/>
<VideoHelpDialog
v-model="showVideoHelp"
video-url="https://media.comfy.org/compressed_768/civitai_howto.webm"
loop
:show-controls="false"
/>
</div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import IconTextButton from '@/components/button/IconTextButton.vue'
import TextButton from '@/components/button/TextButton.vue'
import VideoHelpDialog from '@/platform/assets/components/VideoHelpDialog.vue'
const showVideoHelp = ref(false)
defineProps<{
currentStep: number
Expand Down
86 changes: 86 additions & 0 deletions src/platform/assets/components/VideoHelpDialog.vue
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional:

Suggested change
:loop="loop"
:loop

class="w-full rounded-lg"
:src="videoUrl"
>
{{ $t('g.videoFailedToLoad') }}
</video>
</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
Copy link
Contributor

Choose a reason for hiding this comment

The 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 })
}
})
onUnmounted(() => {
document.removeEventListener('keydown', handleEscapeKey, { capture: true })
})
Comment on lines 69 to 95
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</script>
Loading