Skip to content

Commit eb129a4

Browse files
committed
feat (tasks): task composer, tasks fixes, tasks page updates
1 parent e417bf7 commit eb129a4

5 files changed

Lines changed: 197 additions & 149 deletions

File tree

src/client/app/tasks/page.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,18 @@ Description: ${event.description || "No description."}`
492492
handleClosePanel() // Close the panel after creating the task
493493
}
494494

495+
const handleAddTaskForDay = (date) => {
496+
// Set the panel to show the composer with the default date
497+
setRightPanelContent({
498+
type: "composer",
499+
data: { defaultDate: date }
500+
})
501+
// If on mobile, open the modal
502+
if (isMobile) {
503+
setIsModalOpen(true)
504+
}
505+
}
506+
495507
const filteredOneTimeTasks = useMemo(() => {
496508
if (!searchQuery.trim()) {
497509
return oneTimeTasks
@@ -545,6 +557,7 @@ Description: ${event.description || "No description."}`
545557
<TaskComposer
546558
onTaskCreated={handleCreateTask}
547559
isPro={isPro}
560+
composerData={rightPanelContent.data}
548561
onUpgradeClick={() => setUpgradeModalOpen(true)}
549562
onClose={isMobile ? () => setIsModalOpen(false) : null}
550563
/>
@@ -715,7 +728,9 @@ Description: ${event.description || "No description."}`
715728
<CalendarView
716729
tasks={filteredCalendarTasks}
717730
onSelectTask={handleSelectItem}
718-
onDayClick={() => {}}
731+
onAddTaskForDay={
732+
handleAddTaskForDay
733+
}
719734
onShowMoreClick={
720735
handleShowMoreClick
721736
}
@@ -733,7 +748,7 @@ Description: ${event.description || "No description."}`
733748
</main>
734749

735750
{/* --- NEW: Right Panel for Desktop --- */}
736-
<aside className="hidden md:flex w-[450px] lg:w-[500px] bg-brand-black/50 backdrop-blur-sm border-l border-brand-gray flex-shrink-0 flex-col">
751+
<aside className="hidden md:flex w-[500px] lg:w-[550px] bg-brand-black/50 backdrop-blur-sm border-l border-brand-gray flex-shrink-0 flex-col">
737752
<AnimatePresence mode="wait">
738753
<motion.div
739754
key={rightPanelContent.type}

src/client/components/tasks/CalendarView.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CalendarDayCell = ({
3232
day,
3333
items, // Now receives a mix of tasks and events
3434
onSelectTask,
35-
onDayClick,
35+
onAddTaskForDay,
3636
onShowMoreClick,
3737
isCurrentMonth,
3838
isSelected
@@ -45,7 +45,7 @@ const CalendarDayCell = ({
4545
<motion.div
4646
onMouseEnter={() => setIsHovered(true)}
4747
onMouseLeave={() => setIsHovered(false)}
48-
onClick={() => onDayClick(day)}
48+
onClick={() => onShowMoreClick(day)}
4949
variants={cellVariants}
5050
className={cn(
5151
"border-r border-b border-neutral-800 p-2 flex flex-col gap-1 overflow-hidden relative min-h-[120px] rounded-lg",
@@ -77,7 +77,7 @@ const CalendarDayCell = ({
7777
exit={{ opacity: 0, scale: 0.8 }}
7878
onClick={(e) => {
7979
e.stopPropagation()
80-
onDayClick(day)
80+
onAddTaskForDay(day)
8181
}}
8282
className="p-1 rounded-full hover:bg-brand-gray hover:text-brand-white"
8383
>
@@ -112,7 +112,7 @@ const CalendarDayCell = ({
112112
const CalendarView = ({
113113
tasks,
114114
onSelectTask,
115-
onDayClick,
115+
onAddTaskForDay,
116116
onShowMoreClick,
117117
onMonthChange
118118
}) => {
@@ -137,11 +137,6 @@ const CalendarView = ({
137137
onMonthChange(newMonth)
138138
}
139139

140-
const handleDayClickInternal = (day) => {
141-
setSelectedDate(day)
142-
onDayClick(day)
143-
}
144-
145140
const containerVariants = {
146141
hidden: { opacity: 1 },
147142
visible: {
@@ -196,7 +191,7 @@ const CalendarView = ({
196191
items={tasksForDay}
197192
isCurrentMonth={isSameMonth(day, currentMonth)}
198193
onSelectTask={onSelectTask}
199-
onDayClick={handleDayClickInternal}
194+
onAddTaskForDay={onAddTaskForDay}
200195
onShowMoreClick={onShowMoreClick}
201196
isSelected={isSameDay(day, selectedDate)}
202197
/>

0 commit comments

Comments
 (0)