-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1f79bc
commit e0e4cab
Showing
8 changed files
with
103 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,30 @@ | ||
import { useEffect } from 'react'; | ||
import { GetServerSideProps } from 'next'; | ||
import ExperienceBar from '../components/ExperienceBar'; | ||
import Profile from '../components/Profile'; | ||
import CompletedChallenges from '../components/CompletedChallenges'; | ||
import Countdown from '../components/Countdown'; | ||
import ChallengeBox from '../components/ChallengeBox'; | ||
import Head from 'next/head'; | ||
import useChallenge from '../hooks/useChallenge'; | ||
import styles from '../styles/pages/Home.module.scss'; | ||
|
||
type HomeProps = { | ||
level: number; | ||
currentXP: number; | ||
challengesCompleted: number; | ||
} | ||
|
||
export default function Home({level,currentXP, challengesCompleted}:HomeProps) { | ||
const { setLevel, setCurrentXP, setChallengesCompleted} = useChallenge(); | ||
useEffect(() => { | ||
setLevel(level) | ||
setCurrentXP(currentXP) | ||
setChallengesCompleted(challengesCompleted) | ||
|
||
}, [level,currentXP,challengesCompleted]) | ||
|
||
export default function Home() { | ||
return ( | ||
<> | ||
<div className={styles.container}> | ||
<Head> | ||
<title>Home | Moveit</title> | ||
</Head> | ||
<div className={styles.container}> | ||
<Head> | ||
<title>Home | MoveIt</title> | ||
</Head> | ||
|
||
<ExperienceBar /> | ||
<section> | ||
<div> | ||
<Profile /> | ||
<CompletedChallenges /> | ||
<Countdown /> | ||
</div> | ||
<div> | ||
<ChallengeBox /> | ||
</div> | ||
</section> | ||
</div> | ||
</> | ||
<ExperienceBar /> | ||
<section> | ||
<div> | ||
<Profile /> | ||
<CompletedChallenges /> | ||
<Countdown /> | ||
</div> | ||
<div> | ||
<ChallengeBox /> | ||
</div> | ||
</section> | ||
</div> | ||
) | ||
} | ||
|
||
export const getServerSideProps:GetServerSideProps = async ({req}) => { | ||
const { level, currentXP, challengesCompleted } = req.cookies; | ||
|
||
return{ | ||
props:{ | ||
level: Number(level), | ||
currentXP: Number(currentXP), | ||
challengesCompleted: Number(challengesCompleted) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.