1
Fork 0
mirror of https://github.com/Steffo99/todocolors.git synced 2024-11-29 03:24:30 +00:00

Pass lang down

This commit is contained in:
Steffo 2024-09-14 00:19:13 +02:00
parent cd05b15c7b
commit 1b6306b03c
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 4 additions and 2 deletions

View file

@ -104,6 +104,7 @@ export function TaskViewer({lang, t, taskWithId: [id, task], setEditorInput}: {l
goAwayButton = ( goAwayButton = (
<TaskViewerRecreateButton <TaskViewerRecreateButton
t={t} t={t}
lang={lang}
taskWithId={[id, task]} taskWithId={[id, task]}
setEditorInput={setEditorInput} setEditorInput={setEditorInput}
/> />

View file

@ -10,12 +10,13 @@ import {Dispatch, SetStateAction, SyntheticEvent, useCallback} from "react"
export type TaskViewerRecreateButtonProps = { export type TaskViewerRecreateButtonProps = {
t: TFunction, t: TFunction,
lang: string,
taskWithId: TaskWithId, taskWithId: TaskWithId,
setEditorInput: Dispatch<SetStateAction<string>>, setEditorInput: Dispatch<SetStateAction<string>>,
} }
export function TaskViewerRecreateButton({t, taskWithId: [id, task], setEditorInput}: TaskViewerRecreateButtonProps) { export function TaskViewerRecreateButton({t, lang, taskWithId: [id, task], setEditorInput}: TaskViewerRecreateButtonProps) {
const {sendRequest, boardState: {locked}} = useBoardConsumer() const {sendRequest, boardState: {locked}} = useBoardConsumer()
const recreateTask = useCallback((e: SyntheticEvent<HTMLButtonElement>) => { const recreateTask = useCallback((e: SyntheticEvent<HTMLButtonElement>) => {
@ -26,7 +27,7 @@ export function TaskViewerRecreateButton({t, taskWithId: [id, task], setEditorIn
} }
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
setEditorInput(taskToString(task)) setEditorInput(taskToString(task, lang))
const request: DeleteTaskBoardRequest = {"Task": [id, null]}; const request: DeleteTaskBoardRequest = {"Task": [id, null]};
sendRequest(request) sendRequest(request)
}, [task, setEditorInput, sendRequest]) }, [task, setEditorInput, sendRequest])