Improved doc structure and direct notes for board view
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import { Workspace } from "@/hooks/workspace";
|
import { Workspace } from "@/hooks/workspace";
|
||||||
import { Task } from "@/lib/types";
|
import { Task } from "@/lib/types";
|
||||||
import TaskView from "./view/TaskView";
|
import TaskView from "./view/TaskView";
|
||||||
import DocView from "./view/Doc";
|
import DocView from "./view/DocView";
|
||||||
|
|
||||||
const id = (prefix = "t") =>
|
const id = (prefix = "t") =>
|
||||||
`${prefix}_${Math.random().toString(36).slice(2, 9)}`;
|
`${prefix}_${Math.random().toString(36).slice(2, 9)}`;
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ import { SheetTrigger } from "@/components/ui/sheet";
|
|||||||
import { Task } from "@/lib/types";
|
import { Task } from "@/lib/types";
|
||||||
import { Color, getColor } from "@/lib/ui/color";
|
import { Color, getColor } from "@/lib/ui/color";
|
||||||
import { DraggableProvided } from "@hello-pangea/dnd";
|
import { DraggableProvided } from "@hello-pangea/dnd";
|
||||||
import TaskEdit from "../TaskEdit";
|
import TaskEdit from "../edit/TaskEdit";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { NotepadText } from "lucide-react";
|
||||||
|
import DocDialog from "../edit/DocDialog";
|
||||||
|
|
||||||
export default function BoardTask({
|
export default function BoardTask({
|
||||||
task,
|
task,
|
||||||
@@ -33,7 +36,21 @@ export default function BoardTask({
|
|||||||
className="bg-background"
|
className="bg-background"
|
||||||
>
|
>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>{task.title}</CardTitle>
|
<CardTitle className="flex items-center justify-between">
|
||||||
|
<span>{task.title}</span>
|
||||||
|
<DocDialog task={task} setTask={setTask} tags={tags}>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
className="ml-auto"
|
||||||
|
variant="outline"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<NotepadText />
|
||||||
|
</Button>
|
||||||
|
</DocDialog>
|
||||||
|
</CardTitle>
|
||||||
<CardDescription>{task.description}</CardDescription>
|
<CardDescription>{task.description}</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="flex flex-wrap gap-1.5 overflow-hidden">
|
<CardContent className="flex flex-wrap gap-1.5 overflow-hidden">
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogDescription,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
DialogTrigger,
|
||||||
|
} from "@/components/ui/dialog";
|
||||||
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
|
import DocView from "../DocView";
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
|
import { Task } from "@/lib/types";
|
||||||
|
import { Color, getColor } from "@/lib/ui/color";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { OutputData } from "@editorjs/editorjs";
|
||||||
|
|
||||||
|
export default function DocDialog({
|
||||||
|
task,
|
||||||
|
setTask,
|
||||||
|
tags,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
task: Task;
|
||||||
|
setTask: (t: Task) => void;
|
||||||
|
tags: Record<string, { color: Color; name: string }>;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
const [doc, setDoc] = useState<OutputData>({ blocks: [] });
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog>
|
||||||
|
<DialogTrigger asChild>{children}</DialogTrigger>
|
||||||
|
<DialogContent className="max-h-[80vh] md:max-w-3xl! lg:max-w-4xl!">
|
||||||
|
<DialogTitle>{task.title} - Notes</DialogTitle>
|
||||||
|
<DialogDescription>{task.description}</DialogDescription>
|
||||||
|
<DialogHeader>
|
||||||
|
<div className="flex flex-wrap gap-1.5 overflow-hidden">
|
||||||
|
{task.tags?.map((tag, i) => (
|
||||||
|
<Badge
|
||||||
|
key={tag}
|
||||||
|
variant="outline"
|
||||||
|
style={getColor(tags[tag].color)}
|
||||||
|
>
|
||||||
|
{tag}
|
||||||
|
</Badge>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</DialogHeader>
|
||||||
|
|
||||||
|
<ScrollArea className="h-[60vh]">
|
||||||
|
<DocView key={0} doc={doc} setDoc={setDoc} />
|
||||||
|
</ScrollArea>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -11,20 +11,21 @@ import {
|
|||||||
import { Task } from "@/lib/types";
|
import { Task } from "@/lib/types";
|
||||||
import { Color, getColor } from "@/lib/ui/color";
|
import { Color, getColor } from "@/lib/ui/color";
|
||||||
import { DraggableProvided } from "@hello-pangea/dnd";
|
import { DraggableProvided } from "@hello-pangea/dnd";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../../ui/button";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogDescription,
|
DialogDescription,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTrigger,
|
DialogTrigger,
|
||||||
} from "../ui/dialog";
|
} from "../../ui/dialog";
|
||||||
import DocView from "./Doc";
|
import DocView from "../DocView";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { OutputData } from "@editorjs/editorjs";
|
import { OutputData } from "@editorjs/editorjs";
|
||||||
import { DialogTitle } from "@radix-ui/react-dialog";
|
import { DialogTitle } from "@radix-ui/react-dialog";
|
||||||
import { ScrollArea } from "../ui/scroll-area";
|
import { ScrollArea } from "../../ui/scroll-area";
|
||||||
import { Badge } from "../ui/badge";
|
import { Badge } from "../../ui/badge";
|
||||||
|
import DocDialog from "./DocDialog";
|
||||||
|
|
||||||
export default function TaskEdit({
|
export default function TaskEdit({
|
||||||
task,
|
task,
|
||||||
@@ -37,8 +38,6 @@ export default function TaskEdit({
|
|||||||
tags: Record<string, { color: Color; name: string }>;
|
tags: Record<string, { color: Color; name: string }>;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const [doc, setDoc] = useState<OutputData>({ blocks: [] });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sheet>
|
<Sheet>
|
||||||
{children}
|
{children}
|
||||||
@@ -83,32 +82,9 @@ export default function TaskEdit({
|
|||||||
</div>
|
</div>
|
||||||
<div className="grid gap-3">
|
<div className="grid gap-3">
|
||||||
<Label>Notes</Label>
|
<Label>Notes</Label>
|
||||||
<Dialog>
|
<DocDialog task={task} setTask={setTask} tags={tags}>
|
||||||
<DialogTrigger asChild>
|
|
||||||
<Button>Open notes</Button>
|
<Button>Open notes</Button>
|
||||||
</DialogTrigger>
|
</DocDialog>
|
||||||
<DialogContent className="max-h-[80vh] md:max-w-3xl! lg:max-w-4xl!">
|
|
||||||
<DialogTitle>{task.title} - Notes</DialogTitle>
|
|
||||||
<DialogDescription>{task.description}</DialogDescription>
|
|
||||||
<DialogHeader>
|
|
||||||
<div className="flex flex-wrap gap-1.5 overflow-hidden">
|
|
||||||
{task.tags?.map((tag, i) => (
|
|
||||||
<Badge
|
|
||||||
key={tag}
|
|
||||||
variant="outline"
|
|
||||||
style={getColor(tags[tag].color)}
|
|
||||||
>
|
|
||||||
{tag}
|
|
||||||
</Badge>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
<ScrollArea className="h-[60vh]">
|
|
||||||
<DocView key={0} doc={doc} setDoc={setDoc} />
|
|
||||||
</ScrollArea>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</SheetContent>
|
</SheetContent>
|
||||||
@@ -3,7 +3,7 @@ import { SheetTrigger } from "@/components/ui/sheet";
|
|||||||
import { TableCell, TableRow } from "@/components/ui/table";
|
import { TableCell, TableRow } from "@/components/ui/table";
|
||||||
import { Task } from "@/lib/types";
|
import { Task } from "@/lib/types";
|
||||||
import { Color, getColor } from "@/lib/ui/color";
|
import { Color, getColor } from "@/lib/ui/color";
|
||||||
import TaskEdit from "../TaskEdit";
|
import TaskEdit from "../edit/TaskEdit";
|
||||||
|
|
||||||
export default function TableTask({
|
export default function TableTask({
|
||||||
task,
|
task,
|
||||||
|
|||||||
Reference in New Issue
Block a user