diff --git a/src/App.tsx b/src/App.tsx index e1c9279..85704ff 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -10,6 +10,7 @@ import { AuthProvider, useAuth } from './contexts/AuthContext'; import { Login } from './components/Login'; import { SignUp } from './components/SignUp'; import { SettingsView } from './components/SettingsView'; +import { MobileNav } from './components/MobileNav'; const DAYS_OF_WEEK = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']; @@ -77,48 +78,56 @@ function HabitTrackerContent() { }; const renderHabitsView = () => ( -
-
- setNewHabit(e.target.value)} - placeholder="Add a new habit" - className={`flex-grow px-4 py-2 border rounded-lg ${theme.input}`} - /> - -
+
+
+
+ setNewHabit(e.target.value)} + onKeyPress={(e) => { + if (e.key === 'Enter' && newHabit.trim()) { + handleAddHabit(e); + } + }} + placeholder="Add a new habit" + className={`flex-1 px-4 py-2 rounded-lg ${theme.input}`} + /> + +
-
-
-
-

Your Habits

-

Track your weekly progress

-
-
- -
+
+
+
+

Your Habits

+

Track your weekly progress

+
+
+
@@ -132,7 +141,9 @@ function HabitTrackerContent() { onUpdateHabit={updateHabit} onDeleteHabit={deleteHabit} /> -

Keep up the good work! Consistency is key.

+

+ Keep up the good work! Consistency is key. +

); @@ -165,9 +176,14 @@ function HabitTrackerContent() { return (
-
- -
+
+
+ +
+
+ +
+
{activeView === 'habits' && renderHabitsView()} {activeView === 'calendar' && renderCalendarView()} {activeView === 'settings' && } diff --git a/src/components/HabitList.tsx b/src/components/HabitList.tsx index e2c3857..e21e5eb 100644 --- a/src/components/HabitList.tsx +++ b/src/components/HabitList.tsx @@ -41,19 +41,14 @@ export function HabitList({ const date = new Date(dateStr); return ( -
{getDayName(dateStr)}
+
{getDayName(dateStr)}
+
{getDayName(dateStr).slice(0, 1)}
{date.getDate()}
); })} - {showStreaks && ( - <> - Current Streak - Best Streak - - )} Actions @@ -65,9 +60,7 @@ export function HabitList({ type="text" value={habit.name} onChange={(e) => onUpdateHabit(habit.id, e.target.value)} - aria-label="Habit name" - placeholder="Enter habit name" - className="bg-transparent border-none focus:outline-none focus:ring-2 focus:ring-gray-300 rounded px-2" + className="bg-transparent border-none focus:outline-none focus:ring-2 focus:ring-gray-300 rounded px-2 w-full" /> {currentWeek.map((date) => ( @@ -76,27 +69,26 @@ export function HabitList({ { - onToggleHabit(habit.id, date); - }} - aria-label={`Mark ${habit.name} as completed for ${date}`} + onChange={() => onToggleHabit(habit.id, date)} className="sr-only" /> -
+
{habit.completedDates.includes(date) && ( - @@ -106,20 +98,6 @@ export function HabitList({ ))} - {showStreaks && ( - <> - - - {calculateStreak(habit.completedDates || []).currentStreak} - - - - - {calculateStreak(habit.completedDates || []).bestStreak} - - - - )} + ); +}; \ No newline at end of file diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index c7921e5..28c88f6 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -15,58 +15,61 @@ export const Sidebar: React.FC = ({ activeView, setActiveView }) = const { signOut } = useAuth(); return ( -