forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskRightPanel.tsx
More file actions
99 lines (87 loc) · 2.48 KB
/
Copy pathTaskRightPanel.tsx
File metadata and controls
99 lines (87 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
'use client';
import { TaskProgressCard } from './TaskProgressCard';
import { NoDueDatePrompt } from './NoDueDatePrompt';
import { MonthCalendar } from './MonthCalendar';
import type { ActionItem, GroupedActionItems } from '@/types/conversation';
interface TaskRightPanelProps {
// Stats for progress card
stats: {
total: number;
completed: number;
pending: number;
overdue: number;
noDueDateCount: number;
todayTotal: number;
todayCompleted: number;
weekCompleted: number;
weekPending: number;
streak: number;
};
// Items for components
items: ActionItem[];
groupedItems: GroupedActionItems;
// Actions
onBulkSetDueDate: (ids: string[], date: Date | null) => void;
onShowNoDueDateItems: () => void;
// Calendar props
onDateSelect: (date: Date) => void;
selectedDate: Date | null;
onDragToDate: (date: Date, taskId: string) => void;
}
export function TaskRightPanel({
stats,
items,
groupedItems,
onBulkSetDueDate,
onShowNoDueDateItems,
onDateSelect,
selectedDate,
onDragToDate,
}: TaskRightPanelProps) {
const noDueDateItems = groupedItems.noDueDate;
const noDueDateIds = noDueDateItems.map((i) => i.id);
const handleSetAllToday = () => {
onBulkSetDueDate(noDueDateIds, new Date());
};
const handleSetAllTomorrow = () => {
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
onBulkSetDueDate(noDueDateIds, tomorrow);
};
const handleSetAllToDate = (date: Date) => {
onBulkSetDueDate(noDueDateIds, date);
};
return (
<div className="w-full space-y-4">
{/* Progress stats */}
<TaskProgressCard
overdueCount={stats.overdue}
todayTotal={stats.todayTotal}
todayCompleted={stats.todayCompleted}
totalPending={stats.pending}
totalCompleted={stats.completed}
weekCompleted={stats.weekCompleted}
weekPending={stats.weekPending}
streak={stats.streak}
compact
/>
{/* Month calendar */}
<MonthCalendar
items={items}
onSelectDate={onDateSelect}
selectedDate={selectedDate}
onDropTask={onDragToDate}
/>
{/* No due date prompt */}
{noDueDateItems.length > 0 && (
<NoDueDatePrompt
items={noDueDateItems}
onSetAllToday={handleSetAllToday}
onSetAllTomorrow={handleSetAllTomorrow}
onSetAllToDate={handleSetAllToDate}
onShowItems={onShowNoDueDateItems}
/>
)}
</div>
);
}