1+ import Check from "@/assets/icons/check.svg?react" ;
2+ import ChevronDown from "@/assets/icons/chevron-down.svg?react" ;
3+ import { getServerSettingsKey , useServerSettings } from "@/data/server/get-server-settings" ;
4+ import { useUpdateServerSettings } from "@/data/server/update-server-settings-mutation" ;
5+ import { OnboardingChecklistItemName , OnboardingState } from "@/types/onboarding" ;
6+ import { useQueryClient } from "@tanstack/react-query" ;
17import {
28 Button ,
39 Collapsible ,
@@ -7,12 +13,6 @@ import {
713} from "@zenml-io/react-component-library" ;
814import { PropsWithChildren , ReactNode , useState } from "react" ;
915import { Tick } from "../Tick" ;
10- import { useQueryClient } from "@tanstack/react-query" ;
11- import { useUpdateServerSettings } from "@/data/server/update-server-settings-mutation" ;
12- import { getServerSettingsKey , useServerSettings } from "@/data/server/get-server-settings" ;
13- import { OnboardingChecklistItemName , OnboardingState } from "@/types/onboarding" ;
14- import ChevronDown from "@/assets/icons/chevron-down.svg?react" ;
15- import Check from "@/assets/icons/check.svg?react" ;
1616
1717type Props = {
1818 completed : boolean ;
@@ -37,10 +37,10 @@ export function ChecklistItem({
3737 }
3838 } ) ;
3939
40- function markAsDone ( ) {
40+ function toggleItem ( isDone : boolean ) {
4141 const newOnboardingState : OnboardingState = {
4242 ...data ?. metadata ?. onboarding_state ,
43- [ itemName ] : true
43+ [ itemName ] : isDone
4444 } ;
4545 mutate ( { onboarding_state : newOnboardingState } ) ;
4646 }
@@ -49,25 +49,34 @@ export function ChecklistItem({
4949 < Collapsible open = { open } onOpenChange = { setOpen } >
5050 < div className = "flex w-full flex-col gap-3" >
5151 < div className = "flex w-full justify-between gap-2" >
52+ { completed ? (
53+ < button onClick = { ( ) => toggleItem ( false ) } >
54+ < Tick className = "shrink-0" />
55+ </ button >
56+ ) : (
57+ < ProgressOutstanding className = "shrink-0" />
58+ ) }
5259 < CollapsibleTrigger className = "w-full" >
5360 < ChecklistHeader title = { title } completed = { completed } />
5461 </ CollapsibleTrigger >
5562 < div className = "flex items-center gap-1" >
5663 { ! completed && active && (
5764 < Button
58- onClick = { markAsDone }
65+ onClick = { ( ) => toggleItem ( true ) }
5966 className = "items-center whitespace-nowrap"
6067 intent = "primary"
6168 emphasis = "subtle"
6269 >
6370 < Check className = "h-5 w-5 fill-primary-600" /> < span > Mark as done</ span >
6471 </ Button >
6572 ) }
66- < ChevronDown
67- className = { ` ${
68- open ? "" : "-rotate-90"
69- } h-5 w-5 shrink-0 rounded-md fill-neutral-500`}
70- />
73+ < CollapsibleTrigger >
74+ < ChevronDown
75+ className = { ` ${
76+ open ? "" : "-rotate-90"
77+ } h-5 w-5 shrink-0 rounded-md fill-neutral-500`}
78+ />
79+ </ CollapsibleTrigger >
7180 </ div >
7281 </ div >
7382 { children && (
@@ -90,8 +99,7 @@ type HeaderProps = {
9099export function ChecklistHeader ( { completed, title } : HeaderProps ) {
91100 return (
92101 < div className = "flex w-full items-center justify-between gap-2" >
93- < div className = "flex w-full items-center gap-2" >
94- { completed ? < Tick /> : < ProgressOutstanding /> }
102+ < div className = "flex w-full items-center" >
95103 < div
96104 className = { `font-semibold ${
97105 completed ? "text-theme-text-tertiary line-through decoration-theme-text-tertiary" : ""
0 commit comments