This repository has been archived on 2025-12-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
DEAD-fps-attendance-nextjs/components/ClockButton.tsx
T
2025-06-26 13:09:12 -04:00

19 lines
552 B
TypeScript

"use client";
import React from 'react';
import { useAttendance } from '../hooks/useAttendance';
export default function ClockButton({ teacherId }: { teacherId: string }) {
const { todayRecords, clockToggle } = useAttendance();
const last = todayRecords.filter(r => r.teacherId === teacherId).pop();
const nextType = last?.type === 'in' ? 'out' : 'in';
return (
<button
onClick={() => clockToggle(teacherId)}
className="px-4 py-2 border rounded"
>
{nextType === 'in' ? 'Clock In' : 'Clock Out'}
</button>
);
}