From 7bb4e99152fc9d938473b81a5858d4b3ac67252b Mon Sep 17 00:00:00 2001 From: Sambhavi Date: Sat, 20 Jun 2026 15:22:47 +0530 Subject: [PATCH 1/2] Add highlight feature for grid in RoutineBuilder --- frontend/src/pages/RoutineBuilder.jsx | 34 +++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/RoutineBuilder.jsx b/frontend/src/pages/RoutineBuilder.jsx index 5e092a9b..4349b701 100644 --- a/frontend/src/pages/RoutineBuilder.jsx +++ b/frontend/src/pages/RoutineBuilder.jsx @@ -43,6 +43,7 @@ export default function RoutineBuilder() { const [isImageExporting, setIsImageExporting] = useState(false); const [isTemplateModalOpen, setIsTemplateModalOpen] = useState(false); const [selectedTemplateDay, setSelectedTemplateDay] = useState("Monday"); + const [highlightGrid, setHighlightGrid] = useState(false); const gridRef = useRef(null); @@ -80,6 +81,27 @@ export default function RoutineBuilder() { const handleOpenModal = useScrollThenOpen(openModal, 0); + // Triggered by the "Saved Routines" empty state CTA. + // A routine is built by scheduling existing tasks onto the grid, so this + // should never open the Task form — that form already has its own CTA in + // the Task Library's empty state. Instead: + // - if the library already has tasks, scroll up and pulse the grid so the + // user sees where to drag tasks from + // - if the library is empty too, open the Task form, since the user needs + // at least one task before they can schedule anything + const pulseGrid = useScrollThenOpen(() => { + setHighlightGrid(true); + setTimeout(() => setHighlightGrid(false), 1600); + }, 0); + + const handleStartRoutine = useCallback(() => { + if (tasks?.length > 0) { + pulseGrid(); + } else { + handleOpenModal(); + } + }, [tasks, pulseGrid, handleOpenModal]); + const handleSubmit = async (data) => { try { await addTask({ ...data, status: "Due" }); @@ -294,6 +316,7 @@ export default function RoutineBuilder() { onSaveDay={openSaveRoutineModal} onDeleteTask={removeScheduledTask} innerRef={gridRef} + highlight={highlightGrid} /> @@ -308,13 +331,14 @@ export default function RoutineBuilder() {

Loading routines…

) : savedRoutines.length === 0 ? ( /* - * EmptyState is deep in the page — clicking "Create Your First - * Routine" here triggers handleOpenModal, which scrolls to the - * top first, then opens the modal once the scroll settles. + * EmptyState is deep in the page. Clicking "Create Your First + * Routine" should guide the user toward the actual routine flow + * (drag a task onto the weekly grid), not open the Task form — + * that form belongs to the Task Library's own empty state. */ ) : (
@@ -434,4 +458,4 @@ export default function RoutineBuilder() {
); -} \ No newline at end of file +} From baf2dbe09f87d9906c2e2bbcd943110424f702e8 Mon Sep 17 00:00:00 2001 From: Sambhavi Date: Sat, 20 Jun 2026 15:23:33 +0530 Subject: [PATCH 2/2] Add highlight prop to WeeklyGrid component --- frontend/src/components/Routine/WeeklyGrid.jsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/Routine/WeeklyGrid.jsx b/frontend/src/components/Routine/WeeklyGrid.jsx index 4fc8c361..bece3fc8 100644 --- a/frontend/src/components/Routine/WeeklyGrid.jsx +++ b/frontend/src/components/Routine/WeeklyGrid.jsx @@ -80,10 +80,22 @@ function DroppableCell({ day, time, tasks, onDeleteTask }) { } /* ---------------- Weekly Grid ---------------- */ -export default function WeeklyGrid({ scheduledTasks, onSaveDay, onDeleteTask, innerRef }) { +export default function WeeklyGrid({ scheduledTasks, onSaveDay, onDeleteTask, innerRef, highlight }) { return ( -
-

Weekly Schedule

+
+

Weekly Schedule

+ {highlight ? ( +

+ Drag a task from your library onto the grid to start building a routine +

+ ) : ( +
+ )}