mirror of
https://github.com/harivansh-afk/Habit-Tracker.git
synced 2026-04-18 19:03:46 +00:00
removed week scrolling
This commit is contained in:
parent
f419197d73
commit
149b02b4da
1 changed files with 24 additions and 37 deletions
23
src/App.tsx
23
src/App.tsx
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { ChevronLeft, ChevronRight, Sun, Moon, Plus, Circle, User } from 'lucide-react';
|
import { Plus, Circle, User } from 'lucide-react';
|
||||||
import { HabitList } from './components/HabitList';
|
import { HabitList } from './components/HabitList';
|
||||||
import { Calendar } from './components/Calendar';
|
import { Calendar } from './components/Calendar';
|
||||||
import { Sidebar } from './components/Sidebar';
|
import { Sidebar } from './components/Sidebar';
|
||||||
|
|
@ -16,11 +16,11 @@ import { PreferencesProvider, usePreferences } from './contexts/PreferencesConte
|
||||||
const DAYS_OF_WEEK = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
const DAYS_OF_WEEK = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||||
|
|
||||||
function HabitTrackerContent() {
|
function HabitTrackerContent() {
|
||||||
const { theme, isDark, toggleDarkMode, defaultView, habitSort } = useThemeContext();
|
const { theme, habitSort } = useThemeContext();
|
||||||
const [newHabit, setNewHabit] = useState('');
|
const [newHabit, setNewHabit] = useState('');
|
||||||
const [activeView, setActiveView] = useState<'habits' | 'calendar' | 'settings'>(defaultView);
|
const [activeView, setActiveView] = useState<'habits' | 'calendar' | 'settings'>('habits');
|
||||||
const [currentMonth, setCurrentMonth] = useState(new Date());
|
const [currentMonth, setCurrentMonth] = useState(new Date());
|
||||||
const { user, loading, signOut } = useAuth();
|
const { user, loading } = useAuth();
|
||||||
const [authView, setAuthView] = useState<'login' | 'signup'>('login');
|
const [authView, setAuthView] = useState<'login' | 'signup'>('login');
|
||||||
const { preferences } = usePreferences();
|
const { preferences } = usePreferences();
|
||||||
|
|
||||||
|
|
@ -37,8 +37,7 @@ function HabitTrackerContent() {
|
||||||
const {
|
const {
|
||||||
currentWeek,
|
currentWeek,
|
||||||
setCurrentWeek,
|
setCurrentWeek,
|
||||||
getCurrentWeekDates,
|
getCurrentWeekDates
|
||||||
changeWeek
|
|
||||||
} = useWeek();
|
} = useWeek();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -168,24 +167,12 @@ function HabitTrackerContent() {
|
||||||
<p className={`text-sm ${theme.mutedText}`}>Track your weekly progress</p>
|
<p className={`text-sm ${theme.mutedText}`}>Track your weekly progress</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<button
|
|
||||||
onClick={() => changeWeek('prev')}
|
|
||||||
className={`p-2 rounded-lg ${theme.button.icon}`}
|
|
||||||
>
|
|
||||||
<ChevronLeft className="h-5 w-5" />
|
|
||||||
</button>
|
|
||||||
<button
|
<button
|
||||||
onClick={goToCurrentWeek}
|
onClick={goToCurrentWeek}
|
||||||
className={`px-4 py-2 rounded-lg ${theme.button.secondary}`}
|
className={`px-4 py-2 rounded-lg ${theme.button.secondary}`}
|
||||||
>
|
>
|
||||||
Today
|
Today
|
||||||
</button>
|
</button>
|
||||||
<button
|
|
||||||
onClick={() => changeWeek('next')}
|
|
||||||
className={`p-2 rounded-lg ${theme.button.icon}`}
|
|
||||||
>
|
|
||||||
<ChevronRight className="h-5 w-5" />
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue