Skip to content

Commit

Permalink
refactor: Move all GoalTracker into Home.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZL-Asica committed Nov 7, 2024
1 parent ce0ee2a commit ff2d358
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 35 deletions.
32 changes: 0 additions & 32 deletions src/components/Home/GoalTracker.jsx

This file was deleted.

28 changes: 25 additions & 3 deletions src/pages/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
import GoalTracker from '@/components/Home/GoalTracker'
import AddItem from '@/components/Home/AddItem'
import MacroGoal from '@/components/Home/MacroGoal'
import { useUser } from '@/contexts/UserContext'
import useGoalsUpdater from '@/hooks/useGoalsUpdater'
import { Box } from '@mui/material'

const Home = () => {
const { user } = useUser()
const { addGoal } = useGoalsUpdater()

return (
<Box sx={{ width: '95%', margin: 'auto' }}>
<GoalTracker />
<Box sx={{ maxWidth: 800, margin: 'auto', padding: 3 }}>
<AddItem label='New Goal' onAdd={addGoal} />

{/* Render existing goals */}
<Box sx={{ mt: 2 }}>
{user.goals.map((goal, index) => (
<Box
key={index}
sx={{
borderLeft: `5px solid ${goal.category || '#000'}`,
paddingLeft: 2,
mb: 2,
}}
>
<MacroGoal macroGoal={goal} macroGoalIndex={index} />
</Box>
))}
</Box>
</Box>
)
}
Expand Down

0 comments on commit ff2d358

Please sign in to comment.