task detail attachment form
This commit is contained in:
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user