mirror of
https://github.com/FranP-code/Hangman-game-with-React.git
synced 2025-10-13 00:42:32 +00:00
bug fix
This commit is contained in:
@@ -182,7 +182,7 @@ function App() {
|
|||||||
languageIsReady ?
|
languageIsReady ?
|
||||||
|
|
||||||
<div className='categories-container'>
|
<div className='categories-container'>
|
||||||
<Categories currentScore={currentScore} displayCategories={displayCategories} language={language} category={category} setCategory={setCategory} categoryIsReady={categoryIsReady} setLanguage={setLanguage}/>
|
<Categories currentScore={currentScore} displayCategories={displayCategories} AppLanguage={language} category={category} setCategory={setCategory} categoryIsReady={categoryIsReady} setLanguage={setLanguage}/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
:null
|
:null
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
|
import capitalize from "../../General Scripts/Capilazate"
|
||||||
import AlmacenateCategory from "../../Storage Scripts/AlmacenateCategory"
|
import AlmacenateCategory from "../../Storage Scripts/AlmacenateCategory"
|
||||||
import AlmacenateCurrentScore from "../../Storage Scripts/AlmacenateCurrentScore"
|
import AlmacenateCurrentScore from "../../Storage Scripts/AlmacenateCurrentScore"
|
||||||
import { AlmacenateLanguage } from "../../Storage Scripts/AlmacenateLanguage"
|
import { AlmacenateLanguage } from "../../Storage Scripts/AlmacenateLanguage"
|
||||||
@@ -8,7 +9,7 @@ import Bring_All_Languages from "./Firebase Querys/Bring All Languages"
|
|||||||
import images from "./Images"
|
import images from "./Images"
|
||||||
|
|
||||||
|
|
||||||
const Categories = ({language, displayCategories, category, setCategory, currentScore, setLanguage}) => {
|
const Categories = ({AppLanguage, displayCategories, category, setCategory, currentScore, setLanguage}, props) => {
|
||||||
|
|
||||||
const [categories, setCategories] = React.useState(false)
|
const [categories, setCategories] = React.useState(false)
|
||||||
const [languages, setLanguages] = React.useState(false)
|
const [languages, setLanguages] = React.useState(false)
|
||||||
@@ -23,7 +24,7 @@ const Categories = ({language, displayCategories, category, setCategory, current
|
|||||||
localStorage.setItem('category', categorie)
|
localStorage.setItem('category', categorie)
|
||||||
|
|
||||||
AlmacenateCurrentScore(currentScore)
|
AlmacenateCurrentScore(currentScore)
|
||||||
AlmacenateLanguage(language)
|
AlmacenateLanguage(AppLanguage)
|
||||||
|
|
||||||
window.location.reload(true)
|
window.location.reload(true)
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ const Categories = ({language, displayCategories, category, setCategory, current
|
|||||||
|
|
||||||
React.useEffect (() => {
|
React.useEffect (() => {
|
||||||
|
|
||||||
Bring_All_Categories(setCategories, setStrech, language, category)
|
Bring_All_Categories(setCategories, setStrech, AppLanguage, category)
|
||||||
Bring_All_Languages(setLanguages)
|
Bring_All_Languages(setLanguages)
|
||||||
|
|
||||||
console.log(categories)
|
console.log(categories)
|
||||||
@@ -60,8 +61,16 @@ const Categories = ({language, displayCategories, category, setCategory, current
|
|||||||
languages.length > 0 ?
|
languages.length > 0 ?
|
||||||
|
|
||||||
languages.map((language) => {
|
languages.map((language) => {
|
||||||
|
|
||||||
return <option key={language} value={language}> {language.toUpperCase()} </option>
|
console.log(AppLanguage);
|
||||||
|
|
||||||
|
if (language === capitalize(AppLanguage)) {
|
||||||
|
|
||||||
|
return <option key={language} value={language} selected > {language.toUpperCase()} </option>
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return <option key={language} value={language}> {language.toUpperCase()} </option>
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
: null
|
: null
|
||||||
|
|||||||
Reference in New Issue
Block a user