"use client"; import { useTranslations } from "next-intl"; import { Plus, Trash2 } from "lucide-react"; import type { ObjectiveBlockData, ObjectiveItem } from "../../types"; import { Button } from "@/shared/components/ui/button"; interface Props { data: ObjectiveBlockData; onUpdate: (data: ObjectiveBlockData) => void; } const DIMENSIONS: ObjectiveItem["dimension"][] = ["knowledge", "process", "emotion"]; export function ObjectiveBlock({ data, onUpdate }: Props) { const t = useTranslations("lessonPreparation"); function updateItem(index: number, patch: Partial) { const next = data.objectives.map((it, i) => i === index ? { ...it, ...patch } : it, ); onUpdate({ ...data, objectives: next }); } function addItem() { onUpdate({ ...data, objectives: [ ...data.objectives, { dimension: "knowledge", text: "" }, ], }); } function removeItem(index: number) { onUpdate({ ...data, objectives: data.objectives.filter((_, i) => i !== index), }); } return (
{t("objective.hint")}
{data.objectives.map((item, idx) => (