-
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.
Merge pull request #37 from nora-kauczor/pick-language
Pick language
- Loading branch information
Showing
5 changed files
with
72 additions
and
53 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
Empty file.
22 changes: 22 additions & 0 deletions
22
frontend/src/components/PickLanguagePopUp/PickLanguagePopUp.tsx
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react"; | ||
import './PickLanguagePopUp.css' | ||
type Props = { | ||
setLanguage: React.Dispatch<React.SetStateAction<string>> | ||
} | ||
export default function PickLanguagePopUp(props: Readonly<Props>) { | ||
return (<div id={"language-pop-up"}><p>Pick a language to start learning</p> | ||
<article> | ||
<button | ||
onClick={() => props.setLanguage("Spanish")} | ||
onKeyDown={() => props.setLanguage("Spanish")}>🇪🇸 | ||
Spanish | ||
</button> | ||
<button onClick={() => props.setLanguage("French")} | ||
onKeyDown={() => props.setLanguage("French")}>🇫🇷 French | ||
</button> | ||
<button onClick={() => props.setLanguage("Italian")} | ||
onKeyDown={() => props.setLanguage("Italian")}>🇮🇹 Italian | ||
</button> | ||
</article> | ||
</div>) | ||
} |
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,48 +1,50 @@ | ||
import './HomePage.css' | ||
import NewVocabsPopUp | ||
from "../../components/NewVocabsPopUp/NewVocabsPopUp.tsx"; | ||
import NewVocabsPopUp from "../../components/NewVocabsPopUp/NewVocabsPopUp.tsx"; | ||
import {useNavigate} from "react-router-dom"; | ||
import React, {useState} from "react"; | ||
import {Vocab} from "../../types/Vocab.ts"; | ||
import PickLanguagePopUp | ||
from "../../components/PickLanguagePopUp/PickLanguagePopUp.tsx"; | ||
|
||
type Props = { | ||
finishedReviewing: boolean | ||
setUseForm: React.Dispatch<React.SetStateAction<boolean>> | ||
language: string | ||
language?: string | ||
vocabs: Vocab[] | ||
setLanguage: React.Dispatch<React.SetStateAction<string>> | ||
} | ||
export default function HomePage(props: Readonly<Props>) { | ||
const [showPopUp, setShowPopUp] = useState(false) | ||
const navigate = useNavigate() | ||
|
||
return ( | ||
<div id={"homepage"}> | ||
<article id={"homepage-text-and-button"}> | ||
{props.finishedReviewing ? | ||
<p>You've got no vocabulary scheduled | ||
for today or you've already reviewed | ||
all of it. To start learning | ||
(more) words click below </p> : <p> | ||
Nice to see you! Click below to get | ||
started with your daily vocab | ||
review</p>} | ||
{props.finishedReviewing ? | ||
<button | ||
onClick={() => setShowPopUp(true)} | ||
onKeyDown={() => setShowPopUp(true)}> | ||
New vocabulary</button> | ||
: | ||
<button | ||
onClick={() => navigate("/review")} | ||
onKeyDown={() => navigate("/review")}>Review | ||
</button> | ||
} | ||
</article> | ||
{ | ||
showPopUp && props.vocabs && <NewVocabsPopUp | ||
vocabs={props.vocabs} | ||
setUseForm={props.setUseForm} | ||
setShowPopUp={setShowPopUp}/>} | ||
</div> | ||
) | ||
return (<div id={"homepage"}> | ||
<article id={"homepage-text-and-button"}> | ||
{props.finishedReviewing && props.language && | ||
<p>You've got no vocabulary scheduled | ||
for today or you've already reviewed | ||
all of it. To start learning | ||
(more) words click below </p>} | ||
|
||
{!props.finishedReviewing && props.language && | ||
<p>Nice to see you! Click below to get | ||
started with your daily vocab | ||
review</p>} | ||
{props.finishedReviewing && props.language && <button | ||
onClick={() => setShowPopUp(true)} | ||
onKeyDown={() => setShowPopUp(true)}> | ||
New vocabulary</button>} | ||
{!props.finishedReviewing && props.language && | ||
<button | ||
onClick={() => navigate("/review")} | ||
onKeyDown={() => navigate("/review")}>Review | ||
</button>} | ||
</article> | ||
{showPopUp && props.vocabs && <NewVocabsPopUp | ||
vocabs={props.vocabs} | ||
setUseForm={props.setUseForm} | ||
setShowPopUp={setShowPopUp}/>} | ||
{!props.language && | ||
<PickLanguagePopUp setLanguage={props.setLanguage}/>} | ||
|
||
</div>) | ||
} |