2026-02-18 16:46:55 -06:00
|
|
|
import { useState, useRef, useEffect, useCallback } from "react";
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
import { cn } from "../lib/utils";
|
2026-03-13 21:30:48 -05:00
|
|
|
import { MarkdownEditor, type MarkdownEditorRef, type MentionOption } from "./MarkdownEditor";
|
|
|
|
|
import { useAutosaveIndicator } from "../hooks/useAutosaveIndicator";
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
|
|
|
|
|
interface InlineEditorProps {
|
|
|
|
|
value: string;
|
2026-03-13 21:30:48 -05:00
|
|
|
onSave: (value: string) => void | Promise<unknown>;
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
as?: "h1" | "h2" | "p" | "span";
|
|
|
|
|
className?: string;
|
|
|
|
|
placeholder?: string;
|
|
|
|
|
multiline?: boolean;
|
Add MarkdownEditor component, asset image upload, and rich description editing
Introduce MarkdownEditor built on @mdxeditor/editor with headings,
lists, links, quotes, image upload with drag-and-drop, and themed CSS
integration. Add asset image upload API (routes, service, storage) and
wire image upload into InlineEditor multiline mode, NewIssueDialog,
NewProjectDialog, GoalDetail, IssueDetail, and ProjectDetail
description fields. Tighten prompt template editor styling.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:50:45 -06:00
|
|
|
imageUploadHandler?: (file: File) => Promise<string>;
|
2026-03-02 13:31:58 -06:00
|
|
|
mentions?: MentionOption[];
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
}
|
|
|
|
|
|
2026-02-18 16:46:55 -06:00
|
|
|
/** Shared padding so display and edit modes occupy the exact same box. */
|
|
|
|
|
const pad = "px-1 -mx-1";
|
2026-03-13 21:30:48 -05:00
|
|
|
const markdownPad = "px-1";
|
|
|
|
|
const AUTOSAVE_DEBOUNCE_MS = 900;
|
2026-02-18 16:46:55 -06:00
|
|
|
|
2026-04-04 14:05:08 -05:00
|
|
|
export function queueContainedBlurCommit(container: HTMLDivElement, onCommit: () => void) {
|
|
|
|
|
let frameId = requestAnimationFrame(() => {
|
|
|
|
|
frameId = requestAnimationFrame(() => {
|
|
|
|
|
frameId = 0;
|
|
|
|
|
const active = document.activeElement;
|
|
|
|
|
if (active instanceof Node && container.contains(active)) return;
|
|
|
|
|
onCommit();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
if (frameId === 0) return;
|
|
|
|
|
cancelAnimationFrame(frameId);
|
|
|
|
|
frameId = 0;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
export function InlineEditor({
|
|
|
|
|
value,
|
|
|
|
|
onSave,
|
|
|
|
|
as: Tag = "span",
|
|
|
|
|
className,
|
|
|
|
|
placeholder = "Click to edit...",
|
|
|
|
|
multiline = false,
|
Add MarkdownEditor component, asset image upload, and rich description editing
Introduce MarkdownEditor built on @mdxeditor/editor with headings,
lists, links, quotes, image upload with drag-and-drop, and themed CSS
integration. Add asset image upload API (routes, service, storage) and
wire image upload into InlineEditor multiline mode, NewIssueDialog,
NewProjectDialog, GoalDetail, IssueDetail, and ProjectDetail
description fields. Tighten prompt template editor styling.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:50:45 -06:00
|
|
|
imageUploadHandler,
|
2026-03-02 13:31:58 -06:00
|
|
|
mentions,
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
}: InlineEditorProps) {
|
|
|
|
|
const [editing, setEditing] = useState(false);
|
2026-03-13 21:30:48 -05:00
|
|
|
const [multilineFocused, setMultilineFocused] = useState(false);
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
const [draft, setDraft] = useState(value);
|
2026-02-25 21:36:06 -06:00
|
|
|
const inputRef = useRef<HTMLTextAreaElement>(null);
|
2026-03-13 21:30:48 -05:00
|
|
|
const markdownRef = useRef<MarkdownEditorRef>(null);
|
|
|
|
|
const autosaveDebounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
2026-04-04 14:05:08 -05:00
|
|
|
const blurCommitFrameRef = useRef<(() => void) | null>(null);
|
2026-03-13 21:30:48 -05:00
|
|
|
const {
|
|
|
|
|
state: autosaveState,
|
|
|
|
|
markDirty,
|
|
|
|
|
reset,
|
|
|
|
|
runSave,
|
|
|
|
|
} = useAutosaveIndicator();
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
2026-03-13 21:30:48 -05:00
|
|
|
if (multiline && multilineFocused) return;
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
setDraft(value);
|
2026-03-13 21:30:48 -05:00
|
|
|
}, [value, multiline, multilineFocused]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
return () => {
|
|
|
|
|
if (autosaveDebounceRef.current) {
|
|
|
|
|
clearTimeout(autosaveDebounceRef.current);
|
|
|
|
|
}
|
2026-04-04 14:05:08 -05:00
|
|
|
if (blurCommitFrameRef.current !== null) {
|
|
|
|
|
blurCommitFrameRef.current();
|
|
|
|
|
blurCommitFrameRef.current = null;
|
|
|
|
|
}
|
2026-03-13 21:30:48 -05:00
|
|
|
};
|
|
|
|
|
}, []);
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
|
2026-02-18 16:46:55 -06:00
|
|
|
const autoSize = useCallback((el: HTMLTextAreaElement | null) => {
|
|
|
|
|
if (!el) return;
|
|
|
|
|
el.style.height = "auto";
|
|
|
|
|
el.style.height = `${el.scrollHeight}px`;
|
|
|
|
|
}, []);
|
|
|
|
|
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (editing && inputRef.current) {
|
|
|
|
|
inputRef.current.focus();
|
|
|
|
|
inputRef.current.select();
|
2026-02-25 21:36:06 -06:00
|
|
|
if (inputRef.current instanceof HTMLTextAreaElement) {
|
2026-02-18 16:46:55 -06:00
|
|
|
autoSize(inputRef.current);
|
|
|
|
|
}
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
}
|
2026-02-25 21:36:06 -06:00
|
|
|
}, [editing, autoSize]);
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
|
2026-03-13 21:30:48 -05:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (!editing || !multiline) return;
|
|
|
|
|
const frame = requestAnimationFrame(() => {
|
|
|
|
|
markdownRef.current?.focus();
|
|
|
|
|
});
|
|
|
|
|
return () => cancelAnimationFrame(frame);
|
|
|
|
|
}, [editing, multiline]);
|
|
|
|
|
|
|
|
|
|
const commit = useCallback(async (nextValue = draft) => {
|
|
|
|
|
const trimmed = nextValue.trim();
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
if (trimmed && trimmed !== value) {
|
2026-03-13 21:30:48 -05:00
|
|
|
await Promise.resolve(onSave(trimmed));
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
} else {
|
|
|
|
|
setDraft(value);
|
|
|
|
|
}
|
2026-03-13 21:30:48 -05:00
|
|
|
if (!multiline) {
|
|
|
|
|
setEditing(false);
|
|
|
|
|
}
|
|
|
|
|
}, [draft, multiline, onSave, value]);
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
|
2026-04-04 14:05:08 -05:00
|
|
|
const cancelPendingBlurCommit = useCallback(() => {
|
|
|
|
|
if (blurCommitFrameRef.current === null) return;
|
|
|
|
|
blurCommitFrameRef.current();
|
|
|
|
|
blurCommitFrameRef.current = null;
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const scheduleBlurCommit = useCallback((container: HTMLDivElement) => {
|
|
|
|
|
cancelPendingBlurCommit();
|
|
|
|
|
blurCommitFrameRef.current = queueContainedBlurCommit(container, () => {
|
|
|
|
|
blurCommitFrameRef.current = null;
|
|
|
|
|
if (autosaveDebounceRef.current) {
|
|
|
|
|
clearTimeout(autosaveDebounceRef.current);
|
|
|
|
|
}
|
|
|
|
|
setMultilineFocused(false);
|
|
|
|
|
const trimmed = draft.trim();
|
|
|
|
|
if (!trimmed || trimmed === value) {
|
|
|
|
|
reset();
|
|
|
|
|
void commit();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void runSave(() => commit());
|
|
|
|
|
});
|
|
|
|
|
}, [cancelPendingBlurCommit, commit, draft, reset, runSave, value]);
|
|
|
|
|
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
function handleKeyDown(e: React.KeyboardEvent) {
|
|
|
|
|
if (e.key === "Enter" && !multiline) {
|
|
|
|
|
e.preventDefault();
|
2026-03-13 21:30:48 -05:00
|
|
|
void commit();
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
}
|
|
|
|
|
if (e.key === "Escape") {
|
2026-03-13 21:30:48 -05:00
|
|
|
if (autosaveDebounceRef.current) {
|
|
|
|
|
clearTimeout(autosaveDebounceRef.current);
|
|
|
|
|
}
|
|
|
|
|
reset();
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
setDraft(value);
|
2026-03-13 21:30:48 -05:00
|
|
|
if (multiline) {
|
|
|
|
|
setMultilineFocused(false);
|
|
|
|
|
if (document.activeElement instanceof HTMLElement) {
|
|
|
|
|
document.activeElement.blur();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
setEditing(false);
|
|
|
|
|
}
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-13 21:30:48 -05:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (!multiline) return;
|
|
|
|
|
if (!multilineFocused) return;
|
|
|
|
|
const trimmed = draft.trim();
|
|
|
|
|
if (!trimmed || trimmed === value) {
|
|
|
|
|
if (autosaveState !== "saved") {
|
|
|
|
|
reset();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
markDirty();
|
|
|
|
|
if (autosaveDebounceRef.current) {
|
|
|
|
|
clearTimeout(autosaveDebounceRef.current);
|
Add MarkdownEditor component, asset image upload, and rich description editing
Introduce MarkdownEditor built on @mdxeditor/editor with headings,
lists, links, quotes, image upload with drag-and-drop, and themed CSS
integration. Add asset image upload API (routes, service, storage) and
wire image upload into InlineEditor multiline mode, NewIssueDialog,
NewProjectDialog, GoalDetail, IssueDetail, and ProjectDetail
description fields. Tighten prompt template editor styling.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:50:45 -06:00
|
|
|
}
|
2026-03-13 21:30:48 -05:00
|
|
|
autosaveDebounceRef.current = setTimeout(() => {
|
|
|
|
|
void runSave(() => commit(trimmed));
|
|
|
|
|
}, AUTOSAVE_DEBOUNCE_MS);
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
if (autosaveDebounceRef.current) {
|
|
|
|
|
clearTimeout(autosaveDebounceRef.current);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}, [autosaveState, commit, draft, markDirty, multiline, multilineFocused, reset, runSave, value]);
|
|
|
|
|
|
|
|
|
|
if (multiline) {
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
|
|
|
|
markdownPad,
|
|
|
|
|
"rounded transition-colors",
|
|
|
|
|
multilineFocused ? "bg-transparent" : "hover:bg-accent/20",
|
|
|
|
|
)}
|
2026-04-04 14:05:08 -05:00
|
|
|
onFocusCapture={() => {
|
|
|
|
|
cancelPendingBlurCommit();
|
|
|
|
|
setMultilineFocused(true);
|
|
|
|
|
}}
|
2026-03-13 21:30:48 -05:00
|
|
|
onBlurCapture={(event) => {
|
|
|
|
|
if (event.currentTarget.contains(event.relatedTarget as Node | null)) return;
|
2026-04-04 14:05:08 -05:00
|
|
|
scheduleBlurCommit(event.currentTarget);
|
2026-03-13 21:30:48 -05:00
|
|
|
}}
|
|
|
|
|
onKeyDown={handleKeyDown}
|
|
|
|
|
>
|
|
|
|
|
<MarkdownEditor
|
|
|
|
|
ref={markdownRef}
|
|
|
|
|
value={draft}
|
|
|
|
|
onChange={setDraft}
|
|
|
|
|
placeholder={placeholder}
|
|
|
|
|
bordered={false}
|
|
|
|
|
className="bg-transparent"
|
|
|
|
|
contentClassName={cn("paperclip-edit-in-place-content", className)}
|
|
|
|
|
imageUploadHandler={imageUploadHandler}
|
|
|
|
|
mentions={mentions}
|
|
|
|
|
onSubmit={() => {
|
|
|
|
|
const trimmed = draft.trim();
|
|
|
|
|
if (!trimmed || trimmed === value) {
|
|
|
|
|
reset();
|
|
|
|
|
void commit();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void runSave(() => commit());
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<div className="flex min-h-4 items-center justify-end pr-1">
|
|
|
|
|
<span
|
|
|
|
|
className={cn(
|
|
|
|
|
"text-[11px] transition-opacity duration-150",
|
|
|
|
|
autosaveState === "error" ? "text-destructive" : "text-muted-foreground",
|
|
|
|
|
autosaveState === "idle" ? "opacity-0" : "opacity-100",
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
{autosaveState === "saving"
|
|
|
|
|
? "Autosaving..."
|
|
|
|
|
: autosaveState === "saved"
|
|
|
|
|
? "Saved"
|
|
|
|
|
: autosaveState === "error"
|
|
|
|
|
? "Could not save"
|
|
|
|
|
: "Idle"}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (editing) {
|
Add MarkdownEditor component, asset image upload, and rich description editing
Introduce MarkdownEditor built on @mdxeditor/editor with headings,
lists, links, quotes, image upload with drag-and-drop, and themed CSS
integration. Add asset image upload API (routes, service, storage) and
wire image upload into InlineEditor multiline mode, NewIssueDialog,
NewProjectDialog, GoalDetail, IssueDetail, and ProjectDetail
description fields. Tighten prompt template editor styling.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:50:45 -06:00
|
|
|
|
2026-02-18 16:46:55 -06:00
|
|
|
return (
|
2026-02-25 21:36:06 -06:00
|
|
|
<textarea
|
|
|
|
|
ref={inputRef}
|
|
|
|
|
value={draft}
|
|
|
|
|
rows={1}
|
|
|
|
|
onChange={(e) => {
|
|
|
|
|
setDraft(e.target.value);
|
|
|
|
|
autoSize(e.target);
|
|
|
|
|
}}
|
2026-03-13 21:30:48 -05:00
|
|
|
onBlur={() => {
|
|
|
|
|
void commit();
|
|
|
|
|
}}
|
2026-02-25 21:36:06 -06:00
|
|
|
onKeyDown={handleKeyDown}
|
2026-02-18 16:46:55 -06:00
|
|
|
className={cn(
|
2026-02-25 21:36:06 -06:00
|
|
|
"w-full bg-transparent rounded outline-none resize-none overflow-hidden",
|
2026-02-18 16:46:55 -06:00
|
|
|
pad,
|
|
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
/>
|
|
|
|
|
);
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
}
|
|
|
|
|
|
2026-02-25 08:39:31 -06:00
|
|
|
// Use div instead of Tag when rendering markdown to avoid invalid nesting
|
|
|
|
|
// (e.g. <p> cannot contain the <div>/<p> elements that markdown produces)
|
|
|
|
|
const DisplayTag = value && multiline ? "div" : Tag;
|
|
|
|
|
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
return (
|
2026-02-25 08:39:31 -06:00
|
|
|
<DisplayTag
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
className={cn(
|
2026-03-11 16:41:14 -05:00
|
|
|
"cursor-pointer rounded hover:bg-accent/50 transition-colors overflow-hidden",
|
2026-02-18 16:46:55 -06:00
|
|
|
pad,
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
!value && "text-muted-foreground italic",
|
2026-03-13 21:30:48 -05:00
|
|
|
className,
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
)}
|
|
|
|
|
onClick={() => setEditing(true)}
|
|
|
|
|
>
|
2026-03-13 21:30:48 -05:00
|
|
|
{value || placeholder}
|
2026-02-25 08:39:31 -06:00
|
|
|
</DisplayTag>
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
);
|
|
|
|
|
}
|