feat: add auth and data providers with mock data hooks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 14:34:23 +05:30
parent 15483c5542
commit dc68577477
5 changed files with 255 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import { useMemo } from 'react';
import type { FollowUp } from '@/types/entities';
import { useData } from '@/providers/data-provider';
type UseFollowUpsResult = {
followUps: FollowUp[];
overdue: FollowUp[];
upcoming: FollowUp[];
};
export const useFollowUps = (): UseFollowUpsResult => {
const { followUps } = useData();
const now = useMemo(() => new Date(), []);
const overdue = useMemo(() => {
return followUps.filter((followUp) => {
if (followUp.followUpStatus === 'OVERDUE') {
return true;
}
if (followUp.followUpStatus === 'PENDING' && followUp.scheduledAt !== null) {
return new Date(followUp.scheduledAt) < now;
}
return false;
});
}, [followUps, now]);
const upcoming = useMemo(() => {
return followUps.filter((followUp) => {
return followUp.followUpStatus === 'PENDING' && followUp.scheduledAt !== null && new Date(followUp.scheduledAt) >= now;
});
}, [followUps, now]);
return {
followUps,
overdue,
upcoming,
};
};