Implement progress and error for import UploadEntry

This commit is contained in:
2026-01-02 23:21:38 +05:00
parent 885aab0d9d
commit 0b1badd4bb
6 changed files with 73 additions and 15 deletions

View File

@ -4,13 +4,15 @@
<AudioWaveform :size="32" />
</div>
<div class="w-full">
<div class="flex flex-row gap-4">
<div class="flex flex-row items-center gap-1">
<p class="font-medium">
{{ title }}
</p>
<Pen />
<UiButton variant="ghost" v-if="size">
<Pen />
</UiButton>
</div>
<div class="flex flex-row">
<div class="flex flex-row" v-if="size && format">
<p class="text-sm text-muted-foreground">
{{ size }}
</p>
@ -19,9 +21,22 @@
{{ format }}
</p>
</div>
<div class="flex flex-row items-center gap-2" v-if="progress">
<p class="text-sm text-muted-foreground">
{{ progress }}%
</p>
<UiProgress :modelValue="progress" />
</div>
<div class="flex flex-row" v-if="error">
<p class="text-sm text-destructive-foreground">
{{ error }}
</p>
</div>
</div>
<div>
<EllipsisVertical :size="32" />
<UiButton variant="ghost">
<EllipsisVertical :size="32" />
</UiButton>
</div>
</Frame>
</template>
@ -32,8 +47,8 @@ import { AudioWaveform, Dot, EllipsisVertical, Pen } from 'lucide-vue-next'
interface Props {
title: string
size: string
format: string
size?: string
format?: string
progress?: number
error?: string
}

View File

@ -0,0 +1,38 @@
<script setup lang="ts">
import type { ProgressRootProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import {
ProgressIndicator,
ProgressRoot,
} from "reka-ui"
import { cn } from "@/lib/utils"
const props = withDefaults(
defineProps<ProgressRootProps & { class?: HTMLAttributes["class"] }>(),
{
modelValue: 0,
},
)
const delegatedProps = reactiveOmit(props, "class")
</script>
<template>
<ProgressRoot
data-slot="progress"
v-bind="delegatedProps"
:class="
cn(
'bg-primary/20 relative h-2 w-full overflow-hidden rounded-full',
props.class,
)
"
>
<ProgressIndicator
data-slot="progress-indicator"
class="bg-primary h-full w-full flex-1 transition-all"
:style="`transform: translateX(-${100 - (props.modelValue ?? 0)}%);`"
/>
</ProgressRoot>
</template>

View File

@ -0,0 +1 @@
export { default as Progress } from "./Progress.vue"