diff --git a/src/pages/HomePage.jsx b/src/pages/HomePage.jsx index 34916f1..9611966 100644 --- a/src/pages/HomePage.jsx +++ b/src/pages/HomePage.jsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd'; -import { useNavigate } from 'react-router-dom'; +// ...existing code... import { motion, AnimatePresence } from 'framer-motion'; import { Plus, Settings, TrendingUp, Flame, Calendar, Moon, Sun } from 'lucide-react'; import { Button } from '../components/ui/button'; @@ -10,6 +10,7 @@ import AnimatedCounter from '../components/AnimatedCounter'; import GitActivityGrid from '../components/GitActivityGrid'; import { getGitEnabled } from '../lib/git'; import { getHabits, updateHabit, syncLocalToRemoteIfNeeded, syncRemoteToLocal, getAuthUser } from '../lib/datastore'; +import { useNavigate } from 'react-router-dom'; const HomePage = () => { const navigate = useNavigate(); @@ -84,6 +85,15 @@ const HomePage = () => { navigate('/add'); }; + const handleLoginSync = () => { + navigate('/login'); + }; + + const handleManualSync = async () => { + await syncLocalToRemoteIfNeeded(); + toast({ title: 'Synced!', description: 'Your habits have been synced to the cloud.' }); + }; + return (
@@ -123,6 +133,7 @@ const HomePage = () => {
+ {/* Stats Overview */} {habits.length > 0 && ( { )} + + {/* Habits List */} {/* Grouped Habits by Category, collapsible, and uncategorized habits outside */} { Create First Habit + + {/* Call to Action for Login/Sync */} +
+ {!loggedIn ? ( + + ) : ( + + )} +
) )} + + {/* Add Button */} {habits.length > 0 && (