mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 13:48:21 +00:00
- Replace fetch uploads with XMLHttpRequest to capture upload progress - Track active upload tasks and file progress in Zustand store - Show byte-level uploader progress in the sidebar list - Replace plain 'Uploading' card status text with a circular percentage animation - Replace plain document icon in file list view rows with a mini progress circle
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import React from 'react'
|
|
import { cn } from '@/ui/lib/utils'
|
|
|
|
interface ProgressCircleProps {
|
|
progress: number
|
|
className?: string
|
|
}
|
|
|
|
export const ProgressCircle: React.FC<ProgressCircleProps> = ({ progress, className }) => {
|
|
const radius = 20
|
|
const circumference = 2 * Math.PI * radius
|
|
const offset = circumference - (Math.min(100, Math.max(0, progress)) / 100) * circumference
|
|
|
|
return (
|
|
<svg viewBox="0 0 50 50" className={cn('w-12 h-12', className)}>
|
|
<circle
|
|
cx="25"
|
|
cy="25"
|
|
r={radius}
|
|
className="stroke-muted"
|
|
strokeWidth="4"
|
|
fill="transparent"
|
|
/>
|
|
<circle
|
|
cx="25"
|
|
cy="25"
|
|
r={radius}
|
|
className="stroke-primary transition-all duration-300 ease-out"
|
|
strokeWidth="4"
|
|
fill="transparent"
|
|
strokeDasharray={circumference}
|
|
strokeDashoffset={offset}
|
|
transform="rotate(-90 25 25)"
|
|
/>
|
|
<text
|
|
x="50%"
|
|
y="50%"
|
|
textAnchor="middle"
|
|
dy=".3em"
|
|
className="fill-foreground text-[10px] font-bold"
|
|
>
|
|
{`${Math.round(progress)}%`}
|
|
</text>
|
|
</svg>
|
|
)
|
|
}
|