1
Fork 0
mirror of https://github.com/Steffo99/todocolors.git synced 2024-11-22 00:04:18 +00:00

Pass lang down

This commit is contained in:
Steffo 2024-09-13 23:43:28 +02:00
parent 8de6ddebb4
commit a39ec41a19
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
4 changed files with 5 additions and 4 deletions

View file

@ -12,7 +12,7 @@ import {SyntheticEvent, useCallback} from "react"
import style from "./TaskEditor.module.css" import style from "./TaskEditor.module.css"
export function TaskEditor({t, className, editorHook: {input, setInput, task, setTask}}: { t: TFunction, className?: string, editorHook: ReturnType<typeof useTaskEditor> }) { export function TaskEditor({lang, t, className, editorHook: {input, setInput, task, setTask}}: { lang: string, t: TFunction, className?: string, editorHook: ReturnType<typeof useTaskEditor> }) {
const {isReady, sendRequest} = useBoardConsumer() const {isReady, sendRequest} = useBoardConsumer()
const nextIcon = useCallback((e: SyntheticEvent<HTMLButtonElement>) => { const nextIcon = useCallback((e: SyntheticEvent<HTMLButtonElement>) => {
@ -33,7 +33,7 @@ export function TaskEditor({t, className, editorHook: {input, setInput, task, se
return return
} }
sendRequest({"Task": [null, task]}) sendRequest({"Task": [null, task]})
setInput(taskToString({...task, text: ""})) setInput(taskToString({...task, text: ""}, lang))
}, [sendRequest, task, setInput]) }, [sendRequest, task, setInput])
if(!isReady) { if(!isReady) {

View file

@ -6,7 +6,7 @@ import {TFunction} from "i18next"
import style from "./BoardEditor.module.css" import style from "./BoardEditor.module.css"
export function BoardEditor({className, t, editorHook}: {className?: string, t: TFunction, editorHook: ReturnType<typeof useTaskEditor>}) { export function BoardEditor({className, lang, t, editorHook}: {className?: string, lang: string, t: TFunction, editorHook: ReturnType<typeof useTaskEditor>}) {
const {boardState: {locked}} = useBoardConsumer() const {boardState: {locked}} = useBoardConsumer()
if(locked) return null; if(locked) return null;

View file

@ -37,6 +37,7 @@ export function BoardPage({lang}: {lang: string}) {
setEditorInput={editorHook.setInput} setEditorInput={editorHook.setInput}
/> />
<BoardEditor <BoardEditor
lang={lang}
t={t} t={t}
className={style.pageEditor} className={style.pageEditor}
editorHook={editorHook} editorHook={editorHook}

2
todored/Cargo.lock generated
View file

@ -1151,7 +1151,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "todored" name = "todored"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"axum", "axum",
"chrono", "chrono",