(() => {
const { Card, Button, Badge, ProgressBar, StatusPill, StatCard, Icon, Avatar, DonutProgress } = window.TaskFlowDesignSystem_dd53c2;
function UserDashboard({ meId = 1, tasks, onStart, onComplete, onResubmit, onComment, onProjectComment, commentCount, onRevisionDone, onViewEvidence, onToggleCheck, avatarSrc, range, variant = "full" , onTimeline }) {
const bp = useBreakpoint();
const [doneNotes, setDoneNotes] = React.useState({});
const summary = variant === "summary";
const me = userById(meId);
const scopedAll = range ? tasks.filter((t) => inRange(t.assigned, range.from, range.to)) : tasks;
const mine = scopedAll.filter((t) => t.user === meId);
const tints = ["teal", "coral", "mint", "gold"];
const avg = mine.length ? Math.round(mine.reduce((a, b) => a + (b.status === "done" ? 100 : b.progress), 0) / mine.length) : 0;
const soon = mine.filter((t) => t.status !== "done").sort((a, b) => parseId(a.target) - parseId(b.target)).slice(0, 4);
const lanes = [
["To Do", "todo", "var(--neutral-400)"], ["In Progress", "in_progress", "var(--mint-500)"],
["On Verification", "on_verification", "var(--gold-500)"], ["Need Revision", "revision", "var(--coral-500)"],
["Accepted", "done", "var(--leaf-500)"],
];
return (
t.status === "in_progress").length} icon="loader" tone="mint" />
t.status === "on_verification").length} icon="shield-question" tone="gold" />
t.status === "revision").length} icon="rotate-ccw" tone="coral" />
t.status === "done").length} icon="shield-check" tone="leaf" />
{summary && (
Progress Saya
{mine.filter((t) => t.status === "done").length} dari {mine.length} task sudah diterima Direktur
{mine.filter((t) => t.status === "done").length} Accepted
{mine.filter((t) => t.status === "in_progress").length} Berjalan
{mine.filter((t) => t.status === "revision").length} Revisi
Rangkuman Status
{lanes.map(([label, key, color]) => {
const n = mine.filter((t) => t.status === key).length;
const pct = mine.length ? Math.round((n / mine.length) * 100) : 0;
return (
);
})}
Deadline Terdekat
{soon.length === 0 &&
Semua task sudah selesai.}
{soon.map((t) => (
{t.type}
{t.target}
))}
)}
Active Task
{mine.slice(0, 3).map((t, i) => (
))}
{tasks.filter((t) => t.delegate === meId && t.delegateStatus !== "done").length > 0 && (
Diminta Bantu Revisi
{tasks.filter((t) => t.delegate === meId && t.delegateStatus !== "done").length}
{tasks.filter((t) => t.delegate === meId && t.delegateStatus !== "done").map((t) => (
{t.type}
Dikerjakan {userById(t.user).name}
{t.delegateNote && (
Catatan delegasi Direktur
{t.delegateNote}
)}
{t.revision && (
Poin revisi
{t.revision}
)}
{t.evidence && (
{t.evidence.name}
{Math.round((t.evidence.compressed || t.evidence.size || 0) / 1024)} KB
)}
))}
)}
{!summary && onProjectComment &&
commentCount({ kind: "project", id: p.name }) : () => 0} />}
{!summary &&
Daftar Task
{mine.map((t) => (
{bp === "desktop" &&
}
{t.type}
{t.category}
{t.project && Project}
{t.repeat && t.repeat !== "none" && {REPEAT_LABEL[t.repeat]}}
{t.needSign && (t.signature
? Sudah di-TTD Direktur
: Perlu TTD Direktur)}
{isOverdue(t.target) && t.status !== "done" && Melewati target}
Diberikan {t.assigned}
Target {t.target}
{t.checklist && t.checklist.length > 0 && (
Sub-task
c.done) ? "leaf" : "neutral"}>{t.checklist.filter((c) => c.done).length}/{t.checklist.length}
progress In Progress mengikuti centang ini
{t.checklist.map((c) => {
const editable = t.status === "in_progress" || t.status === "revision";
return (
);
})}
)}
{t.status === "revision" && t.revision && (
Poin revisi dari Admin
{t.revision}
)}
{onTimeline &&
}
{t.status === "todo" && }
{t.status === "in_progress" && }
{t.status === "on_verification" && Menunggu verifikasi Direktur}
{t.status === "revision" && }
{t.status === "done" && t.needSign && t.signature && (
)}
{t.status === "done" && Diterima {t.done || "hari ini"}}
))}
}
);
}
Object.assign(window, { UserDashboard });
})();