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:
parent
cd05b15c7b
commit
1b6306b03c
2 changed files with 4 additions and 2 deletions
|
@ -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}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -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])
|
||||||
|
|
Loading…
Reference in a new issue