repeating tasks UI improvements

This commit is contained in:
2026-03-13 12:00:04 -05:00
parent 3cbbc65c5c
commit b89e6ca2c3
4 changed files with 112 additions and 5 deletions
+32 -2
View File
@@ -1,4 +1,4 @@
import { type Component } from "solid-js";
import { type Component, For } from "solid-js";
import { CheckCircle2 } from "lucide-solid";
import { cn } from "@/lib/utils";
@@ -6,6 +6,7 @@ interface StatusCircleProps {
status: number;
size?: number;
className?: string;
recurrenceProgress?: number | null;
}
export const StatusCircle: Component<StatusCircleProps> = (props) => {
@@ -25,10 +26,39 @@ export const StatusCircle: Component<StatusCircleProps> = (props) => {
return circumference() * (1 - percentage);
};
const dotCount = () => 12;
const dotRadius = () => Math.max(1.4, size() * 0.06);
const dotRingRadius = () => radius() - 1;
const filledDots = () => {
const progress = props.recurrenceProgress ?? 0;
return Math.floor(Math.max(0, Math.min(1, progress)) * dotCount());
};
return (
<div class={cn("relative flex items-center justify-center", props.className)} style={{ width: `${size()}px`, height: `${size()}px` }}>
{props.status >= 10 ? (
<CheckCircle2 size={size()} class="text-green-500" />
props.recurrenceProgress != null ? (
<svg width={size()} height={size()}>
<For each={Array.from({ length: dotCount() })}>
{(_, index) => {
const angle = (index() / dotCount()) * Math.PI * 2 - Math.PI / 2;
const cx = size() / 2 + Math.cos(angle) * dotRingRadius();
const cy = size() / 2 + Math.sin(angle) * dotRingRadius();
const isFilled = index() < filledDots();
return (
<circle
cx={cx}
cy={cy}
r={dotRadius()}
class={isFilled ? "fill-green-500" : "fill-muted-foreground/30"}
/>
);
}}
</For>
</svg>
) : (
<CheckCircle2 size={size()} class="text-green-500" />
)
) : (
// Progress Circle
<div class="relative group">