sokko-g/website/src/features/toolboxes/modules/TaskPlannerTopbar.jsx
Shinuwa c08452d5a4
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 17m38s
Validate and deploy Sokko G / deploy (push) Successful in 9s
Add quantitative tasks with checklist controls to the planner
2026-10-24 15:02:33 +02:00

49 lines
2.4 KiB
JavaScript

// Rôle : rend les contrôles fréquents et l'ajout rapide du planificateur de tâches.
import { CategoryAutocompleteInput } from "../../../components/CategoryAutocompleteInput.jsx";
import { Icon } from "../../../components/Icon.jsx";
import {
TASK_TYPES,
getTaskTypeLabel
} from "./taskPlannerUtils.js";
export function TaskPlannerTopbar({
data,
editing,
categoryOptions,
taskDraft,
textContent,
onAddTask,
onHideCompletedToggle
}) {
return (
<div className="task-planner-topbar">
<div className="task-planner-global-controls">
<button
className={`tool-split-scroll-toggle task-planner-hide-completed-toggle nds-switch ${data.hideCompleted ? "active" : ""}`}
data-size="lg"
type="button"
onClick={onHideCompletedToggle}
aria-pressed={data.hideCompleted}
aria-label={textContent.hideCompletedTitle || "Masquer les tâches effectuées"}
title={textContent.hideCompletedTitle || "Masquer les tâches effectuées"}
>
<Icon name={data.hideCompleted ? "eye-closed" : "eye-open"} />
<i aria-hidden="true" />
</button>
</div>
{editing && (
<div className="task-planner-add-stack">
<form className="inline-form task-planner-add-form" onSubmit={onAddTask}>
<input {...taskDraft.getFieldProps("title", { className: "nds-input", "data-size": "sm", type: "text", placeholder: textContent.titlePlaceholder || "Nouvelle tâche" })} />
<CategoryAutocompleteInput {...taskDraft.getFieldProps("category", { className: "nds-input", "data-size": "sm", placeholder: textContent.categoryPlaceholder || "Nom de catégorie" })} options={categoryOptions} />
<select {...taskDraft.getFieldProps("type", { className: "nds-select", "data-size": "sm", "aria-label": textContent.typeLabel || "Type" })}>
{TASK_TYPES.map((taskType) => <option key={taskType} value={taskType}>{getTaskTypeLabel(taskType, textContent)}</option>)}
</select>
<input {...taskDraft.getFieldProps("qtyTarget", { className: "task-planner-quantity-target nds-input", "data-size": "sm", type: "number", min: 1, step: 1, "aria-label": textContent.quantityLabel, title: textContent.quantityLabel })} />
<button className="nds-button" data-size="sm" data-variant="primary">{textContent.addButton || "Ajouter"}</button>
</form>
</div>
)}
</div>
);
}