task detail attachment form

This commit is contained in:
hamid zarghami
2026-06-17 15:34:47 +03:30
parent 707908fe03
commit 92033fb94c
6 changed files with 130 additions and 4 deletions
@@ -1,4 +1,5 @@
import { type FC, useState } from "react";
import TaskDetailAttachmentPopover from "./attachment/TaskDetailAttachmentPopover";
import { DEFAULT_CHECKLISTS } from "./checklist/constants";
import TaskDetailChecklistPopover from "./checklist/TaskDetailChecklistPopover";
import type { TaskChecklist } from "./checklist/types";
@@ -28,6 +29,7 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange }) => {
const isLabelsOpen = activeTab === "labels";
const isUsersOpen = activeTab === "users";
const isChecklistOpen = activeTab === "checklist";
const isAttachmentOpen = activeTab === "attachment";
const handleTabChange = (tab: TaskDetailTab) => {
if (tab === "labels" && activeTab !== "labels") {
@@ -84,6 +86,14 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange }) => {
handleChecklistClose();
};
const handleAttachmentClose = () => {
if (isAttachmentOpen) onTabChange("attachment");
};
const handleAttachmentCreate = (_data: { file?: File; title: string; linkId: string }) => {
handleAttachmentClose();
};
return (
<div className="relative">
<TaskDetailActionBar
@@ -115,6 +125,11 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange }) => {
/>
) : null
}
attachmentPopover={
isAttachmentOpen ? (
<TaskDetailAttachmentPopover onClose={handleAttachmentClose} onSubmit={handleAttachmentCreate} />
) : null
}
/>
<TaskDetailMetadataPreview selectedLabels={selectedLabels} selectedUsers={selectedUsers} />