diff --git a/src/doing/Clock.jsx b/src/doing/Clock.jsx index 7cf5245..6aa2aed 100644 --- a/src/doing/Clock.jsx +++ b/src/doing/Clock.jsx @@ -5,7 +5,7 @@ import './Clock.css' export const Clock = () => { const store = Store() - const text = store.language.current === "english" ? store.language.text().english : store.language.text().spanish + const text = store.configs.language.current === "english" ? store.configs.language.text().english : store.configs.language.text().spanish const countdownRef = useRef(null) const audioStart = new Audio('/start.mp3') const audioAlarm = new Audio('/clock_alarm.mp3') diff --git a/src/doing/Doing.jsx b/src/doing/Doing.jsx index 3526e6c..712ed57 100644 --- a/src/doing/Doing.jsx +++ b/src/doing/Doing.jsx @@ -5,7 +5,7 @@ import { Footer } from './Footer.jsx' export const Doing = () => { const store = Store() - const text = store.language.current === "english" ? store.language.text().english : store.language.text().spanish + const text = store.configs.language.current === "english" ? store.configs.language.text().english : store.configs.language.text().spanish return (
diff --git a/src/doing/Footer.jsx b/src/doing/Footer.jsx index 8082dbb..9855c61 100644 --- a/src/doing/Footer.jsx +++ b/src/doing/Footer.jsx @@ -9,7 +9,7 @@ export const Footer = () => { const [show3, setShow3] = useState(false) // "CONFIRM OR CANCEL" RESETING DIALOG (show or hide) const [show4, setShow4] = useState(true) // "RESET TOTAL WORKED HOURS" BUTTON (show or hide) // catch english or spanish json texts, this change when the user clicks on change language buttons - const text = store.language.current === "english" ? store.language.text().english : store.language.text().spanish + const text = store.configs.language.current === "english" ? store.configs.language.text().english : store.configs.language.text().spanish const infoBtn = () => (setShow1(!show1), setShow2(false), setShow3(false), setShow4(true)) const settingsBtn = () => (setShow2(!show2), setShow1(false), setShow3(false), setShow4(true)) @@ -19,7 +19,7 @@ export const Footer = () => { useEffect(() => localStorage.setItem("infoVisibility", show1), [show1]) useEffect(() => localStorage.setItem("settingsVisibility", show2), [show2]) - useEffect(() => localStorage.setItem("currentLanguage", store.language.current), [store.language]) + useEffect(() => localStorage.setItem("currentLanguage", store.configs.language.current), [store.configs.language]) return (
@@ -48,8 +48,8 @@ export const Footer = () => {
{text.doing.footer.settings.language.message} - - + +
{text.doing.footer.settings.theme.message} @@ -58,7 +58,7 @@ export const Footer = () => {
{text.doing.footer.settings.commonTasks.message} - LEARN x_____CODE x_____AdivLY x + LEARN x_____CODE x_____APPLY x
diff --git a/src/doing/Quote.jsx b/src/doing/Quote.jsx index 591e33f..3a04bde 100644 --- a/src/doing/Quote.jsx +++ b/src/doing/Quote.jsx @@ -19,7 +19,7 @@ export const Quote = () => { maxLength: 70, } }) - if (store.language.current === "spanish") await translateQuote(response.data.content) + if (store.configs.language.current === "spanish") await translateQuote(response.data.content) else setQuote(response.data.content) setAuthor(response.data.author) } diff --git a/src/done/Done.jsx b/src/done/Done.jsx index 4a38b5f..22d6df1 100644 --- a/src/done/Done.jsx +++ b/src/done/Done.jsx @@ -4,7 +4,7 @@ import './Done.css' export const Done = () => { const store = Store() - const text = store.language.current === "english" ? store.language.text().english : store.language.text().spanish + const text = store.configs.language.current === "english" ? store.configs.language.text().english : store.configs.language.text().spanish const [input, setInput] = useState("") const [showModal, setShowModal] = useState("hide") const [showFooter, setShowFooter] = useState("") diff --git a/src/store/language.js b/src/store/language.js index 73967f1..5081e96 100644 --- a/src/store/language.js +++ b/src/store/language.js @@ -146,9 +146,12 @@ export const text = { } export const setCurrent = (set, language) => set(state => ({ - language: { - ...state.language, - current: language + configs: { + ...state.configs, + language: { + ...state.configs.language, + current: language + } } -}), false, 'language/setCurrent') +}), false, 'configs/language/setCurrent') diff --git a/src/store/store.js b/src/store/store.js index 4d02615..e037344 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -56,10 +56,17 @@ const tasksSlice = (set, get) => ({ resetWorkedHoursHistory: () => resetWorkedHoursHistory(set) }) -const languageSlice = (set) => ({ - current: localStorage.getItem("currentLanguage") || "english", - setCurrent: (language) => setCurrent(set, language), - text: () => text +const configurationOptionsSlice = (set) => ({ + language: { + current: localStorage.getItem("currentLanguage") || "english", + setCurrent: (language) => setCurrent(set, language), + text: () => text + }, + commonTasks: { + // currents: [], + // add: ()=>(), + // remove: ()=>() + } }) export const Store = create(devtools((set, get) => ({ @@ -67,5 +74,5 @@ export const Store = create(devtools((set, get) => ({ weekly: todoWeeklySlice(set, get), monthly: todoMonthlySlice(set, get), tasks: tasksSlice(set, get), - language: languageSlice(set) + configs: configurationOptionsSlice(set) }))) \ No newline at end of file diff --git a/src/todo/Todos.jsx b/src/todo/Todos.jsx index eb8d843..95ec439 100644 --- a/src/todo/Todos.jsx +++ b/src/todo/Todos.jsx @@ -3,10 +3,10 @@ import { Todo } from './Todo.jsx' export const Todos = () => { const store = Store() - const title = store.language.current === "english" + const title = store.configs.language.current === "english" ? ["Daily Goals", "Weekly Goals", "Monthly Goals"] : ["Objetivos Diarios", "Objetivos Semanales", "Objetivos Mensuales"] - const text = store.language.current === "english" ? store.language.text().english : store.language.text().spanish + const text = store.configs.language.current === "english" ? store.configs.language.text().english : store.configs.language.text().spanish return (

{text.todo.title}