feat(client): check in
Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit is contained in:
38
client/src/components/workbenchCards/checkin.tsx
Normal file
38
client/src/components/workbenchCards/checkin.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import { toast } from 'sonner';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardAction, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { useCheckin } from '@/hooks/data/useCheckin';
|
||||
|
||||
export function CheckinCard() {
|
||||
const { mutateAsync, isPending } = useCheckin();
|
||||
return (
|
||||
<Card className="@container/card">
|
||||
<CardHeader>
|
||||
<CardDescription>签到状态</CardDescription>
|
||||
<CardTitle className="text-2xl font-semibold tabular-nums @[250px]/card:text-3xl">
|
||||
未签到
|
||||
</CardTitle>
|
||||
<CardAction>
|
||||
<Badge variant="outline">Day 1</Badge>
|
||||
</CardAction>
|
||||
</CardHeader>
|
||||
<CardFooter className="flex-col items-start gap-1.5 text-sm">
|
||||
<Button
|
||||
className="w-20"
|
||||
onClick={() => {
|
||||
mutateAsync().then(() => {
|
||||
toast('签到成功');
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
toast('签到失败');
|
||||
});
|
||||
}}
|
||||
disabled={isPending}
|
||||
>
|
||||
签到
|
||||
</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user