diff --git a/src/components/routes/create-plan/CreatePlan.test.tsx b/src/components/routes/create-plan/CreatePlan.test.tsx index 63ead223..3351247e 100644 --- a/src/components/routes/create-plan/CreatePlan.test.tsx +++ b/src/components/routes/create-plan/CreatePlan.test.tsx @@ -320,7 +320,7 @@ describe("CreatePlan Component", () => { const tagInput = screen.getByPlaceholderText("Add a tag"); fireEvent.change(tagInput, { target: { value: "tag1" } }); fireEvent.keyDown(tagInput, { key: "Enter", code: "Enter" }); - expect(screen.getByText("tag1")).toBeInTheDocument(); + expect(screen.getByText("Tag1")).toBeInTheDocument(); }); it("shows no image preview initially", () => { diff --git a/src/components/routes/task/api/taskApi.ts b/src/components/routes/task/api/taskApi.ts index 7c37ee27..c4f5ce69 100644 --- a/src/components/routes/task/api/taskApi.ts +++ b/src/components/routes/task/api/taskApi.ts @@ -46,7 +46,7 @@ export const createSubTasks = async ( duration?: string; source_text_id?: string | null; pecha_segment_id?: string | null; - segment_id?: string | null; + segment_ids?: string[] | null; }[], ) => { const { data } = await axiosInstance.post( @@ -72,7 +72,7 @@ export const updateSubTasks = async ( duration?: string; source_text_id?: string | null; pecha_segment_id?: string | null; - segment_id?: string | null; + segment_ids?: string[] | null; }[], ) => { await axiosInstance.put( diff --git a/src/components/routes/task/components/view/TaskForm.tsx b/src/components/routes/task/components/view/TaskForm.tsx index d4ba6a5b..6ecb94d6 100644 --- a/src/components/routes/task/components/view/TaskForm.tsx +++ b/src/components/routes/task/components/view/TaskForm.tsx @@ -84,7 +84,7 @@ const TaskForm = ({ ...(subTask.content_type === "SOURCE_REFERENCE" && { source_text_id: subTask.source_text_id || null, pecha_segment_id: subTask.pecha_segment_id || null, - segment_id: subTask.segment_id || null, + segment_ids: subTask.segment_ids || null, }), })); await createSubTasks(taskResponse.id, subTasksPayload); @@ -117,7 +117,7 @@ const TaskForm = ({ ...(subTask.content_type === "SOURCE_REFERENCE" && { source_text_id: subTask.source_text_id || null, pecha_segment_id: subTask.pecha_segment_id || null, - segment_id: subTask.segment_id || null, + segment_ids: subTask.segment_ids || null, }), })); await updateSubTasks(editingTask.id, subTasksPayload); @@ -194,7 +194,7 @@ const TaskForm = ({ content: data.content, source_text_id: data.source_text_id || null, pecha_segment_id: data.pecha_segment_id || null, - segment_id: data.segment_id || null, + segment_ids: data.segment_ids || null, }; default: return { @@ -212,7 +212,7 @@ const TaskForm = ({ content: string; pecha_segment_id: string; text_id: string; - segment_id: string; + segment_ids: string[]; } const handleAddSubTask = (content_type: any, sourceData?: SourceData) => { @@ -256,7 +256,7 @@ const TaskForm = ({ content: sourceData?.content || "", source_text_id: sourceData?.text_id || null, pecha_segment_id: sourceData?.pecha_segment_id || null, - segment_id: sourceData?.segment_id || null, + segment_ids: sourceData?.segment_ids || null, }; break; } diff --git a/src/components/ui/molecules/content-sub/ContentTypeSelector.tsx b/src/components/ui/molecules/content-sub/ContentTypeSelector.tsx index 62d6e135..ed145a5a 100644 --- a/src/components/ui/molecules/content-sub/ContentTypeSelector.tsx +++ b/src/components/ui/molecules/content-sub/ContentTypeSelector.tsx @@ -10,7 +10,7 @@ interface SourceData { content: string; pecha_segment_id: string; text_id: string; - segment_id: string; + segment_ids: string[]; } interface ContentTypeSelectorProps { diff --git a/src/components/ui/molecules/subtask-card/SubTaskCard.tsx b/src/components/ui/molecules/subtask-card/SubTaskCard.tsx index 92c2b449..f88e4749 100644 --- a/src/components/ui/molecules/subtask-card/SubTaskCard.tsx +++ b/src/components/ui/molecules/subtask-card/SubTaskCard.tsx @@ -46,7 +46,7 @@ interface SourceSubTask { display_order?: number; source_text_id?: string | null; pecha_segment_id?: string | null; - segment_id?: string | null; + segment_ids?: string[] | null; } export type SubTask = | VideoSubTask diff --git a/src/components/ui/molecules/tag-input/TagInput.tsx b/src/components/ui/molecules/tag-input/TagInput.tsx index ab6e5f5a..5c860010 100644 --- a/src/components/ui/molecules/tag-input/TagInput.tsx +++ b/src/components/ui/molecules/tag-input/TagInput.tsx @@ -13,7 +13,13 @@ const TagInput = ({ value = [], onChange }: TagInputProps) => { const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === "Enter" && inputValue.trim()) { e.preventDefault(); - onChange?.([inputValue.trim(), ...value]); + const trimmed = inputValue.trim(); + const normalizedTag = + trimmed.charAt(0).toUpperCase() + trimmed.slice(1).toLowerCase(); + + if (!value.includes(normalizedTag)) { + onChange?.([normalizedTag, ...value]); + } setInputValue(""); } }; diff --git a/src/components/ui/molecules/webuddhist-source/SourceSelectorSheet.tsx b/src/components/ui/molecules/webuddhist-source/SourceSelectorSheet.tsx index 5a0ef26c..d75d9248 100644 --- a/src/components/ui/molecules/webuddhist-source/SourceSelectorSheet.tsx +++ b/src/components/ui/molecules/webuddhist-source/SourceSelectorSheet.tsx @@ -13,7 +13,7 @@ interface SourceData { content: string; pecha_segment_id: string; text_id: string; - segment_id: string; + segment_ids: string[]; } interface SourceSelectorSheetProps { diff --git a/src/components/ui/molecules/webuddhist-source/sourceItem.tsx b/src/components/ui/molecules/webuddhist-source/sourceItem.tsx index 9cc49b62..aafeb49a 100644 --- a/src/components/ui/molecules/webuddhist-source/sourceItem.tsx +++ b/src/components/ui/molecules/webuddhist-source/sourceItem.tsx @@ -19,7 +19,7 @@ const SourceItem = ({ source, onSegment }: any) => { content: segment.content, pecha_segment_id: segment.pecha_segment_id, text_id: source.text.text_id, - segment_id: segment.segment_id, + segment_ids: [segment.segment_id], }) } >