Files
multica/packages/views/issues/components/progress-ring.tsx
Bohan Jiang c8f0f3dc9d feat(views): show sub-issue progress in list rows (#566)
* feat(views): show sub-issue progress indicator in issue list rows

When an issue has sub-issues, display a circular progress ring with
done/total count (e.g. "2/3") in the list row. Progress is computed
from the already-loaded issue list without additional API calls.

Extracts ProgressRing into a shared component reused by both
issue-detail and list-row.

* feat(views): refine sub-issue progress UI and add to board view

- Move progress badge right after issue title (not pushed to far right)
- Increase progress ring size from 11px to 14px for better visibility
- Add sub-issue progress indicator to board card view
- Thread childProgressMap through BoardView → BoardColumn → BoardCard
2026-04-09 16:52:12 +08:00

52 lines
1.2 KiB
TypeScript

/**
* Tiny circular progress ring. Renders an open ring when in-progress and
* fills to a solid arc when complete.
*/
export function ProgressRing({
done,
total,
size = 12,
}: {
done: number;
total: number;
size?: number;
}) {
const stroke = 1.5;
const radius = (size - stroke) / 2;
const circumference = 2 * Math.PI * radius;
const ratio = total > 0 ? Math.min(done / total, 1) : 0;
const offset = circumference * (1 - ratio);
const isComplete = total > 0 && done >= total;
return (
<svg
width={size}
height={size}
viewBox={`0 0 ${size} ${size}`}
className={isComplete ? "text-info" : "text-primary"}
aria-hidden="true"
>
<circle
cx={size / 2}
cy={size / 2}
r={radius}
fill="none"
stroke="currentColor"
strokeOpacity="0.25"
strokeWidth={stroke}
/>
<circle
cx={size / 2}
cy={size / 2}
r={radius}
fill="none"
stroke="currentColor"
strokeWidth={stroke}
strokeDasharray={circumference}
strokeDashoffset={offset}
strokeLinecap="round"
transform={`rotate(-90 ${size / 2} ${size / 2})`}
/>
</svg>
);
}