mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-04 21:22:07 +00:00
## Summary Currently the delay between user action and visual response is too long and it looks like it hasn't worked. This adds a visual indicator that the action is processing. ## Changes - add loading indicator while asset is deleting ## Screenshots (if applicable) (Artifically delayed deletion) https://github.com/user-attachments/assets/a9a8b9fe-896d-4666-b643-ec8b990f6444 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7906-Add-asset-deletion-progress-indicator-2e26d73d365081ed82b8e770ba3d0615) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown <drjkl@comfy.org> Co-authored-by: Jin Yi <jin12cc@gmail.com>
50 lines
1.1 KiB
Vue
50 lines
1.1 KiB
Vue
<template>
|
|
<Transition name="fade">
|
|
<div
|
|
v-if="loading"
|
|
class="absolute inset-0 z-50 flex items-center justify-center bg-backdrop/50"
|
|
>
|
|
<div class="flex flex-col items-center">
|
|
<div class="grid place-items-center">
|
|
<div
|
|
:class="
|
|
cn(
|
|
'col-start-1 row-start-1 animate-spin rounded-full border-muted-foreground border-t-base-foreground',
|
|
spinnerSizeClass
|
|
)
|
|
"
|
|
/>
|
|
<div class="col-start-1 row-start-1">
|
|
<slot />
|
|
</div>
|
|
</div>
|
|
<div v-if="loadingMessage" class="mt-4 text-lg text-base-foreground">
|
|
{{ loadingMessage }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Transition>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
|
|
const { size = 'md' } = defineProps<{
|
|
loading: boolean
|
|
loadingMessage?: string
|
|
size?: 'sm' | 'md'
|
|
}>()
|
|
|
|
const spinnerSizeClass = computed(() => {
|
|
switch (size) {
|
|
case 'sm':
|
|
return 'h-6 w-6 border-2'
|
|
case 'md':
|
|
default:
|
|
return 'h-12 w-12 border-4'
|
|
}
|
|
})
|
|
</script>
|