Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat(web): rework the new issue dialog body and footer (#76)

Croff09497fa65a7d
diff --git a/apps/web/src/components/common/overlay/Modal.tsx b/apps/web/src/components/common/overlay/Modal.tsx
index 75f34b55..f1123ed7 100644
--- a/apps/web/src/components/common/overlay/Modal.tsx
+++ b/apps/web/src/components/common/overlay/Modal.tsx
@@ -32,6 +32,7 @@ export default function Modal({
wide = false,
fullscreen = false,
onToggleFullscreen,
+ className,
}: {
title: string;
description?: string;
@@ -39,6 +40,8 @@ export default function Modal({
onClose: () => void;
children: ReactNode;
wide?: boolean | 'xl';
+ // On the dialog itself, for a caller that has to adjust its padding.
+ className?: string;
// Controlled by the caller: in fullscreen the content is a flex column, so the
// caller's body has to claim the leftover space itself.
fullscreen?: boolean;
@@ -63,6 +66,7 @@ export default function Modal({
// row keeps its content height under a capped container, so the body
// never shrinks and never scrolls.
cn('flex max-h-[85vh] flex-col overflow-hidden', MAX_WIDTH[`${wide}`]),
+ className,
)}
>
<DialogHeader>
@@ -80,11 +84,13 @@ export default function Modal({
{description && <DialogDescription>{description}</DialogDescription>}
</DialogHeader>
{/* The body scrolls, not the dialog: the dialog stays the positioned
- ancestor a body-wide overlay can cover without scrolling away. */}
+ ancestor a body-wide overlay can cover without scrolling away. A flex
+ column either way, so a caller can hand the leftover height to one of
+ its parts. */}
<div
className={cn(
- 'min-h-0',
- fullscreen ? 'flex flex-1 flex-col overflow-hidden' : 'overflow-y-auto',
+ 'flex min-h-0 flex-col',
+ fullscreen ? 'flex-1 overflow-hidden' : 'overflow-y-auto',
)}
>
{children}
diff --git a/apps/web/src/features/issue/components/IssueAttachmentThumb.tsx b/apps/web/src/features/issue/components/IssueAttachmentThumb.tsx
index 43f27fab..7fa53f6e 100644
--- a/apps/web/src/features/issue/components/IssueAttachmentThumb.tsx
+++ b/apps/web/src/features/issue/components/IssueAttachmentThumb.tsx
@@ -4,15 +4,22 @@ import { isImage, isVideo, type Embeddable } from '../utils/attachmentEmbed';
// An attachment card's leading thumbnail: images and videos preview themselves,
// every other type falls back to a generic file glyph.
-export default function IssueAttachmentThumb({ attachment }: { attachment: Embeddable }) {
+export default function IssueAttachmentThumb({
+ attachment,
+ sizes = '40px',
+}: {
+ attachment: Embeddable;
+ // The rendered width, for the image optimizer. The default is the w-10 (40px)
+ // thumbnail every card uses; a larger preview passes its own.
+ sizes?: string;
+}) {
if (isImage(attachment))
return (
<Image
src={attachment.url}
alt={attachment.filename}
fill
- // The thumbnail is w-10 (40px) in every card size used here.
- sizes="40px"
+ sizes={sizes}
// A file picked in the new issue modal is previewed from a local blob:
// URL, which the image optimizer cannot fetch.
unoptimized={attachment.url.startsWith('blob:')}
diff --git a/apps/web/src/features/issue/components/create/NewIssueAttachButton.tsx b/apps/web/src/features/issue/components/create/NewIssueAttachButton.tsx
index fd61f5be..6a122212 100644
--- a/apps/web/src/features/issue/components/create/NewIssueAttachButton.tsx
+++ b/apps/web/src/features/issue/components/create/NewIssueAttachButton.tsx
@@ -6,7 +6,7 @@ import { Button } from '@/components/ui/button';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
// Attaches files to an issue being created; the picked files are listed by
-// NewIssueAttachmentList and uploaded once the issue exists.
+// NewIssueAttachmentStrip and uploaded once the issue exists.
export default function NewIssueAttachButton({
onPick,
}: {
diff --git a/apps/web/src/features/issue/components/create/NewIssueAttachmentChip.tsx b/apps/web/src/features/issue/components/create/NewIssueAttachmentChip.tsx
new file mode 100644
index 00000000..ccd6e919
--- /dev/null
+++ b/apps/web/src/features/issue/components/create/NewIssueAttachmentChip.tsx
@@ -0,0 +1,70 @@
+import { useState } from 'react';
+import { X } from 'lucide-react';
+import { type PendingAttachment } from '../../hooks/useNewIssueAttachments';
+import { type Embeddable } from '../../utils/attachmentEmbed';
+import { formatSize } from '../../utils/fileSize';
+import IssueAttachmentThumb from '../IssueAttachmentThumb';
+import { Button } from '@/components/ui/button';
+import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
+
+// One pending file in the footer strip: the thumbnail opens a larger preview to
+// insert the file from, the corner button drops it. That button overhangs the
+// thumbnail by half its size, which the strip pads for.
+export default function NewIssueAttachmentChip({
+ item,
+ onInsert,
+ onRemove,
+}: {
+ item: PendingAttachment;
+ // Left out while no editor is open to insert into: the preview then only shows.
+ onInsert?: (attachment: Embeddable) => void;
+ onRemove: (id: number) => void;
+}) {
+ const [open, setOpen] = useState(false);
+
+ return (
+ <div className="group relative size-10 shrink-0">
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ aria-label={`Preview ${item.filename}`}
+ className="relative flex size-full items-center justify-center overflow-hidden rounded-md border bg-muted hover:border-ring"
+ >
+ <IssueAttachmentThumb attachment={item} />
+ </button>
+ </PopoverTrigger>
+ <PopoverContent side="top" align="start" className="w-64 space-y-2 p-2">
+ <div className="relative flex h-40 items-center justify-center overflow-hidden rounded-md border bg-muted">
+ <IssueAttachmentThumb attachment={item} sizes="240px" />
+ </div>
+ <div className="min-w-0">
+ <p className="truncate text-sm font-medium">{item.filename}</p>
+ <p className="text-xs text-muted-foreground">{formatSize(item.file.size)}</p>
+ </div>
+ {onInsert && (
+ <Button
+ size="sm"
+ className="w-full"
+ onClick={() => {
+ onInsert(item);
+ setOpen(false);
+ }}
+ >
+ Insert
+ </Button>
+ )}
+ </PopoverContent>
+ </Popover>
+ <button
+ type="button"
+ onClick={() => onRemove(item.id)}
+ aria-label={`Remove ${item.filename}`}
+ title="Remove"
+ className="absolute -top-2 -right-2 flex size-4 items-center justify-center rounded-full border bg-popover text-muted-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100 hover:text-destructive focus-visible:opacity-100"
+ >
+ <X className="size-3" />
+ </button>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/issue/components/create/NewIssueAttachmentList.tsx b/apps/web/src/features/issue/components/create/NewIssueAttachmentList.tsx
deleted file mode 100644
index 61070e5a..00000000
--- a/apps/web/src/features/issue/components/create/NewIssueAttachmentList.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { X } from 'lucide-react';
-import { type PendingAttachment } from '../../hooks/useNewIssueAttachments';
-import { isImage, isVideo, type Embeddable } from '../../utils/attachmentEmbed';
-import { formatSize } from '../../utils/fileSize';
-import IssueAttachmentThumb from '../IssueAttachmentThumb';
-import {
- Attachment as AttachmentCard,
- AttachmentAction,
- AttachmentActions,
- AttachmentContent,
- AttachmentDescription,
- AttachmentMedia,
- AttachmentTitle,
-} from '@/components/ui/attachment';
-
-// Files waiting to be uploaded once the issue is created. They preview from
-// their local blob: URL, and Insert embeds that URL into the description; the
-// modal rewrites it to the stored URL after the upload.
-export default function NewIssueAttachmentList({
- items,
- onInsert,
- onRemove,
-}: {
- items: PendingAttachment[];
- onInsert: (attachment: Embeddable) => void;
- onRemove: (id: number) => void;
-}) {
- if (items.length === 0) return null;
-
- return (
- <div className="mt-3 flex flex-col gap-2">
- {items.map((item) => (
- <AttachmentCard key={item.id} className="w-full">
- <AttachmentMedia variant={isImage(item) || isVideo(item) ? 'image' : 'icon'}>
- <IssueAttachmentThumb attachment={item} />
- </AttachmentMedia>
-
- <AttachmentContent>
- <AttachmentTitle>{item.filename}</AttachmentTitle>
- <AttachmentDescription>{formatSize(item.file.size)}</AttachmentDescription>
- </AttachmentContent>
-
- <AttachmentActions>
- <AttachmentAction
- size="sm"
- onClick={() => onInsert(item)}
- title="Insert into description"
- >
- Insert
- </AttachmentAction>
- <AttachmentAction
- className="hover:text-destructive"
- onClick={() => onRemove(item.id)}
- aria-label={`Remove ${item.filename}`}
- title="Remove"
- >
- <X />
- </AttachmentAction>
- </AttachmentActions>
- </AttachmentCard>
- ))}
- </div>
- );
-}
diff --git a/apps/web/src/features/issue/components/create/NewIssueAttachmentStrip.tsx b/apps/web/src/features/issue/components/create/NewIssueAttachmentStrip.tsx
new file mode 100644
index 00000000..3c533c0c
--- /dev/null
+++ b/apps/web/src/features/issue/components/create/NewIssueAttachmentStrip.tsx
@@ -0,0 +1,39 @@
+import { type PendingAttachment } from '../../hooks/useNewIssueAttachments';
+import { type Embeddable } from '../../utils/attachmentEmbed';
+import NewIssueAttachmentChip from './NewIssueAttachmentChip';
+
+// Files waiting to be uploaded once the issue is created. They preview from
+// their local blob: URL, and inserting one embeds that URL into the open editor;
+// the modal rewrites it to the stored URL after the upload. The strip sits in the
+// footer next to the attach button, so the files cost the dialog no height.
+export default function NewIssueAttachmentStrip({
+ items,
+ onInsert,
+ onRemove,
+}: {
+ items: PendingAttachment[];
+ // Left out while no editor is open to insert into.
+ onInsert?: (attachment: Embeddable) => void;
+ onRemove: (id: number) => void;
+}) {
+ if (items.length === 0) return null;
+
+ return (
+ <>
+ <span className="h-6 w-px shrink-0 bg-border" />
+ {/* The padding is the room each chip's overhanging remove button needs:
+ scrolling this box would clip anything outside it. Vertically it is
+ symmetric, so the chips stay on the footer's centre line. */}
+ <div className="flex min-w-0 flex-1 items-center gap-3 overflow-x-auto py-2 pr-2">
+ {items.map((item) => (
+ <NewIssueAttachmentChip
+ key={item.id}
+ item={item}
+ onInsert={onInsert}
+ onRemove={onRemove}
+ />
+ ))}
+ </div>
+ </>
+ );
+}
diff --git a/apps/web/src/features/issue/components/create/NewIssueBody.tsx b/apps/web/src/features/issue/components/create/NewIssueBody.tsx
new file mode 100644
index 00000000..45ab301e
--- /dev/null
+++ b/apps/web/src/features/issue/components/create/NewIssueBody.tsx
@@ -0,0 +1,108 @@
+import { type Editor } from '@tiptap/react';
+import { type CustomField, type IssueFieldValueInput } from '@/lib/api';
+import { cn } from '@/lib/utils';
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
+import { type Embeddable } from '../../utils/attachmentEmbed';
+import { DESCRIPTION_TAB, OTHER_TAB, fieldTab } from '../../utils/bodyTabs';
+import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';
+import NewIssueBodyFields from './NewIssueBodyFields';
+
+// The written part of a new issue: the description, plus the custom fields the
+// project shows in the body. Each markdown field gets its own tab so only one
+// editor is on screen at a time — otherwise they stack up and the dialog turns
+// into one long scroll. Every tab stays mounted (forceMount), so switching away
+// keeps the editor instance the modal needs to strip an attachment's embeds.
+export default function NewIssueBody({
+ tab,
+ onTabChange,
+ fullscreen,
+ description,
+ onDescriptionChange,
+ onDescriptionReady,
+ bodyDefs,
+ fieldValues,
+ onFieldValue,
+ onFieldEditorReady,
+ uploadFile,
+}: {
+ // Held by the modal: it inserts an attachment into whichever editor is on
+ // screen, so it has to know which tab that is.
+ tab: string;
+ onTabChange: (tab: string) => void;
+ fullscreen: boolean;
+ description: string;
+ onDescriptionChange: (markdown: string) => void;
+ onDescriptionReady: (editor: Editor | null) => void;
+ bodyDefs: CustomField[];
+ fieldValues: Record<number, IssueFieldValueInput>;
+ onFieldValue: (id: number, patch: IssueFieldValueInput) => void;
+ onFieldEditorReady: (id: number, editor: Editor | null) => void;
+ uploadFile: (file: File) => Promise<Embeddable>;
+}) {
+ const markdownDefs = bodyDefs.filter((d) => d.fieldType === 'markdown');
+ const pillDefs = bodyDefs.filter((d) => d.fieldType !== 'markdown');
+
+ // In fullscreen the editor claims the leftover height; in compact it grows with
+ // its content and scrolls once the dialog runs out of room.
+ const editorClass = cn('overflow-y-auto', fullscreen ? 'min-h-48 flex-1' : 'min-h-24');
+
+ const descriptionEditor = (
+ <IssueMarkdownEditor
+ className={cn(bodyDefs.length === 0 && 'mt-3', editorClass)}
+ defaultValue={description}
+ onChange={onDescriptionChange}
+ onReady={onDescriptionReady}
+ uploadFile={uploadFile}
+ />
+ );
+
+ if (bodyDefs.length === 0) return descriptionEditor;
+
+ // No flex-1 in compact: the tab is sized by its content there, but min-h-0
+ // still lets it give height back once the dialog runs out of it.
+ const contentClass = cn(
+ 'flex min-h-0 flex-col data-[state=inactive]:hidden',
+ fullscreen && 'flex-1',
+ );
+
+ return (
+ <Tabs
+ value={tab}
+ onValueChange={onTabChange}
+ className={cn('mt-3 flex min-h-0 flex-col', fullscreen && 'flex-1')}
+ >
+ <TabsList variant="line" className="shrink-0">
+ <TabsTrigger value={DESCRIPTION_TAB}>Description</TabsTrigger>
+ {markdownDefs.map((def) => (
+ <TabsTrigger key={def.id} value={fieldTab(def.id)}>
+ {def.name}
+ </TabsTrigger>
+ ))}
+ {pillDefs.length > 0 && <TabsTrigger value={OTHER_TAB}>Other</TabsTrigger>}
+ </TabsList>
+
+ <TabsContent value={DESCRIPTION_TAB} forceMount className={contentClass}>
+ {descriptionEditor}
+ </TabsContent>
+
+ {markdownDefs.map((def) => (
+ <TabsContent key={def.id} value={fieldTab(def.id)} forceMount className={contentClass}>
+ <IssueMarkdownEditor
+ className={editorClass}
+ defaultValue={(fieldValues[def.id]?.value as string) ?? ''}
+ placeholder="Empty"
+ onChange={(md) => onFieldValue(def.id, { value: md })}
+ onReady={(editor) => onFieldEditorReady(def.id, editor)}
+ uploadFile={uploadFile}
+ />
+ </TabsContent>
+ ))}
+
+ {pillDefs.length > 0 && (
+ <TabsContent value={OTHER_TAB} className={cn(contentClass, 'overflow-y-auto')}>
+ <NewIssueBodyFields defs={pillDefs} values={fieldValues} onChange={onFieldValue} />
+ </TabsContent>
+ )}
+ </Tabs>
+ );
+}
diff --git a/apps/web/src/features/issue/components/create/NewIssueBodyFields.tsx b/apps/web/src/features/issue/components/create/NewIssueBodyFields.tsx
new file mode 100644
index 00000000..33aa6972
--- /dev/null
+++ b/apps/web/src/features/issue/components/create/NewIssueBodyFields.tsx
@@ -0,0 +1,31 @@
+import { type CustomField, type IssueFieldValueInput } from '@/lib/api';
+import IssueCustomFieldPill from '../fields/IssueCustomFieldPill';
+
+// The body fields that are not markdown, gathered in the "Other" tab: a pill each
+// is too small to be worth a tab of its own.
+export default function NewIssueBodyFields({
+ defs,
+ values,
+ onChange,
+}: {
+ defs: CustomField[];
+ values: Record<number, IssueFieldValueInput>;
+ onChange: (id: number, patch: IssueFieldValueInput) => void;
+}) {
+ return (
+ <div className="space-y-4">
+ {defs.map((def) => (
+ <div key={def.id}>
+ <h3 className="mb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase">
+ {def.name}
+ </h3>
+ <IssueCustomFieldPill
+ def={def}
+ value={values[def.id]}
+ onChange={(v) => onChange(def.id, v)}
+ />
+ </div>
+ ))}
+ </div>
+ );
+}
diff --git a/apps/web/src/features/issue/components/create/NewIssueModal.tsx b/apps/web/src/features/issue/components/create/NewIssueModal.tsx
index 014c751b..9102eaf2 100644
--- a/apps/web/src/features/issue/components/create/NewIssueModal.tsx
+++ b/apps/web/src/features/issue/components/create/NewIssueModal.tsx
@@ -15,12 +15,13 @@ import {
stripEmbed,
type Embeddable,
} from '../../utils/attachmentEmbed';
+import { DESCRIPTION_TAB, OTHER_TAB, fieldTabId } from '../../utils/bodyTabs';
import IssueCustomFieldPill from '../fields/IssueCustomFieldPill';
import NewIssueAttachButton from './NewIssueAttachButton';
-import NewIssueAttachmentList from './NewIssueAttachmentList';
+import NewIssueAttachmentStrip from './NewIssueAttachmentStrip';
import NewIssueDropOverlay from './NewIssueDropOverlay';
import Modal from '@/components/common/overlay/Modal';
-import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';
+import NewIssueBody from './NewIssueBody';
import AssigneeSelect from '@/components/common/fields/AssigneeSelect';
import DatePill from '@/components/common/fields/DatePill';
import DelegateSelect from '../fields/DelegateSelect';
@@ -84,8 +85,8 @@ export default function NewIssueModal({
const [fullscreen, setFullscreen] = useState(false);
// Custom fields for the selected type (global + type-scoped). Fields flagged
- // "show in main info" render below the description; the rest are added on
- // demand from the "…" menu.
+ // "show in main info" get their own body tab; the rest are added on demand from
+ // the "…" menu.
const fieldsQuery = useCustomFieldsQuery(project.project.key, typeId ?? undefined);
const fieldDefs = fieldsQuery.data ?? [];
const [activeFieldIds, setActiveFieldIds] = useState<number[]>([]);
@@ -98,15 +99,25 @@ export default function NewIssueModal({
const attachments = useNewIssueAttachments();
// The description editor instance, so a file dropped or pasted anywhere on the
- // modal (not just onto the small editor box) can be inserted at the cursor.
+ // modal (not just onto the editor box) can be inserted at the cursor.
const [descEditor, setDescEditor] = useState<Editor | null>(null);
// The markdown editors of the body custom fields, so an attachment removed
- // from the list takes its embeds with it wherever they were inserted.
+ // from the strip takes its embeds with it wherever they were inserted.
const fieldEditors = useRef(new Map<number, Editor>());
- function insertIntoDescription(a: Embeddable) {
- descEditor?.chain().focus().insertContent(attachmentHtml(a)).run();
+ // Which of the body tabs is open, so an attachment lands in the editor the user
+ // is looking at.
+ const [bodyTab, setBodyTab] = useState(DESCRIPTION_TAB);
+
+ function activeBodyEditor(): Editor | null {
+ if (bodyTab === DESCRIPTION_TAB) return descEditor;
+ const fieldId = fieldTabId(bodyTab);
+ return fieldId === null ? null : (fieldEditors.current.get(fieldId) ?? null);
+ }
+
+ function insertIntoBody(a: Embeddable) {
+ activeBodyEditor()?.chain().focus().insertContent(attachmentHtml(a)).run();
}
function removeAttachment(id: number) {
@@ -116,29 +127,34 @@ export default function NewIssueModal({
for (const editor of fieldEditors.current.values()) removeEmbed(editor, item.url);
}
- function insertFilesIntoDescription(files: FileList) {
- if (!descEditor) return;
- let pos = descEditor.state.selection.to;
+ function insertFilesIntoBody(files: FileList) {
+ const editor = activeBodyEditor();
+ // No editor on screen: still attach the files, they can be inserted later.
+ if (!editor) {
+ attachments.attach(files);
+ return;
+ }
+ let pos = editor.state.selection.to;
void (async () => {
for (const file of Array.from(files)) {
const a = await attachments.uploadFile(file).catch(() => null);
if (!a) continue;
- descEditor.chain().insertContentAt(pos, attachmentHtml(a)).focus().run();
- pos = descEditor.state.selection.to;
+ editor.chain().insertContentAt(pos, attachmentHtml(a)).focus().run();
+ pos = editor.state.selection.to;
}
})();
}
- const { draggedFiles, dragHandlers } = useFileDragZone(insertFilesIntoDescription);
+ const { draggedFiles, dragHandlers } = useFileDragZone(insertFilesIntoBody);
// Read through a ref: the paste listener below is registered once, while the
// insert closes over the editor and the upload limits, which both arrive after
// the first render.
- const insertFilesRef = useRef(insertFilesIntoDescription);
- insertFilesRef.current = insertFilesIntoDescription;
+ const insertFilesRef = useRef(insertFilesIntoBody);
+ insertFilesRef.current = insertFilesIntoBody;
- // A paste carrying files lands in the description unless a markdown editor has
- // the focus, in which case tiptap has already inserted it there. The listener
+ // A paste carrying files lands in the open tab's editor unless a markdown editor
+ // has the focus, in which case tiptap has already inserted it there. The listener
// is on the document because the focus may sit on the dialog itself, above the
// modal body.
useEffect(() => {
@@ -170,10 +186,6 @@ export default function NewIssueModal({
const activeDefs = propertyDefs.filter((d) => activeFieldIds.includes(d.id));
const availableDefs = propertyDefs.filter((d) => !activeFieldIds.includes(d.id));
- let descriptionHeight = 'min-h-24';
- if (fullscreen) descriptionHeight = 'min-h-48 flex-1';
- else if (bodyDefs.length > 0) descriptionHeight = 'min-h-14';
-
function toggleLabel(id: number) {
setLabelIds((ids) => (ids.includes(id) ? ids.filter((x) => x !== id) : [...ids, id]));
}
@@ -245,9 +257,12 @@ export default function NewIssueModal({
wide
fullscreen={fullscreen}
onToggleFullscreen={() => setFullscreen((v) => !v)}
+ // Halves the dialog's bottom padding: the footer then sits as far from the
+ // separator above it as from the dialog edge below.
+ className="pb-3"
>
<div
- className={cn(fullscreen && 'flex min-h-0 flex-1 flex-col overflow-y-auto')}
+ className={cn('flex min-h-0 flex-col', fullscreen && 'flex-1 overflow-hidden')}
{...dragHandlers}
>
{/* Not inside a relative box on purpose: the dialog itself is the
@@ -260,43 +275,27 @@ export default function NewIssueModal({
onChange={(e) => setTitle(e.target.value)}
autoFocus
/>
- <IssueMarkdownEditor
- className={cn('mt-3', descriptionHeight)}
- defaultValue={description}
- onChange={setDescription}
- onReady={setDescEditor}
- uploadFile={attachments.uploadFile}
- />
-
- {bodyDefs.length > 0 && (
- <div className="mt-2 space-y-4">
- {bodyDefs.map((def) => (
- <div key={def.id}>
- <h3 className="mb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase">
- {def.name}
- </h3>
- {def.fieldType === 'markdown' ? (
- <IssueMarkdownEditor
- defaultValue={(fieldValues[def.id]?.value as string) ?? ''}
- placeholder="Empty"
- onChange={(md) => setFieldValue(def.id, { value: md })}
- onReady={(editor) => {
- if (editor) fieldEditors.current.set(def.id, editor);
- else fieldEditors.current.delete(def.id);
- }}
- uploadFile={attachments.uploadFile}
- />
- ) : (
- <IssueCustomFieldPill
- def={def}
- value={fieldValues[def.id]}
- onChange={(v) => setFieldValue(def.id, v)}
- />
- )}
- </div>
- ))}
- </div>
- )}
+ {/* The written content is the one part that gives up height, so the pills
+ and the footer stay in view however much of it there is. It scrolls
+ inside its editors, not here, which keeps the tab bar in place. */}
+ <div className={cn('flex min-h-0 flex-col overflow-hidden', fullscreen && 'flex-1')}>
+ <NewIssueBody
+ tab={bodyTab}
+ onTabChange={setBodyTab}
+ fullscreen={fullscreen}
+ description={description}
+ onDescriptionChange={setDescription}
+ onDescriptionReady={setDescEditor}
+ bodyDefs={bodyDefs}
+ fieldValues={fieldValues}
+ onFieldValue={setFieldValue}
+ onFieldEditorReady={(id, editor) => {
+ if (editor) fieldEditors.current.set(id, editor);
+ else fieldEditors.current.delete(id);
+ }}
+ uploadFile={attachments.uploadFile}
+ />
+ </div>
<div
className={`${bodyDefs.length > 0 ? 'mt-8' : 'mt-4'} flex flex-wrap items-center gap-2`}
@@ -403,17 +402,16 @@ export default function NewIssueModal({
)}
</div>
- <NewIssueAttachmentList
- items={attachments.pending}
- onInsert={insertIntoDescription}
- onRemove={removeAttachment}
- />
-
{errorMessage && <p className="mt-3 text-xs text-destructive">{errorMessage}</p>}
- <div className="mt-4 flex items-center justify-between border-t pt-3">
+ <div className="mt-4 flex items-center gap-2 border-t pt-3">
<NewIssueAttachButton onPick={attachments.attach} />
- <Button disabled={saving || !title.trim()} onClick={submit}>
+ <NewIssueAttachmentStrip
+ items={attachments.pending}
+ onInsert={bodyTab === OTHER_TAB ? undefined : insertIntoBody}
+ onRemove={removeAttachment}
+ />
+ <Button className="ml-auto" disabled={saving || !title.trim()} onClick={submit}>
Create issue
</Button>
</div>
diff --git a/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx b/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx
index f46b63c4..3caba10a 100644
--- a/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx
@@ -120,7 +120,7 @@ export default function IssueAttachmentsPanel({
{items.length === 0 ? (
<p className="rounded-md border border-dashed p-4 text-center text-sm text-muted-foreground">
- No attachments. Drop files here or use Add to upload.
+ Drop files here, or use Add to upload.
</p>
) : (
<div className="flex flex-col gap-2">
diff --git a/apps/web/src/features/issue/components/detail/IssueLinksPanel.tsx b/apps/web/src/features/issue/components/detail/IssueLinksPanel.tsx
index 3b935f69..666994f5 100644
--- a/apps/web/src/features/issue/components/detail/IssueLinksPanel.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueLinksPanel.tsx
@@ -79,8 +79,7 @@ export default function IssueLinksPanel({
{open &&
(links.length === 0 ? (
<p className="rounded-md border border-dashed p-4 text-center text-sm text-muted-foreground">
- No links. Use Add to mark this issue as blocked by, blocking, duplicating or related to
- another one.
+ Use Add to link an issue that blocks, duplicates or relates to this one.
</p>
) : (
<div className="flex flex-col gap-3">
diff --git a/apps/web/src/features/issue/components/editor/IssueMarkdownEditor.tsx b/apps/web/src/features/issue/components/editor/IssueMarkdownEditor.tsx
index 134854df..0df6f300 100644
--- a/apps/web/src/features/issue/components/editor/IssueMarkdownEditor.tsx
+++ b/apps/web/src/features/issue/components/editor/IssueMarkdownEditor.tsx
@@ -93,9 +93,8 @@ export default function IssueMarkdownEditor({
content: defaultValue,
editorProps: {
attributes: {
- // min-h-full so the typing area covers a container taller than the text;
- // with an auto-height container it resolves to 0 and changes nothing.
- class: 'md-content min-h-full focus:outline-none',
+ // flex-1 so the typing area covers a container taller than the text.
+ class: 'md-content flex-1 focus:outline-none',
},
// Files dropped from the OS are uploaded, then inserted at the drop
// position. Internal moves and attachment-card drags (which carry
@@ -136,7 +135,9 @@ export default function IssueMarkdownEditor({
return (
<div className={className}>
{editable && <EditorSelectionMenu editor={editor} />}
- <EditorContent editor={editor} className="h-full" />
+ {/* Grows with the text rather than being pinned to the container's height,
+ so a container that scrolls measures the overflow and shows a bar. */}
+ <EditorContent editor={editor} className="flex min-h-full flex-col" />
{imageAttachments && (
<EditorImagePicker
open={imagePickerOpen}
diff --git a/apps/web/src/features/issue/utils/bodyTabs.ts b/apps/web/src/features/issue/utils/bodyTabs.ts
new file mode 100644
index 00000000..8efb2cf0
--- /dev/null
+++ b/apps/web/src/features/issue/utils/bodyTabs.ts
@@ -0,0 +1,17 @@
+// The tab values of the new issue body. The modal reads them back to find the
+// editor an attachment should be inserted into, so the two sides share them
+// instead of each spelling the strings out.
+export const DESCRIPTION_TAB = 'description';
+
+// Holds the body fields that are not markdown, so it has no editor.
+export const OTHER_TAB = 'other';
+
+const FIELD_TAB_PREFIX = 'field-';
+
+export const fieldTab = (fieldId: number) => `${FIELD_TAB_PREFIX}${fieldId}`;
+
+export function fieldTabId(tab: string): number | null {
+ if (!tab.startsWith(FIELD_TAB_PREFIX)) return null;
+ const id = Number(tab.slice(FIELD_TAB_PREFIX.length));
+ return Number.isNaN(id) ? null : id;
+}