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): show issue property columns on the Timeline and edit them in place (#701)

Croff5e7d099081f0
diff --git a/apps/web/messages/ar/issue.json b/apps/web/messages/ar/issue.json
index 9bcace10..aad7c267 100644
--- a/apps/web/messages/ar/issue.json
+++ b/apps/web/messages/ar/issue.json
@@ -267,7 +267,9 @@
"no": "لا",
"time": "الوقت",
"startTime": "وقت البدء",
- "endTime": "وقت الانتهاء"
+ "endTime": "وقت الانتهاء",
+ "pickOption": "اختار خيار…",
+ "noOption": "من غير اختيار"
},
"editor": {
"descriptionPlaceholder": "إضافة وصف…"
diff --git a/apps/web/messages/en/issue.json b/apps/web/messages/en/issue.json
index dc0c92ec..58947f30 100644
--- a/apps/web/messages/en/issue.json
+++ b/apps/web/messages/en/issue.json
@@ -267,7 +267,9 @@
"no": "No",
"time": "Time",
"startTime": "Start time",
- "endTime": "End time"
+ "endTime": "End time",
+ "pickOption": "Pick an option…",
+ "noOption": "No option"
},
"editor": {
"descriptionPlaceholder": "Add description…"
diff --git a/apps/web/messages/es-ES/issue.json b/apps/web/messages/es-ES/issue.json
index 6faa3ead..4b8e8b4a 100644
--- a/apps/web/messages/es-ES/issue.json
+++ b/apps/web/messages/es-ES/issue.json
@@ -267,7 +267,9 @@
"no": "No",
"time": "Tiempo",
"startTime": "Hora de inicio",
- "endTime": "Hora de fin"
+ "endTime": "Hora de fin",
+ "pickOption": "Elige una opción…",
+ "noOption": "Sin opción"
},
"editor": {
"descriptionPlaceholder": "Añadir descripción…"
diff --git a/apps/web/messages/fa/issue.json b/apps/web/messages/fa/issue.json
index 5ce2b5a5..68ac8d07 100644
--- a/apps/web/messages/fa/issue.json
+++ b/apps/web/messages/fa/issue.json
@@ -267,7 +267,9 @@
"no": "خیر",
"time": "زمان",
"startTime": "زمان شروع",
- "endTime": "زمان پایان"
+ "endTime": "زمان پایان",
+ "pickOption": "یک گزینه انتخاب کنید…",
+ "noOption": "بدون گزینه"
},
"editor": {
"descriptionPlaceholder": "افزودن توضیحات…"
diff --git a/apps/web/messages/fr/issue.json b/apps/web/messages/fr/issue.json
index a2942e16..1ce1b48b 100644
--- a/apps/web/messages/fr/issue.json
+++ b/apps/web/messages/fr/issue.json
@@ -267,7 +267,9 @@
"no": "Non",
"time": "Heure",
"startTime": "Heure de début",
- "endTime": "Heure de fin"
+ "endTime": "Heure de fin",
+ "pickOption": "Choisir une option…",
+ "noOption": "Aucune option"
},
"editor": {
"descriptionPlaceholder": "Ajouter une description…"
diff --git a/apps/web/messages/id/issue.json b/apps/web/messages/id/issue.json
index f10db3af..b766a277 100644
--- a/apps/web/messages/id/issue.json
+++ b/apps/web/messages/id/issue.json
@@ -267,7 +267,9 @@
"no": "Tidak",
"time": "Waktu",
"startTime": "Waktu mulai",
- "endTime": "Waktu selesai"
+ "endTime": "Waktu selesai",
+ "pickOption": "Pilih opsi…",
+ "noOption": "Tanpa opsi"
},
"editor": {
"descriptionPlaceholder": "Tambah deskripsi…"
diff --git a/apps/web/messages/ko/issue.json b/apps/web/messages/ko/issue.json
index 0a634a51..d6926113 100644
--- a/apps/web/messages/ko/issue.json
+++ b/apps/web/messages/ko/issue.json
@@ -267,7 +267,9 @@
"no": "아니요",
"time": "시간",
"startTime": "시작 시간",
- "endTime": "종료 시간"
+ "endTime": "종료 시간",
+ "pickOption": "옵션 선택…",
+ "noOption": "옵션 없음"
},
"editor": {
"descriptionPlaceholder": "설명 추가…"
diff --git a/apps/web/messages/pt-BR/issue.json b/apps/web/messages/pt-BR/issue.json
index 069573b0..4ce2d2d8 100644
--- a/apps/web/messages/pt-BR/issue.json
+++ b/apps/web/messages/pt-BR/issue.json
@@ -267,7 +267,9 @@
"no": "Não",
"time": "Hora",
"startTime": "Hora de início",
- "endTime": "Hora de término"
+ "endTime": "Hora de término",
+ "pickOption": "Escolha uma opção…",
+ "noOption": "Sem opção"
},
"editor": {
"descriptionPlaceholder": "Adicionar descrição…"
diff --git a/apps/web/messages/ru/issue.json b/apps/web/messages/ru/issue.json
index 3bbb3709..23b04726 100644
--- a/apps/web/messages/ru/issue.json
+++ b/apps/web/messages/ru/issue.json
@@ -267,7 +267,9 @@
"no": "Нет",
"time": "Время",
"startTime": "Начало",
- "endTime": "Окончание"
+ "endTime": "Окончание",
+ "pickOption": "Выберите вариант…",
+ "noOption": "Не выбрано"
},
"editor": {
"descriptionPlaceholder": "Добавьте описание…"
diff --git a/apps/web/messages/tr/issue.json b/apps/web/messages/tr/issue.json
index 5152c8c6..71c741d9 100644
--- a/apps/web/messages/tr/issue.json
+++ b/apps/web/messages/tr/issue.json
@@ -267,7 +267,9 @@
"no": "Hayır",
"time": "Saat",
"startTime": "Başlangıç saati",
- "endTime": "Bitiş saati"
+ "endTime": "Bitiş saati",
+ "pickOption": "Bir seçenek seçin…",
+ "noOption": "Seçenek yok"
},
"editor": {
"descriptionPlaceholder": "Açıklama ekleyin…"
diff --git a/apps/web/messages/uk/issue.json b/apps/web/messages/uk/issue.json
index e396c370..ac98a8c9 100644
--- a/apps/web/messages/uk/issue.json
+++ b/apps/web/messages/uk/issue.json
@@ -267,7 +267,9 @@
"no": "Ні",
"time": "Час",
"startTime": "Початок",
- "endTime": "Завершення"
+ "endTime": "Завершення",
+ "pickOption": "Виберіть варіант…",
+ "noOption": "Не вибрано"
},
"editor": {
"descriptionPlaceholder": "Додайте опис…"
diff --git a/apps/web/messages/zh-CN/issue.json b/apps/web/messages/zh-CN/issue.json
index f0d7d721..d85022b4 100644
--- a/apps/web/messages/zh-CN/issue.json
+++ b/apps/web/messages/zh-CN/issue.json
@@ -267,7 +267,9 @@
"no": "否",
"time": "时间",
"startTime": "开始时间",
- "endTime": "结束时间"
+ "endTime": "结束时间",
+ "pickOption": "选择选项…",
+ "noOption": "无选项"
},
"editor": {
"descriptionPlaceholder": "添加描述…"
diff --git a/apps/web/messages/zh-TW/issue.json b/apps/web/messages/zh-TW/issue.json
index 50dfe08d..ddfcdd84 100644
--- a/apps/web/messages/zh-TW/issue.json
+++ b/apps/web/messages/zh-TW/issue.json
@@ -267,7 +267,9 @@
"no": "否",
"time": "時間",
"startTime": "開始時間",
- "endTime": "結束時間"
+ "endTime": "結束時間",
+ "pickOption": "選擇選項…",
+ "noOption": "無選項"
},
"editor": {
"descriptionPlaceholder": "新增描述…"
diff --git a/apps/web/src/components/common/fields/AssigneeSelect.tsx b/apps/web/src/components/common/fields/AssigneeSelect.tsx
index c60ff3aa..b57e61dd 100644
--- a/apps/web/src/components/common/fields/AssigneeSelect.tsx
+++ b/apps/web/src/components/common/fields/AssigneeSelect.tsx
@@ -1,3 +1,4 @@
+import { type ReactNode } from 'react';
import { CircleDashed } from 'lucide-react';
import type { Assignee } from '@/lib/api/endpoints/projects';
import { useSession } from '@/lib/auth-client';
@@ -16,12 +17,15 @@ export default function AssigneeSelect({
onChange,
placeholder,
readOnly,
+ trigger,
}: {
assignees: Assignee[];
value: string | null;
onChange: (userId: string | null) => void;
placeholder?: string;
readOnly?: boolean;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('issue.fieldSelects');
const none = t('noAssignee');
@@ -45,14 +49,16 @@ export default function AssigneeSelect({
<PopoverPick
readOnly={readOnly}
trigger={
- <Pill active={!!assignee}>
- {assignee ? (
- <Avatar name={assignee.name} image={assignee.image} className="size-4 text-[8px]" />
- ) : (
- <CircleDashed />
- )}
- <span className="truncate">{assignee?.name ?? placeholder ?? none}</span>
- </Pill>
+ trigger ?? (
+ <Pill active={!!assignee}>
+ {assignee ? (
+ <Avatar name={assignee.name} image={assignee.image} className="size-4 text-[8px]" />
+ ) : (
+ <CircleDashed />
+ )}
+ <span className="truncate">{assignee?.name ?? placeholder ?? none}</span>
+ </Pill>
+ )
}
inputPlaceholder={t('assignTo')}
emptyText={t('noMembers')}
diff --git a/apps/web/src/components/common/fields/DateTimePill.tsx b/apps/web/src/components/common/fields/DateTimePill.tsx
index f485b58b..191068ca 100644
--- a/apps/web/src/components/common/fields/DateTimePill.tsx
+++ b/apps/web/src/components/common/fields/DateTimePill.tsx
@@ -1,4 +1,4 @@
-import { useId, useState } from 'react';
+import { useId, useState, type ReactNode } from 'react';
import { CalendarClock } from 'lucide-react';
import {
formatDateTimeRange,
@@ -42,6 +42,7 @@ export default function DateTimePill({
placeholder,
onChange,
readOnly,
+ trigger,
}: {
value: string | null;
valueEnd: string | null;
@@ -50,6 +51,8 @@ export default function DateTimePill({
placeholder?: string;
onChange: (value: string | null, valueEnd: string | null) => void;
readOnly?: boolean;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('common');
const tField = useTranslations('issue.customFields');
@@ -62,7 +65,7 @@ export default function DateTimePill({
const startTime = start?.time ?? DEFAULT_START;
const endTime = end?.time ?? DEFAULT_END;
- const pill = (
+ const pill = trigger ?? (
<Pill active={!!value}>
<CalendarClock />
<span className="truncate">
diff --git a/apps/web/src/components/common/fields/LabelsSelect.tsx b/apps/web/src/components/common/fields/LabelsSelect.tsx
index 191a2044..7b1c80c8 100644
--- a/apps/web/src/components/common/fields/LabelsSelect.tsx
+++ b/apps/web/src/components/common/fields/LabelsSelect.tsx
@@ -1,3 +1,4 @@
+import { type ReactNode } from 'react';
import { Tag } from 'lucide-react';
import type { Label, LabelGroup } from '@/lib/api/endpoints/labels';
import { Pill } from './Pill';
@@ -11,16 +12,19 @@ export default function LabelsSelect({
value,
onToggle,
readOnly,
+ trigger: ownTrigger,
}: {
labels: Label[];
groups: LabelGroup[];
value: number[];
onToggle: (id: number) => void;
readOnly?: boolean;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('issue.fieldSelects');
const selected = labels.filter((l) => value.includes(l.id));
- const trigger = (
+ const trigger = ownTrigger ?? (
<Pill active={selected.length > 0}>
{selected.length > 0 ? (
<span className="flex -space-x-1">
diff --git a/apps/web/src/components/common/fields/PrioritySelect.tsx b/apps/web/src/components/common/fields/PrioritySelect.tsx
index 0b8eb341..8e2e63d4 100644
--- a/apps/web/src/components/common/fields/PrioritySelect.tsx
+++ b/apps/web/src/components/common/fields/PrioritySelect.tsx
@@ -1,3 +1,4 @@
+import { type ReactNode } from 'react';
import { useTranslations } from 'next-intl';
import { usePriorityLabel } from '@/hooks/usePriorityLabel';
import { Pill } from './Pill';
@@ -9,10 +10,13 @@ export default function PrioritySelect({
value,
onChange,
readOnly,
+ trigger,
}: {
value: string;
onChange: (v: string) => void;
readOnly?: boolean;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('common.priority');
const priorityLabel = usePriorityLabel();
@@ -21,10 +25,12 @@ export default function PrioritySelect({
<PopoverPick
readOnly={readOnly}
trigger={
- <Pill active={!!value}>
- {prio.icon}
- <span className="truncate">{value ? priorityLabel(value) : t('label')}</span>
- </Pill>
+ trigger ?? (
+ <Pill active={!!value}>
+ {prio.icon}
+ <span className="truncate">{value ? priorityLabel(value) : t('label')}</span>
+ </Pill>
+ )
}
inputPlaceholder={t('setTo')}
items={PRIORITY_FIELDS.map((p) => ({
diff --git a/apps/web/src/components/common/fields/StatusSelect.tsx b/apps/web/src/components/common/fields/StatusSelect.tsx
index 02977ef8..35e9aabc 100644
--- a/apps/web/src/components/common/fields/StatusSelect.tsx
+++ b/apps/web/src/components/common/fields/StatusSelect.tsx
@@ -1,3 +1,4 @@
+import { type ReactNode } from 'react';
import { CircleDashed } from 'lucide-react';
import type { Column } from '@/lib/api/endpoints/columns';
import { colorDot } from './colorDot';
@@ -11,6 +12,7 @@ export default function StatusSelect({
onChange,
onClear,
readOnly,
+ trigger,
}: {
columns: Column[];
// Null only where nothing is picked yet: an issue always has a state, a template
@@ -21,6 +23,8 @@ export default function StatusSelect({
// only a caller that presets one (an issue template) can clear it.
onClear?: () => void;
readOnly?: boolean;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('issue.fieldSelects');
const column = columns.find((c) => c.id === value);
@@ -28,10 +32,12 @@ export default function StatusSelect({
<PopoverPick
readOnly={readOnly}
trigger={
- <Pill active={column != null}>
- {column ? colorDot(column.color) : <CircleDashed />}
- <span className="truncate">{column?.name ?? t('state')}</span>
- </Pill>
+ trigger ?? (
+ <Pill active={column != null}>
+ {column ? colorDot(column.color) : <CircleDashed />}
+ <span className="truncate">{column?.name ?? t('state')}</span>
+ </Pill>
+ )
}
inputPlaceholder={t('changeState')}
emptyText={t('noState')}
diff --git a/apps/web/src/components/common/fields/TypeSelect.tsx b/apps/web/src/components/common/fields/TypeSelect.tsx
index e87b5296..49011e95 100644
--- a/apps/web/src/components/common/fields/TypeSelect.tsx
+++ b/apps/web/src/components/common/fields/TypeSelect.tsx
@@ -1,3 +1,4 @@
+import { type ReactNode } from 'react';
import { CircleDashed } from 'lucide-react';
import type { IssueType } from '@/lib/api/endpoints/issueTypes';
import { colorDot } from './colorDot';
@@ -10,11 +11,14 @@ export default function TypeSelect({
value,
onChange,
readOnly,
+ trigger,
}: {
issueTypes: IssueType[];
value: number | null;
onChange: (id: number | null) => void;
readOnly?: boolean;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('issue.fieldSelects');
const type = issueTypes.find((t) => t.id === value);
@@ -22,10 +26,12 @@ export default function TypeSelect({
<PopoverPick
readOnly={readOnly}
trigger={
- <Pill active={!!type}>
- {type ? colorDot(type.color) : <CircleDashed />}
- <span className="truncate">{type?.name ?? t('type')}</span>
- </Pill>
+ trigger ?? (
+ <Pill active={!!type}>
+ {type ? colorDot(type.color) : <CircleDashed />}
+ <span className="truncate">{type?.name ?? t('type')}</span>
+ </Pill>
+ )
}
inputPlaceholder={t('changeType')}
items={[
diff --git a/apps/web/src/components/common/timeline/TimelineHeader.tsx b/apps/web/src/components/common/timeline/TimelineHeader.tsx
index c8834496..1854d9de 100644
--- a/apps/web/src/components/common/timeline/TimelineHeader.tsx
+++ b/apps/web/src/components/common/timeline/TimelineHeader.tsx
@@ -1,3 +1,4 @@
+import { type ReactNode } from 'react';
import { startOfDay } from 'date-fns';
import { daysBetween } from '@/utils/dates';
import { type MonthLabel } from '@/utils/timelineTrack';
@@ -11,20 +12,22 @@ export function TimelineHeader({
dayW,
months,
days,
+ corner,
}: {
labelW: number;
trackWidth: number;
dayW: number;
months: MonthLabel[];
days: Date[];
+ // What the corner over the label column shows; empty when absent.
+ corner?: ReactNode;
}) {
const today = startOfDay(new Date());
return (
<div className="sticky top-0 z-20 flex border-b bg-background">
- <div
- className="sticky left-0 z-10 shrink-0 border-r bg-background"
- style={{ width: labelW }}
- />
+ <div className="sticky left-0 z-10 shrink-0 border-r bg-background" style={{ width: labelW }}>
+ {corner}
+ </div>
<div className="relative" style={{ width: trackWidth, height: 44 }}>
<div className="relative h-5 border-b">
{months.map((m) => (
diff --git a/apps/web/src/components/layout/TableProperties.tsx b/apps/web/src/components/layout/ColumnProperties.tsx
similarity index 73%
rename from apps/web/src/components/layout/TableProperties.tsx
rename to apps/web/src/components/layout/ColumnProperties.tsx
index c70f7d9b..64118477 100644
--- a/apps/web/src/components/layout/TableProperties.tsx
+++ b/apps/web/src/components/layout/ColumnProperties.tsx
@@ -7,10 +7,10 @@ import type { CustomField } from '@/lib/api/endpoints/customFields';
import type { IssueType } from '@/lib/api/endpoints/issueTypes';
import { useDndSensors } from '@/lib/dnd';
import {
- DISPLAY_PROPERTIES,
customFieldId,
isCustomFieldKey,
- offeredDisplayProperties,
+ isFieldEnabled,
+ type DisplayProperty,
type PropertyKey,
} from '@/utils/viewSettings';
import { useProjectFeatures } from '@/hooks/useProjectFeatures';
@@ -18,19 +18,25 @@ import CustomFieldMenu from '@/components/layout/CustomFieldMenu';
import PropertyChip from '@/components/layout/PropertyChip';
import SortablePropertyChip from '@/components/layout/SortablePropertyChip';
-// The Table view's Display-properties chips: enabled properties first as a
-// horizontal sortable list (drag to reorder — this is the column order), then
-// the not-yet-shown built-in properties, then the "…" custom-field picker.
-// Clicking an enabled chip removes it; clicking a disabled one adds it (to the
-// end). onChange receives the new ordered `properties` list.
-export default function TableProperties({
+// The Display-properties chips of a layout that shows properties as columns (Table,
+// Timeline): enabled properties first as a horizontal sortable list (drag to
+// reorder — this is the column order), then the not-yet-shown built-in properties,
+// then the "…" custom-field picker. Clicking an enabled chip removes it; clicking a
+// disabled one adds it (to the end). onChange receives the new ordered `properties`
+// list. A stored key the layout does not render gets no chip.
+export default function ColumnProperties({
properties,
+ builtins,
customFields,
issueTypes,
onChange,
trailing,
}: {
properties: PropertyKey[];
+ // The built-in properties the layout renders; `customFields` holds only the fields
+ // it renders. One whose section is off is not offered, but keeps its chip while
+ // enabled, so it can still be removed.
+ builtins: DisplayProperty[];
customFields: CustomField[];
issueTypes: IssueType[];
onChange: (properties: PropertyKey[]) => void;
@@ -41,17 +47,18 @@ export default function TableProperties({
const t = byKey(useTranslations('display.properties'));
const sensors = useDndSensors();
const fieldById = new Map(customFields.map((f) => [f.id, f]));
- const builtins = new Set<PropertyKey>(DISPLAY_PROPERTIES);
+ const rendered = new Set<PropertyKey>(builtins);
const labelFor = (key: PropertyKey): string | null => {
if (isCustomFieldKey(key)) return fieldById.get(customFieldId(key))?.name ?? null;
- return builtins.has(key) ? t(key) : null;
+ return rendered.has(key) ? t(key) : null;
};
- // Enabled keys in display order, dropping any stale (deleted custom field) key.
const enabled = properties.filter((k) => labelFor(k) != null);
const enabledSet = new Set(properties);
const features = useProjectFeatures();
- const disabledBuiltins = offeredDisplayProperties(features).filter((p) => !enabledSet.has(p));
+ const disabledBuiltins = builtins.filter(
+ (p) => !enabledSet.has(p) && isFieldEnabled(p, features),
+ );
const toggle = (key: PropertyKey) =>
onChange(enabledSet.has(key) ? properties.filter((p) => p !== key) : [...properties, key]);
diff --git a/apps/web/src/components/layout/DisplayPropertiesSection.tsx b/apps/web/src/components/layout/DisplayPropertiesSection.tsx
index fd333229..af111c85 100644
--- a/apps/web/src/components/layout/DisplayPropertiesSection.tsx
+++ b/apps/web/src/components/layout/DisplayPropertiesSection.tsx
@@ -3,6 +3,8 @@ import { byKey } from '@/utils/messageKey';
import type { CustomField } from '@/lib/api/endpoints/customFields';
import type { IssueType } from '@/lib/api/endpoints/issueTypes';
import {
+ DISPLAY_PROPERTIES,
+ isTimelineField,
offeredDisplayProperties,
type PropertyKey,
type ViewSettings,
@@ -10,10 +12,10 @@ import {
import type { WorkItemsView } from '@/utils/viewTypes';
import { useProjectFeatures } from '@/hooks/useProjectFeatures';
import PropertyChip from '@/components/layout/PropertyChip';
-import TableProperties from '@/components/layout/TableProperties';
+import ColumnProperties from '@/components/layout/ColumnProperties';
-// The Display properties block. On the Table layout the chips are the column
-// list, sortable and extendable with custom fields; on Project they are plain
+// The Display properties block. On the Table and the Timeline the chips are the
+// column list, sortable and extendable with custom fields; on Project they are plain
// on/off chips for the built-in properties. The Nested subtasks chip is neither a
// column nor a property — it toggles the subtask rows under a card or row — so it
// sits after the property chips.
@@ -51,6 +53,9 @@ export default function DisplayPropertiesSection({
onClick={() => onChange({ showSubtasks: !settings.showSubtasks })}
/>
) : null;
+ // The Timeline offers neither the identifier, which its title column always
+ // shows, nor a text or markdown field, and toggles the subtasks in a row of its own.
+ const timeline = view === 'timeline';
return (
<div className="space-y-3 border-t pt-2">
@@ -58,13 +63,14 @@ export default function DisplayPropertiesSection({
{t('rows.displayProperties')}
</p>
<div className="flex flex-wrap items-center gap-1 px-1">
- {view === 'table' ? (
- <TableProperties
+ {view === 'table' || timeline ? (
+ <ColumnProperties
properties={settings.properties}
- customFields={customFields}
+ builtins={timeline ? DISPLAY_PROPERTIES.filter((p) => p !== 'id') : DISPLAY_PROPERTIES}
+ customFields={timeline ? customFields.filter(isTimelineField) : customFields}
issueTypes={issueTypes}
onChange={(properties) => onChange({ properties })}
- trailing={subtasksChip}
+ trailing={timeline ? null : subtasksChip}
/>
) : (
<>
diff --git a/apps/web/src/components/layout/DisplaySettingsBody.tsx b/apps/web/src/components/layout/DisplaySettingsBody.tsx
index 1c3e394c..ba6a516c 100644
--- a/apps/web/src/components/layout/DisplaySettingsBody.tsx
+++ b/apps/web/src/components/layout/DisplaySettingsBody.tsx
@@ -46,7 +46,7 @@ export default function DisplaySettingsBody({
<DisplayCalendarRows settings={settings} customFields={customFields} onChange={set} />
)}
- {(view === 'kanban' || view === 'table') && (
+ {(view === 'kanban' || view === 'table' || view === 'timeline') && (
<DisplayPropertiesSection
view={view}
settings={settings}
diff --git a/apps/web/src/components/layout/SortablePropertyChip.tsx b/apps/web/src/components/layout/SortablePropertyChip.tsx
index 7ccc0b54..d1447efb 100644
--- a/apps/web/src/components/layout/SortablePropertyChip.tsx
+++ b/apps/web/src/components/layout/SortablePropertyChip.tsx
@@ -19,7 +19,9 @@ export default function SortablePropertyChip({
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
id,
});
- const style = { transform: CSS.Transform.toString(transform), transition };
+ // Translate only: the grid strategy also scales a chip to the size of the one it
+ // takes the place of, which stretches chips of different widths.
+ const style = { transform: CSS.Translate.toString(transform), transition };
return (
<span
ref={setNodeRef}
diff --git a/apps/web/src/features/issue/components/fields/CycleSelect.tsx b/apps/web/src/features/issue/components/fields/CycleSelect.tsx
index d8b6fd48..769f03c9 100644
--- a/apps/web/src/features/issue/components/fields/CycleSelect.tsx
+++ b/apps/web/src/features/issue/components/fields/CycleSelect.tsx
@@ -1,4 +1,4 @@
-import { useState } from 'react';
+import { useState, type ReactNode } from 'react';
import { Check, CircleDashed, RefreshCw } from 'lucide-react';
import type { CycleRef } from '@/lib/api/endpoints/issues';
import { useCycleOptionsQuery } from '@/services/cycles.service';
@@ -23,14 +23,19 @@ export default function CycleSelect({
projectKey,
value,
onChange,
+ trigger,
}: {
projectKey: string;
value: CycleRef | null;
onChange: (cycle: CycleRef | null) => void;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('issue.cycleSelect');
const [open, setOpen] = useState(false);
- const { data } = useCycleOptionsQuery(projectKey);
+ // A caller's own trigger shows the value itself, so then the list is read only
+ // while open: a Timeline mounts one select per row.
+ const { data } = useCycleOptionsQuery(trigger && !open ? null : projectKey);
const planned = data ?? [];
const cycles =
value && !planned.some((c) => c.id === value.id)
@@ -45,10 +50,12 @@ export default function CycleSelect({
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
- <Pill active={value != null}>
- {value != null ? <RefreshCw /> : <CircleDashed />}
- <span className="truncate">{value?.name ?? t('label')}</span>
- </Pill>
+ {trigger ?? (
+ <Pill active={value != null}>
+ {value != null ? <RefreshCw /> : <CircleDashed />}
+ <span className="truncate">{value?.name ?? t('label')}</span>
+ </Pill>
+ )}
</PopoverTrigger>
<PopoverContent className="w-56 p-0" align="start">
<Command>
diff --git a/apps/web/src/features/issue/components/fields/DelegateSelect.tsx b/apps/web/src/features/issue/components/fields/DelegateSelect.tsx
index b216b7d9..1eb259a6 100644
--- a/apps/web/src/features/issue/components/fields/DelegateSelect.tsx
+++ b/apps/web/src/features/issue/components/fields/DelegateSelect.tsx
@@ -1,3 +1,4 @@
+import { type ReactNode } from 'react';
import { CircleDashed } from 'lucide-react';
import { useTranslations } from 'next-intl';
import type { Assignee } from '@/lib/api/endpoints/projects';
@@ -14,12 +15,15 @@ export default function DelegateSelect({
onChange,
placeholder,
readOnly,
+ trigger,
}: {
assignees: Assignee[];
value: string | null;
onChange: (userId: string | null) => void;
placeholder?: string;
readOnly?: boolean;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('issue.fieldSelects');
const none = t('noDelegate');
@@ -31,14 +35,16 @@ export default function DelegateSelect({
<PopoverPick
readOnly={readOnly}
trigger={
- <Pill active={!!delegate}>
- {delegate ? (
- <Avatar name={delegate.name} image={delegate.image} className="size-4 text-[8px]" />
- ) : (
- <CircleDashed />
- )}
- <span className="truncate">{delegate?.name ?? placeholder ?? none}</span>
- </Pill>
+ trigger ?? (
+ <Pill active={!!delegate}>
+ {delegate ? (
+ <Avatar name={delegate.name} image={delegate.image} className="size-4 text-[8px]" />
+ ) : (
+ <CircleDashed />
+ )}
+ <span className="truncate">{delegate?.name ?? placeholder ?? none}</span>
+ </Pill>
+ )
}
inputPlaceholder={t('delegateTo')}
emptyText={t('noAgents')}
diff --git a/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx b/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx
index 1620f10e..3bed40be 100644
--- a/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx
+++ b/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx
@@ -1,4 +1,4 @@
-import { useState } from 'react';
+import { useState, type ReactNode } from 'react';
import { Check, CircleDashed, Plus, Target } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { usePermissions } from '@/hooks/usePermissions';
@@ -23,10 +23,13 @@ export default function InitiativeSelect({
projectKey,
value,
onChange,
+ trigger,
}: {
projectKey: string;
value: number | null;
onChange: (id: number | null) => void;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('initiatives.select');
const { can } = usePermissions();
@@ -35,8 +38,10 @@ export default function InitiativeSelect({
const [query, setQuery] = useState('');
// The linked initiative is asked for by id alongside the search, so it labels the
- // trigger and stays listed even once it is closed.
- const { data } = useInitiativeOptionsQuery(projectKey, {
+ // trigger and stays listed even once it is closed. A caller's own trigger shows
+ // the value itself, so then the list is read only while open: a Timeline mounts
+ // one select per row.
+ const { data } = useInitiativeOptionsQuery(trigger && !open ? null : projectKey, {
search: query.trim() || undefined,
include: value ?? undefined,
});
@@ -58,10 +63,12 @@ export default function InitiativeSelect({
}}
>
<PopoverTrigger asChild>
- <Pill active={value != null}>
- {value != null ? <Target /> : <CircleDashed />}
- <span className="truncate">{current?.title ?? t('label')}</span>
- </Pill>
+ {trigger ?? (
+ <Pill active={value != null}>
+ {value != null ? <Target /> : <CircleDashed />}
+ <span className="truncate">{current?.title ?? t('label')}</span>
+ </Pill>
+ )}
</PopoverTrigger>
<PopoverContent className="w-56 p-0" align="start">
<Command shouldFilter={false}>
diff --git a/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx b/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx
index d20027dd..3f2f51a7 100644
--- a/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx
+++ b/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx
@@ -1,6 +1,6 @@
import type { CustomField } from '@/lib/api/endpoints/customFields';
import type { Assignee } from '@/lib/api/endpoints/projects';
-import type { IssueFieldValue, IssueFieldValueInput } from '@/lib/api/endpoints/issues';
+import type { IssueFieldValueEntry, IssueFieldValueInput } from '@/lib/api/endpoints/issues';
import { formatDate, formatDateTimeRange } from '@/utils/dates';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
@@ -36,7 +36,7 @@ export default function IssueCustomFieldControl({
readOnly,
}: {
def: CustomField;
- current: IssueFieldValue | undefined;
+ current: IssueFieldValueEntry | undefined;
assignees: Assignee[];
saveKey: string;
onChange: (value: IssueFieldValueInput) => void;
diff --git a/apps/web/src/features/issue/components/fields/MemberSelect.tsx b/apps/web/src/features/issue/components/fields/MemberSelect.tsx
index 389cfcb8..2446a98e 100644
--- a/apps/web/src/features/issue/components/fields/MemberSelect.tsx
+++ b/apps/web/src/features/issue/components/fields/MemberSelect.tsx
@@ -1,3 +1,4 @@
+import { type ReactNode } from 'react';
import { CircleDashed } from 'lucide-react';
import { useTranslations } from 'next-intl';
import type { MemberScope } from '@/lib/api/endpoints/customFields';
@@ -26,12 +27,15 @@ export default function MemberSelect({
value,
onChange,
placeholder,
+ trigger,
}: {
assignees: Assignee[];
scope: MemberScope;
value: string | null;
onChange: (userId: string | null) => void;
placeholder?: string;
+ // Replaces the pill where a caller needs its own (a Timeline cell).
+ trigger?: ReactNode;
}) {
const t = useTranslations('issue.fieldSelects');
const none = t('noMember');
@@ -42,14 +46,16 @@ export default function MemberSelect({
return (
<PopoverPick
trigger={
- <Pill active={!!selected}>
- {selected ? (
- <Avatar name={selected.name} image={selected.image} className="size-4 text-[8px]" />
- ) : (
- <CircleDashed />
- )}
- <span className="truncate">{selected?.name ?? placeholder ?? none}</span>
- </Pill>
+ trigger ?? (
+ <Pill active={!!selected}>
+ {selected ? (
+ <Avatar name={selected.name} image={selected.image} className="size-4 text-[8px]" />
+ ) : (
+ <CircleDashed />
+ )}
+ <span className="truncate">{selected?.name ?? placeholder ?? none}</span>
+ </Pill>
+ )
}
inputPlaceholder={t('pickMember')}
emptyText={t('noCandidates')}
diff --git a/apps/web/src/features/work-items/components/shared/PersonValue.tsx b/apps/web/src/features/work-items/components/shared/PersonValue.tsx
new file mode 100644
index 00000000..fdbdba76
--- /dev/null
+++ b/apps/web/src/features/work-items/components/shared/PersonValue.tsx
@@ -0,0 +1,19 @@
+import type { Assignee } from '@/lib/api/endpoints/projects';
+import Avatar from '@/components/common/Avatar';
+
+// A person or an agent named beside their avatar, or a dash for nobody.
+export function PersonValue({ person }: { person: Assignee | undefined }) {
+ if (!person) {
+ return (
+ <div>
+ <span className="text-muted-foreground/40">—</span>
+ </div>
+ );
+ }
+ return (
+ <div className="flex min-w-0 items-center gap-1.5 text-xs">
+ <Avatar name={person.name} image={person.image} className="size-4 text-[8px]" />
+ <span className="truncate">{person.name}</span>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/work-items/components/table/TableCustomCell.tsx b/apps/web/src/features/work-items/components/table/TableCustomCell.tsx
index 133ceb1a..ad5a0def 100644
--- a/apps/web/src/features/work-items/components/table/TableCustomCell.tsx
+++ b/apps/web/src/features/work-items/components/table/TableCustomCell.tsx
@@ -3,8 +3,8 @@ import type { CustomField } from '@/lib/api/endpoints/customFields';
import type { Issue } from '@/lib/api/endpoints/issues';
import { type Maps } from '@/utils/project';
import { formatDateTimeRange, formatShortDate } from '@/utils/dates';
-import Avatar from '@/components/common/Avatar';
import { colorDot } from '@/components/common/fields/colorDot';
+import { PersonValue } from '../shared/PersonValue';
import { MarkdownCell } from './MarkdownCell';
const DASH = <span className="text-muted-foreground/40">—</span>;
@@ -46,14 +46,10 @@ export function TableCustomCell({
}
if (field.fieldType === 'member') {
- const member =
- typeof entry?.value === 'string' ? maps.assigneeById.get(entry.value) : undefined;
- if (!member) return <div>{DASH}</div>;
return (
- <div className="flex min-w-0 items-center gap-1.5 text-xs">
- <Avatar name={member.name} image={member.image} className="size-4 text-[8px]" />
- <span className="truncate">{member.name}</span>
- </div>
+ <PersonValue
+ person={typeof entry?.value === 'string' ? maps.assigneeById.get(entry.value) : undefined}
+ />
);
}
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineBuiltinCell.tsx b/apps/web/src/features/work-items/components/timeline/TimelineBuiltinCell.tsx
new file mode 100644
index 00000000..6ef650c1
--- /dev/null
+++ b/apps/web/src/features/work-items/components/timeline/TimelineBuiltinCell.tsx
@@ -0,0 +1,152 @@
+import type { ProjectDetail } from '@/lib/api/endpoints/projects';
+import type { Issue, IssuePatch } from '@/lib/api/endpoints/issues';
+import { type Maps } from '@/utils/project';
+import { parseDate } from '@/utils/dates';
+import AssigneeSelect from '@/components/common/fields/AssigneeSelect';
+import DatePill from '@/components/common/fields/DatePill';
+import LabelsSelect from '@/components/common/fields/LabelsSelect';
+import PrioritySelect from '@/components/common/fields/PrioritySelect';
+import StatusSelect from '@/components/common/fields/StatusSelect';
+import TypeSelect from '@/components/common/fields/TypeSelect';
+import CycleSelect from '@/features/issue/components/fields/CycleSelect';
+import DelegateSelect from '@/features/issue/components/fields/DelegateSelect';
+import InitiativeSelect from '@/features/issue/components/fields/InitiativeSelect';
+import { type TableColumn } from '../../utils/table';
+import { PersonValue } from '../shared/PersonValue';
+import { TableBuiltinCell } from '../table/TableBuiltinCell';
+import { TimelineCellButton } from './TimelineCellButton';
+
+// One built-in property cell on a timeline row. It reads like a Table cell, except
+// that the assignee and the delegate are named; when the issue can be edited, a
+// click opens the picker the issue panel uses for that field. The estimates and the
+// times are shown only.
+export function TimelineBuiltinCell({
+ column,
+ issue,
+ project,
+ maps,
+ readOnly,
+ onPatch,
+}: {
+ column: TableColumn;
+ issue: Issue;
+ project: ProjectDetail;
+ maps: Maps;
+ readOnly: boolean;
+ onPatch: (patch: IssuePatch) => void;
+}) {
+ const isPerson = column === 'assignee' || column === 'delegate';
+ const personId = column === 'assignee' ? issue.assigneeUserId : issue.delegateUserId;
+ const value = isPerson ? (
+ <PersonValue person={personId != null ? maps.assigneeById.get(personId) : undefined} />
+ ) : (
+ <TableBuiltinCell column={column} issue={issue} maps={maps} />
+ );
+ if (readOnly) return value;
+ const trigger = <TimelineCellButton>{value}</TimelineCellButton>;
+
+ switch (column) {
+ case 'status':
+ return (
+ <StatusSelect
+ columns={project.columns}
+ value={issue.columnId}
+ onChange={(id) => onPatch({ columnId: id })}
+ trigger={trigger}
+ />
+ );
+ case 'priority':
+ return (
+ <PrioritySelect
+ value={issue.priority ?? ''}
+ onChange={(v) => onPatch({ priority: v || null })}
+ trigger={trigger}
+ />
+ );
+ case 'type':
+ return (
+ <TypeSelect
+ issueTypes={project.issueTypes}
+ value={issue.typeId}
+ onChange={(id) => onPatch({ typeId: id })}
+ trigger={trigger}
+ />
+ );
+ case 'assignee':
+ return (
+ <AssigneeSelect
+ assignees={project.assignees}
+ value={issue.assigneeUserId}
+ onChange={(userId) => onPatch({ assigneeUserId: userId })}
+ trigger={trigger}
+ />
+ );
+ case 'delegate':
+ return (
+ <DelegateSelect
+ assignees={project.assignees}
+ value={issue.delegateUserId}
+ onChange={(userId) => onPatch({ delegateUserId: userId })}
+ trigger={trigger}
+ />
+ );
+ case 'labels':
+ return (
+ <LabelsSelect
+ labels={project.labels}
+ groups={project.labelGroups}
+ value={issue.labelIds}
+ onToggle={(id) =>
+ onPatch({
+ labelIds: issue.labelIds.includes(id)
+ ? issue.labelIds.filter((x) => x !== id)
+ : [...issue.labelIds, id],
+ })
+ }
+ trigger={trigger}
+ />
+ );
+ case 'initiative':
+ return (
+ <InitiativeSelect
+ projectKey={project.project.ref}
+ value={issue.initiative?.id ?? null}
+ onChange={(id) => onPatch({ initiativeId: id })}
+ trigger={trigger}
+ />
+ );
+ case 'cycle':
+ return (
+ <CycleSelect
+ projectKey={project.project.ref}
+ value={issue.cycle}
+ onChange={(cycle) => onPatch({ cycleId: cycle?.id ?? null })}
+ trigger={trigger}
+ />
+ );
+ case 'startDate': {
+ const latestStart = parseDate(issue.dueDate);
+ return (
+ <DatePill
+ value={issue.startDate}
+ onChange={(v) => onPatch({ startDate: v })}
+ disabled={latestStart ? { after: latestStart } : undefined}
+ trigger={trigger}
+ />
+ );
+ }
+ case 'dueDate': {
+ const earliestDue = parseDate(issue.startDate);
+ return (
+ <DatePill
+ value={issue.dueDate}
+ onChange={(v) => onPatch({ dueDate: v })}
+ disabled={earliestDue ? { before: earliestDue } : undefined}
+ trigger={trigger}
+ />
+ );
+ }
+ default:
+ return value;
+ }
+}
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineCellButton.tsx b/apps/web/src/features/work-items/components/timeline/TimelineCellButton.tsx
new file mode 100644
index 00000000..5634da10
--- /dev/null
+++ b/apps/web/src/features/work-items/components/timeline/TimelineCellButton.tsx
@@ -0,0 +1,12 @@
+// A timeline cell's value as the button that opens its editor.
+export function TimelineCellButton({ children, ...props }: React.ComponentProps<'button'>) {
+ return (
+ <button
+ type="button"
+ className="-mx-1 flex h-6 min-w-0 items-center rounded px-1 text-start hover:bg-accent"
+ {...props}
+ >
+ {children}
+ </button>
+ );
+}
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineCells.tsx b/apps/web/src/features/work-items/components/timeline/TimelineCells.tsx
new file mode 100644
index 00000000..25b3dc26
--- /dev/null
+++ b/apps/web/src/features/work-items/components/timeline/TimelineCells.tsx
@@ -0,0 +1,58 @@
+import type { ProjectDetail } from '@/lib/api/endpoints/projects';
+import type { Issue, IssuePatch } from '@/lib/api/endpoints/issues';
+import { type Maps } from '@/utils/project';
+import { useSetFieldValue, useUpdateIssue } from '@/services/issues.service';
+import { columnKey } from '../../utils/table';
+import { type TimelineColumn } from '../../utils/timeline';
+import { TimelineBuiltinCell } from './TimelineBuiltinCell';
+import { TimelineCustomCell } from './TimelineCustomCell';
+
+// The property cells of one timeline row, after its title. They sit outside the
+// title, which drags the row and opens the issue, so an edit in a cell does neither.
+export function TimelineCells({
+ project,
+ issue,
+ maps,
+ columns,
+ readOnly,
+}: {
+ project: ProjectDetail;
+ issue: Issue;
+ maps: Maps;
+ columns: TimelineColumn[];
+ readOnly: boolean;
+}) {
+ const updateIssue = useUpdateIssue(project.project.ref);
+ const setFieldValue = useSetFieldValue(project.project.ref);
+ const patch = (fields: IssuePatch) => updateIssue.mutate({ id: issue.id, patch: fields });
+
+ return columns.map(({ column, width }) => (
+ <div
+ key={columnKey(column)}
+ className="grid shrink-0 items-center overflow-hidden px-1.5"
+ style={{ width }}
+ >
+ {column.kind === 'builtin' ? (
+ <TimelineBuiltinCell
+ column={column.col}
+ issue={issue}
+ project={project}
+ maps={maps}
+ readOnly={readOnly}
+ onPatch={patch}
+ />
+ ) : (
+ <TimelineCustomCell
+ field={column.field}
+ issue={issue}
+ project={project}
+ maps={maps}
+ readOnly={readOnly}
+ onChange={(value) =>
+ setFieldValue.mutate({ issueId: issue.id, fieldId: column.field.id, value })
+ }
+ />
+ )}
+ </div>
+ ));
+}
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineColumnHeader.tsx b/apps/web/src/features/work-items/components/timeline/TimelineColumnHeader.tsx
new file mode 100644
index 00000000..034010cc
--- /dev/null
+++ b/apps/web/src/features/work-items/components/timeline/TimelineColumnHeader.tsx
@@ -0,0 +1,34 @@
+import { useTranslations } from 'next-intl';
+import { byKey } from '@/utils/messageKey';
+import { columnKey, type OrderedColumn } from '../../utils/table';
+import { type TimelineColumn } from '../../utils/timeline';
+
+// The labels over the label column: the title and each property column, level with
+// the day numbers and as wide as the cells below them. Unlike the Table header, a
+// person column is named, since its cells name the person.
+export function TimelineColumnHeader({ columns }: { columns: TimelineColumn[] }) {
+ const t = useTranslations('workItems');
+ const property = byKey(useTranslations('display.properties'));
+ const labelOf = (column: OrderedColumn): string => {
+ if (column.kind === 'custom') return column.field.name;
+ if (column.col === 'assignee' || column.col === 'delegate') return property(column.col);
+ return t(`columns.${column.col}`);
+ };
+
+ return (
+ <div className="flex h-full items-end text-xs font-medium text-muted-foreground">
+ <div className="flex h-6 min-w-0 flex-1 items-center px-3">
+ <span className="truncate">{t('columns.title')}</span>
+ </div>
+ {columns.map(({ column, width }) => (
+ <div
+ key={columnKey(column)}
+ className="flex h-6 shrink-0 items-center overflow-hidden px-1.5"
+ style={{ width }}
+ >
+ <span className="truncate">{labelOf(column)}</span>
+ </div>
+ ))}
+ </div>
+ );
+}
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineCustomCell.tsx b/apps/web/src/features/work-items/components/timeline/TimelineCustomCell.tsx
new file mode 100644
index 00000000..5de5a221
--- /dev/null
+++ b/apps/web/src/features/work-items/components/timeline/TimelineCustomCell.tsx
@@ -0,0 +1,144 @@
+import { CircleDashed } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import type { CustomField } from '@/lib/api/endpoints/customFields';
+import type { Issue, IssueFieldValueInput } from '@/lib/api/endpoints/issues';
+import type { ProjectDetail } from '@/lib/api/endpoints/projects';
+import { type Maps } from '@/utils/project';
+import { Checkbox } from '@/components/ui/checkbox';
+import { colorDot } from '@/components/common/fields/colorDot';
+import DatePill from '@/components/common/fields/DatePill';
+import DateTimePill from '@/components/common/fields/DateTimePill';
+import PopoverPick from '@/components/common/fields/PopoverPick';
+import MemberSelect from '@/features/issue/components/fields/MemberSelect';
+import { TableCustomCell } from '../table/TableCustomCell';
+import { TimelineCellButton } from './TimelineCellButton';
+import { TimelineFieldPopover } from './TimelineFieldPopover';
+
+// One custom field cell on a timeline row. It reads like a Table cell; when the
+// issue can be edited and its type holds the field, a click opens the field's
+// editor: the issue panel's own, or for a select the picker the other fields use.
+export function TimelineCustomCell({
+ field,
+ issue,
+ project,
+ maps,
+ readOnly,
+ onChange,
+}: {
+ field: CustomField;
+ issue: Issue;
+ project: ProjectDetail;
+ maps: Maps;
+ readOnly: boolean;
+ onChange: (value: IssueFieldValueInput) => void;
+}) {
+ const t = useTranslations('issue.customFields');
+ const value = <TableCustomCell field={field} issue={issue} maps={maps} />;
+ if (readOnly || (field.issueTypeId != null && field.issueTypeId !== issue.typeId)) return value;
+
+ const entry = issue.fieldValues.find((v) => v.fieldId === field.id);
+ const raw = entry?.value ?? null;
+ const trigger = <TimelineCellButton>{value}</TimelineCellButton>;
+
+ switch (field.fieldType) {
+ case 'boolean':
+ return (
+ <Checkbox
+ checked={raw === true}
+ onCheckedChange={(checked) => onChange({ value: checked === true })}
+ />
+ );
+ case 'member':
+ return (
+ <MemberSelect
+ assignees={project.assignees}
+ scope={field.memberScope ?? 'all'}
+ value={typeof raw === 'string' ? raw : null}
+ onChange={(userId) => onChange({ value: userId })}
+ trigger={trigger}
+ />
+ );
+ case 'date':
+ return (
+ <DatePill
+ value={typeof raw === 'string' ? raw : null}
+ onChange={(v) => onChange({ value: v })}
+ trigger={trigger}
+ />
+ );
+ case 'datetime':
+ case 'datetime_range':
+ return (
+ <DateTimePill
+ value={typeof raw === 'string' ? raw : null}
+ valueEnd={entry?.valueEnd ?? null}
+ range={field.fieldType === 'datetime_range'}
+ onChange={(v, valueEnd) => onChange({ value: v, valueEnd })}
+ trigger={trigger}
+ />
+ );
+ case 'select':
+ case 'multi_select': {
+ const single = field.fieldType === 'select';
+ const selected = entry?.optionIds ?? [];
+ return (
+ <PopoverPick
+ trigger={trigger}
+ inputPlaceholder={t('pickOption')}
+ emptyText={t('noOptions')}
+ closeOnSelect={single}
+ items={[
+ ...(single
+ ? [
+ {
+ key: 'none',
+ search: t('noOption'),
+ icon: <CircleDashed />,
+ label: t('noOption'),
+ selected: selected.length === 0,
+ onSelect: () => onChange({ optionIds: [] }),
+ },
+ ]
+ : []),
+ ...field.options.map((o) => ({
+ key: String(o.id),
+ search: o.value,
+ icon: colorDot(o.color),
+ label: o.value,
+ selected: selected.includes(o.id),
+ onSelect: () =>
+ onChange({
+ optionIds: single
+ ? [o.id]
+ : selected.includes(o.id)
+ ? selected.filter((id) => id !== o.id)
+ : [...selected, o.id],
+ }),
+ })),
+ ]}
+ />
+ );
+ }
+ default:
+ // A url cell shows its address as text: the link to open it is in the
+ // editor, since a link cannot sit inside the button.
+ return (
+ <TimelineFieldPopover
+ trigger={
+ field.fieldType === 'url' && typeof raw === 'string' && raw !== '' ? (
+ <TimelineCellButton>
+ <span className="truncate text-xs text-muted-foreground">{raw}</span>
+ </TimelineCellButton>
+ ) : (
+ trigger
+ )
+ }
+ field={field}
+ entry={entry}
+ assignees={project.assignees}
+ saveKey={`${field.id}-${issue.updatedAt}`}
+ onChange={onChange}
+ />
+ );
+ }
+}
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineFieldPopover.tsx b/apps/web/src/features/work-items/components/timeline/TimelineFieldPopover.tsx
new file mode 100644
index 00000000..f67468ef
--- /dev/null
+++ b/apps/web/src/features/work-items/components/timeline/TimelineFieldPopover.tsx
@@ -0,0 +1,43 @@
+import { useState, type ReactNode } from 'react';
+import type { CustomField } from '@/lib/api/endpoints/customFields';
+import type { IssueFieldValueEntry, IssueFieldValueInput } from '@/lib/api/endpoints/issues';
+import type { Assignee } from '@/lib/api/endpoints/projects';
+import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
+import IssueCustomFieldControl from '@/features/issue/components/fields/IssueCustomFieldControl';
+
+// The editor of a custom field that the issue panel edits in place (a url, a
+// number), opened from a timeline cell. It closes once a value is saved.
+export function TimelineFieldPopover({
+ trigger,
+ field,
+ entry,
+ assignees,
+ saveKey,
+ onChange,
+}: {
+ trigger: ReactNode;
+ field: CustomField;
+ entry: IssueFieldValueEntry | undefined;
+ assignees: Assignee[];
+ saveKey: string;
+ onChange: (value: IssueFieldValueInput) => void;
+}) {
+ const [open, setOpen] = useState(false);
+ return (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>{trigger}</PopoverTrigger>
+ <PopoverContent className="w-auto p-2" align="start">
+ <IssueCustomFieldControl
+ def={field}
+ current={entry}
+ assignees={assignees}
+ saveKey={saveKey}
+ onChange={(value) => {
+ onChange(value);
+ setOpen(false);
+ }}
+ />
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx b/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx
index a46f94bc..bf6a1bc3 100644
--- a/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx
+++ b/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx
@@ -6,16 +6,18 @@ import { useIsPhone } from '@/hooks/useIsPhone';
import { cn } from '@/lib/utils';
import IssueContextMenu from '@/features/issue/components/actions/IssueContextMenu';
import { type TimelineDragMode } from '../../hooks/useTimelineDrag';
-import { ROW_H, type Span } from '../../utils/timeline';
+import { ROW_H, type Span, type TimelineColumn } from '../../utils/timeline';
import { IssueIdentifier } from '../shared/IssueIdentifier';
import { SubtaskProgress } from '../shared/SubtaskProgress';
import { useIssueSubtaskFold } from '../../context/useSubtasks';
import { TimelineBar } from './TimelineBar';
+import { TimelineCells } from './TimelineCells';
-// One issue row: the sticky label on the left and its bar on the day track.
-// Dragging the label moves the issue between sections and reorders it inside one
-// (the drop targets are the blocks around it); the bar moves the issue in time.
-// A click on either opens the issue.
+// One issue row: the sticky label on the left and its bar on the day track. The
+// label is the title and the property cells after it. Dragging the title moves the
+// issue between sections and reorders it inside one (the drop targets are the
+// blocks around it); the bar moves the issue in time. A click on either opens the
+// issue.
export function TimelineIssueRow({
project,
issue,
@@ -26,6 +28,7 @@ export function TimelineIssueRow({
active,
indented,
labelW,
+ columns,
trackWidth,
dayLines,
todayInRange,
@@ -44,11 +47,13 @@ export function TimelineIssueRow({
// Rows under a sub-section are indented to sit below their sub-header.
indented: boolean;
labelW: number;
+ columns: TimelineColumn[];
trackWidth: number;
dayLines: { backgroundImage: string };
todayInRange: boolean;
todayLeft: number;
- // In a read-only share nothing is draggable; a click still opens the issue.
+ // In a read-only share nothing is draggable or editable; a click still opens the
+ // issue.
readOnly?: boolean;
onBeginDrag: (e: React.PointerEvent, issue: Issue, mode: TimelineDragMode) => void;
onOpen: (id: number) => void;
@@ -65,31 +70,49 @@ export function TimelineIssueRow({
className={cn('flex border-b hover:bg-accent/20', isDragging && 'opacity-40')}
style={{ height: ROW_H }}
>
- <IssueContextMenu project={project} issue={issue}>
- <div
- ref={setNodeRef}
- {...attributes}
- {...listeners}
- className={cn(
- 'sticky left-0 z-10 flex shrink-0 items-center gap-2 overflow-hidden border-r bg-background pr-3',
- indented ? 'pl-7' : 'pl-3',
- readOnly ? 'cursor-pointer' : 'cursor-grab',
- )}
- style={{ width: labelW }}
- onClick={(e) => {
- e.preventDefault();
- onOpen(issue.id);
- }}
- >
- <IssueIdentifier
+ <div
+ className="sticky left-0 z-15 flex shrink-0 overflow-hidden border-r bg-background"
+ style={{ width: labelW }}
+ >
+ <IssueContextMenu project={project} issue={issue}>
+ <div
+ ref={setNodeRef}
+ {...attributes}
+ {...listeners}
+ className={cn(
+ 'flex min-w-0 flex-1 items-center gap-2 overflow-hidden pr-3',
+ indented ? 'pl-7' : 'pl-3',
+ readOnly ? 'cursor-pointer' : 'cursor-grab',
+ )}
+ onClick={(e) => {
+ e.preventDefault();
+ onOpen(issue.id);
+ }}
+ >
+ <IssueIdentifier
+ issue={issue}
+ className="text-xs text-muted-foreground tabular-nums"
+ onOpenParent={onOpen}
+ />
+ <span className="min-w-0 flex-1 truncate text-sm text-foreground">{issue.title}</span>
+ <SubtaskProgress
+ issueId={issue.id}
+ maps={maps}
+ open={fold.open}
+ onToggle={fold.toggle}
+ />
+ </div>
+ </IssueContextMenu>
+ {columns.length > 0 && (
+ <TimelineCells
+ project={project}
issue={issue}
- className="text-xs text-muted-foreground tabular-nums"
- onOpenParent={onOpen}
+ maps={maps}
+ columns={columns}
+ readOnly={!!readOnly}
/>
- <span className="min-w-0 flex-1 truncate text-sm text-foreground">{issue.title}</span>
- <SubtaskProgress issueId={issue.id} maps={maps} open={fold.open} onToggle={fold.toggle} />
- </div>
- </IssueContextMenu>
+ )}
+ </div>
<div className="relative" style={{ width: trackWidth, ...dayLines }}>
{todayInRange && (
<div
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineLinkRows.tsx b/apps/web/src/features/work-items/components/timeline/TimelineLinkRows.tsx
index 7ba5387a..f00a8dd2 100644
--- a/apps/web/src/features/work-items/components/timeline/TimelineLinkRows.tsx
+++ b/apps/web/src/features/work-items/components/timeline/TimelineLinkRows.tsx
@@ -1,19 +1,25 @@
import type { IssueLinkRef } from '@/lib/api/endpoints/issues';
+import type { ProjectDetail } from '@/lib/api/endpoints/projects';
import { issueColor, type Maps } from '@/utils/project';
import { cn } from '@/lib/utils';
import { useLinkRelationLabel } from '@/hooks/useLinkRelationLabel';
import { useIssueLinks } from '../../context/useIssueLinks';
-import { effSpan, LINK_ROW_H } from '../../utils/timeline';
+import { effSpan, LINK_ROW_H, type TimelineColumn } from '../../utils/timeline';
+import { TimelineCells } from './TimelineCells';
-// The issue's relations as sub-rows under its timeline row: the relation and the
-// linked issue on the left, that issue's own bar on the day track. The bars are
+// The issue's relations as sub-rows under its timeline row: the relation, the
+// linked issue and its property cells on the left, that issue's own bar on the day
+// track. The bars are
// read-only — the linked issue has its own row to be dragged on — and a click
// opens it.
export function TimelineLinkRows({
+ project,
links: refs,
indented,
maps,
labelW,
+ columns,
+ readOnly,
trackWidth,
dayLines,
todayInRange,
@@ -21,11 +27,14 @@ export function TimelineLinkRows({
spanToRect,
onOpen,
}: {
+ project: ProjectDetail;
links: IssueLinkRef[] | undefined;
// Follows the parent row's indent, so the sub-rows stay nested under it.
indented: boolean;
maps: Maps;
labelW: number;
+ columns: TimelineColumn[];
+ readOnly: boolean;
trackWidth: number;
dayLines: { backgroundImage: string };
todayInRange: boolean;
@@ -56,21 +65,34 @@ export function TimelineLinkRows({
style={{ height: LINK_ROW_H, borderTopStyle: 'solid' }}
>
<div
- className={cn(
- 'sticky left-0 z-10 flex shrink-0 cursor-pointer items-center gap-2 overflow-hidden border-r bg-background pr-3 text-xs text-muted-foreground',
- indented ? 'pl-13' : 'pl-9',
- )}
+ className="sticky left-0 z-15 flex shrink-0 overflow-hidden border-r bg-background"
style={{ width: labelW }}
- onClick={(e) => {
- e.preventDefault();
- onOpen(link.issue.id);
- }}
>
- {/* Fixed width so the identifiers stay in one column when a row
- leaves its relation unnamed. */}
- <span className="w-20 shrink-0">{named && relationLabel(link.relation)}</span>
- <span className="shrink-0 tabular-nums">{link.issue.identifier}</span>
- <span className="min-w-0 flex-1 truncate">{link.issue.title}</span>
+ <div
+ className={cn(
+ 'flex min-w-0 flex-1 cursor-pointer items-center gap-2 overflow-hidden pr-3 text-xs text-muted-foreground',
+ indented ? 'pl-13' : 'pl-9',
+ )}
+ onClick={(e) => {
+ e.preventDefault();
+ onOpen(link.issue.id);
+ }}
+ >
+ {/* Fixed width so the identifiers stay in one column when a row
+ leaves its relation unnamed. */}
+ <span className="w-20 shrink-0">{named && relationLabel(link.relation)}</span>
+ <span className="shrink-0 tabular-nums">{link.issue.identifier}</span>
+ <span className="min-w-0 flex-1 truncate">{link.issue.title}</span>
+ </div>
+ {columns.length > 0 && (
+ <TimelineCells
+ project={project}
+ issue={link.issue}
+ maps={maps}
+ columns={columns}
+ readOnly={readOnly}
+ />
+ )}
</div>
<div className="relative" style={{ width: trackWidth, ...dayLines }}>
{todayInRange && (
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineSubtaskRows.tsx b/apps/web/src/features/work-items/components/timeline/TimelineSubtaskRows.tsx
index 76547ca2..0e5eb7b2 100644
--- a/apps/web/src/features/work-items/components/timeline/TimelineSubtaskRows.tsx
+++ b/apps/web/src/features/work-items/components/timeline/TimelineSubtaskRows.tsx
@@ -1,21 +1,26 @@
import { CornerDownRight } from 'lucide-react';
import { useTranslations } from 'next-intl';
+import type { ProjectDetail } from '@/lib/api/endpoints/projects';
import { issueColor, type Maps } from '@/utils/project';
import { cn } from '@/lib/utils';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { useIssueSubtaskFold, useSubtasks } from '../../context/useSubtasks';
-import { effSpan, LINK_ROW_H } from '../../utils/timeline';
+import { effSpan, LINK_ROW_H, type TimelineColumn } from '../../utils/timeline';
+import { TimelineCells } from './TimelineCells';
// The issue's subtasks as sub-rows under its timeline row: each subtask named on
-// the left behind a nesting mark, with its own bar on the day track. How many are
-// done is on the issue row itself (SubtaskProgress). A subtask has no row of its
-// own, so the bars are read-only here as well — the dates are edited on the
-// subtask itself — and a click opens it.
+// the left behind a nesting mark and followed by its property cells, with its own
+// bar on the day track. How many are done is on the issue row itself
+// (SubtaskProgress). A subtask has no row of its own, so the bars are read-only
+// here as well — the dates are edited on the subtask itself — and a click opens it.
export function TimelineSubtaskRows({
+ project,
issueId,
indented,
maps,
labelW,
+ columns,
+ readOnly,
trackWidth,
dayLines,
todayInRange,
@@ -23,11 +28,14 @@ export function TimelineSubtaskRows({
spanToRect,
onOpen,
}: {
+ project: ProjectDetail;
issueId: number;
// Follows the parent row's indent, so the sub-rows stay nested under it.
indented: boolean;
maps: Maps;
labelW: number;
+ columns: TimelineColumn[];
+ readOnly: boolean;
trackWidth: number;
dayLines: { backgroundImage: string };
todayInRange: boolean;
@@ -59,23 +67,36 @@ export function TimelineSubtaskRows({
style={{ height: LINK_ROW_H }}
>
<div
- className={cn(
- 'sticky left-0 z-10 flex shrink-0 cursor-pointer items-center gap-2 overflow-hidden border-r bg-background pr-3 text-xs text-muted-foreground',
- indented ? 'pl-10' : 'pl-6',
- )}
+ className="sticky left-0 z-15 flex shrink-0 overflow-hidden border-r bg-background"
style={{ width: labelW }}
- onClick={(e) => {
- e.preventDefault();
- onOpen(subtask.id);
- }}
>
- {/* Marks the row as nested under the issue row above: the sub-rows
- are otherwise only indented, which reads as a link row. */}
- <CornerDownRight className="size-3 shrink-0 text-muted-foreground/60" />
- <span className="shrink-0 tabular-nums">{subtask.identifier}</span>
- <span className={cn('truncate', done && 'text-muted-foreground/60 line-through')}>
- {subtask.title}
- </span>
+ <div
+ className={cn(
+ 'flex min-w-0 flex-1 cursor-pointer items-center gap-2 overflow-hidden pr-3 text-xs text-muted-foreground',
+ indented ? 'pl-10' : 'pl-6',
+ )}
+ onClick={(e) => {
+ e.preventDefault();
+ onOpen(subtask.id);
+ }}
+ >
+ {/* Marks the row as nested under the issue row above: the sub-rows
+ are otherwise only indented, which reads as a link row. */}
+ <CornerDownRight className="size-3 shrink-0 text-muted-foreground/60" />
+ <span className="shrink-0 tabular-nums">{subtask.identifier}</span>
+ <span className={cn('truncate', done && 'text-muted-foreground/60 line-through')}>
+ {subtask.title}
+ </span>
+ </div>
+ {columns.length > 0 && (
+ <TimelineCells
+ project={project}
+ issue={subtask}
+ maps={maps}
+ columns={columns}
+ readOnly={readOnly}
+ />
+ )}
</div>
<div className="relative" style={{ width: trackWidth, ...dayLines }}>
{todayInRange && (
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineView.tsx b/apps/web/src/features/work-items/components/timeline/TimelineView.tsx
index d75c0c08..f3fe325e 100644
--- a/apps/web/src/features/work-items/components/timeline/TimelineView.tsx
+++ b/apps/web/src/features/work-items/components/timeline/TimelineView.tsx
@@ -11,8 +11,9 @@ import { TimelineHeader } from '@/components/common/timeline/TimelineHeader';
import { TimelineLabelResizer } from '@/components/common/timeline/TimelineLabelResizer';
import { useTimelineDrag } from '../../hooks/useTimelineDrag';
import { useIssueReorder } from '../../hooks/useIssueReorder';
-import { buildTimeline, labelWidthKey, SCALE_DAY_W } from '../../utils/timeline';
+import { buildTimeline, labelWidthKey, SCALE_DAY_W, timelineColumns } from '../../utils/timeline';
import { IssueDragOverlay } from '../shared/IssueDragOverlay';
+import { TimelineColumnHeader } from './TimelineColumnHeader';
import { TimelineGroupRow } from './TimelineGroupRow';
import { TimelineSubgroupRow } from './TimelineSubgroupRow';
import { TimelineIssueBlock } from './TimelineIssueBlock';
@@ -31,6 +32,7 @@ interface TimelineViewProps extends WorkItemsViewProps {
export default function TimelineView({
project,
filters,
+ customFields,
settings,
onOpenIssue,
collapsedGroups,
@@ -70,9 +72,12 @@ export default function TimelineView({
const viewportW = useElementWidth(scrollRef);
// Narrow the sticky label column on small screens so the day track is usable;
- // on wider ones it is the width the grip was dragged to.
+ // on wider ones the title takes the width the grip was dragged to and the
+ // property columns follow it.
const narrow = viewportW < 640;
- const labelW = narrow ? LABEL_NARROW_W : titleWidth;
+ const titleW = narrow ? LABEL_NARROW_W : titleWidth;
+ const columns = narrow ? [] : timelineColumns(settings.properties, customFields);
+ const labelW = titleW + columns.reduce((sum, c) => sum + c.width, 0);
const subgrouped = settings.group !== 'none' && settings.subgroup !== 'none';
const { rows, days, months, trackWidth, todayLeft, todayInRange, dayLines, spanToRect } =
buildTimeline({
@@ -108,8 +113,9 @@ export default function TimelineView({
dayW={DAY_W}
months={months}
days={days}
+ corner={columns.length > 0 && <TimelineColumnHeader columns={columns} />}
/>
- {!narrow && <TimelineLabelResizer labelW={labelW} onResize={setTitleWidth} />}
+ {!narrow && <TimelineLabelResizer labelW={titleW} onResize={setTitleWidth} />}
{rows.length === 0 && (
<div className="p-8 text-center text-sm text-muted-foreground">{t('empty')}</div>
@@ -183,6 +189,7 @@ export default function TimelineView({
active={active}
indented={subgrouped}
labelW={labelW}
+ columns={columns}
trackWidth={trackWidth}
dayLines={dayLines}
todayInRange={todayInRange}
@@ -192,10 +199,13 @@ export default function TimelineView({
onOpen={onOpenIssue}
/>
<TimelineSubtaskRows
+ project={project}
issueId={issue.id}
indented={subgrouped}
maps={maps}
labelW={labelW}
+ columns={columns}
+ readOnly={barsReadOnly}
trackWidth={trackWidth}
dayLines={dayLines}
todayInRange={todayInRange}
@@ -204,10 +214,13 @@ export default function TimelineView({
onOpen={onOpenIssue}
/>
<TimelineLinkRows
+ project={project}
links={issue.links}
indented={subgrouped}
maps={maps}
labelW={labelW}
+ columns={columns}
+ readOnly={barsReadOnly}
trackWidth={trackWidth}
dayLines={dayLines}
todayInRange={todayInRange}
diff --git a/apps/web/src/features/work-items/utils/table.ts b/apps/web/src/features/work-items/utils/table.ts
index 0245cab1..69dd4613 100644
--- a/apps/web/src/features/work-items/utils/table.ts
+++ b/apps/web/src/features/work-items/utils/table.ts
@@ -221,6 +221,10 @@ function trackFloor(w: string): number {
return (minmax ? Number(minmax[1]) : parseInt(w, 10)) || 0;
}
+// The floor of a column's default track, which the Timeline uses as the column's
+// fixed width.
+export const columnFloor = (c: OrderedColumn): number => trackFloor(defaultColumnWidth(c));
+
// Minimum outer width (px) the table needs for every track to sit at its floor:
// the row's horizontal padding (px-4) + the inter-column gaps (gap-3) + each
// track's floor. Applied as a min-width so a narrow (phone) viewport scrolls
@@ -246,20 +250,29 @@ interface TableLayout {
alignTop: boolean;
}
-export function resolveColumns(
+// The columns `properties` names, in its order: each built-in but 'id', and each
+// custom field found in `customFields`. Any other key is dropped.
+export function orderedColumns(
properties: PropertyKey[],
customFields: CustomField[],
- widths: ColumnWidths,
-): TableLayout {
+): OrderedColumn[] {
const builtins = new Set<string>(Object.keys(COLUMN_META));
const fieldById = new Map(customFields.map((f) => [f.id, f]));
- const columns: OrderedColumn[] = properties.flatMap((p): OrderedColumn[] => {
+ return properties.flatMap((p): OrderedColumn[] => {
if (isCustomFieldKey(p)) {
const field = fieldById.get(customFieldId(p));
return field ? [{ kind: 'custom', field }] : [];
}
return builtins.has(p) ? [{ kind: 'builtin', col: p as TableColumn }] : [];
});
+}
+
+export function resolveColumns(
+ properties: PropertyKey[],
+ customFields: CustomField[],
+ widths: ColumnWidths,
+): TableLayout {
+ const columns = orderedColumns(properties, customFields);
const tracks = [
trackWidth(TITLE_COLUMN_KEY, TITLE_COLUMN_WIDTH, widths),
...columns.map((c) => trackWidth(columnKey(c), defaultColumnWidth(c), widths)),
diff --git a/apps/web/src/features/work-items/utils/timeline.test.ts b/apps/web/src/features/work-items/utils/timeline.test.ts
new file mode 100644
index 00000000..5ff2e173
--- /dev/null
+++ b/apps/web/src/features/work-items/utils/timeline.test.ts
@@ -0,0 +1,33 @@
+import assert from 'node:assert/strict';
+import { describe, it } from 'node:test';
+import type { CustomField, CustomFieldType } from '@/lib/api/endpoints/customFields';
+import type { PropertyKey } from '@/utils/viewSettings';
+import { columnKey } from './table';
+import { timelineColumns } from './timeline';
+
+const field = (id: number, fieldType: CustomFieldType): CustomField => ({
+ id,
+ issueTypeId: null,
+ name: `Field ${id}`,
+ fieldType,
+ memberScope: null,
+ showInBody: false,
+ position: id,
+ options: [],
+});
+
+describe('timelineColumns', () => {
+ it('keeps the display order and leaves out the identifier, long text and stale keys', () => {
+ const keys: PropertyKey[] = ['cf:2', 'id', 'priority', 'cf:1', 'cf:3', 'cf:99', 'assignee'];
+ const fields = [field(1, 'text'), field(2, 'select'), field(3, 'markdown')];
+ const columns = timelineColumns(keys, fields);
+ assert.deepEqual(
+ columns.map((c) => columnKey(c.column)),
+ ['cf2', 'priority', 'assignee'],
+ );
+ assert.deepEqual(
+ columns.map((c) => c.width),
+ [132, 100, 132],
+ );
+ });
+});
diff --git a/apps/web/src/features/work-items/utils/timeline.ts b/apps/web/src/features/work-items/utils/timeline.ts
index 89164c62..7000a0e2 100644
--- a/apps/web/src/features/work-items/utils/timeline.ts
+++ b/apps/web/src/features/work-items/utils/timeline.ts
@@ -1,4 +1,5 @@
import { startOfDay } from 'date-fns';
+import type { CustomField } from '@/lib/api/endpoints/customFields';
import type { ProjectDetail } from '@/lib/api/endpoints/projects';
import type { BoardIssue, Issue } from '@/lib/api/endpoints/issues';
import { parseDate } from '@/utils/dates';
@@ -16,7 +17,13 @@ import {
type IssueGroup,
} from '@/utils/project';
import type { Sort } from '@/utils/viewTypes';
-import type { GroupField, TimelineScale } from '@/utils/viewSettings';
+import {
+ isTimelineField,
+ type GroupField,
+ type PropertyKey,
+ type TimelineScale,
+} from '@/utils/viewSettings';
+import { columnFloor, orderedColumns, type OrderedColumn } from './table';
// px per day at each zoom level. Wider days keep the per-day numbers legible;
// narrower days fit longer ranges and fall back to weekly gridlines.
@@ -33,6 +40,30 @@ export function labelWidthKey(projectKey: string, viewId: number | null): string
return `timeline-label-width:${projectKey}:${viewId ?? 'all'}`;
}
+export interface TimelineColumn {
+ column: OrderedColumn;
+ width: number;
+}
+const CELL_PADDING = 12; // px-1.5 on both sides of a cell
+
+// The Table shows the assignee and the delegate as avatars only. The Timeline names
+// them, as it does a member field, so their columns get a member field's width.
+const isPersonColumn = (c: OrderedColumn): boolean =>
+ c.kind === 'builtin' && (c.col === 'assignee' || c.col === 'delegate');
+const PERSON_COLUMN_WIDTH = 120;
+
+// The property columns a row shows after its title, in the display's order. The
+// identifier, a text or markdown field and a stale key are left out.
+export function timelineColumns(
+ properties: PropertyKey[],
+ customFields: CustomField[],
+): TimelineColumn[] {
+ return orderedColumns(properties, customFields.filter(isTimelineField)).map((column) => ({
+ column,
+ width: (isPersonColumn(column) ? PERSON_COLUMN_WIDTH : columnFloor(column)) + CELL_PADDING,
+ }));
+}
+
// An issue's bar span. Effective start is its start date, or its creation date
// when no start date is set (inferredStart) — normal Gantt practice so every
// issue has a bar. Effective end is the due date, or the start when there is
diff --git a/apps/web/src/hooks/useLocalBoardSettings.test.tsx b/apps/web/src/hooks/useLocalBoardSettings.test.tsx
new file mode 100644
index 00000000..29e41642
--- /dev/null
+++ b/apps/web/src/hooks/useLocalBoardSettings.test.tsx
@@ -0,0 +1,68 @@
+import assert from 'node:assert/strict';
+import { afterEach, beforeEach, describe, it } from 'node:test';
+import { act } from 'react';
+import type { Root } from 'react-dom/client';
+import { JSDOM } from 'jsdom';
+import { useLocalBoardSettings } from './useLocalBoardSettings';
+
+const STORE_KEY = 'test_board_settings';
+const replacedGlobals = ['window', 'document', 'localStorage', 'IS_REACT_ACT_ENVIRONMENT'] as const;
+
+let dom: JSDOM;
+let root: Root;
+let originalGlobalDescriptors: Map<string, PropertyDescriptor | undefined>;
+let board: ReturnType<typeof useLocalBoardSettings>;
+
+function BoardProbe() {
+ board = useLocalBoardSettings(STORE_KEY, 1);
+ return null;
+}
+
+beforeEach(async () => {
+ originalGlobalDescriptors = new Map(
+ replacedGlobals.map((name) => [name, Object.getOwnPropertyDescriptor(globalThis, name)]),
+ );
+ dom = new JSDOM('<!doctype html><div id="root"></div>', { url: 'http://localhost/' });
+
+ Object.defineProperties(globalThis, {
+ window: { configurable: true, value: dom.window },
+ document: { configurable: true, value: dom.window.document },
+ localStorage: { configurable: true, value: dom.window.localStorage },
+ IS_REACT_ACT_ENVIRONMENT: { configurable: true, value: true },
+ });
+
+ const { createRoot } = await import('react-dom/client');
+ const rootElement = document.querySelector('#root');
+ assert.ok(rootElement);
+ root = createRoot(rootElement);
+});
+
+afterEach(() => {
+ act(() => root.unmount());
+ dom.window.close();
+ for (const [name, descriptor] of originalGlobalDescriptors) {
+ if (descriptor) Object.defineProperty(globalThis, name, descriptor);
+ else Reflect.deleteProperty(globalThis, name);
+ }
+});
+
+describe('useLocalBoardSettings', () => {
+ it('keeps the display of each layout apart, starting from an entry stored flat', () => {
+ localStorage.setItem(
+ STORE_KEY,
+ JSON.stringify({ 1: { layout: 'table', properties: ['priority'] } }),
+ );
+ act(() => root.render(<BoardProbe />));
+ assert.equal(board.view, 'table');
+ assert.deepEqual(board.settings.properties, ['priority']);
+
+ act(() => board.changeView('timeline'));
+ assert.deepEqual(board.settings.properties, []);
+ act(() => board.changeSettings({ ...board.settings, properties: ['status'] }));
+
+ act(() => board.changeView('table'));
+ assert.deepEqual(board.settings.properties, ['priority']);
+ act(() => board.changeView('timeline'));
+ assert.deepEqual(board.settings.properties, ['status']);
+ });
+});
diff --git a/apps/web/src/hooks/useLocalBoardSettings.ts b/apps/web/src/hooks/useLocalBoardSettings.ts
index 7fb84d3b..472477ff 100644
--- a/apps/web/src/hooks/useLocalBoardSettings.ts
+++ b/apps/web/src/hooks/useLocalBoardSettings.ts
@@ -5,11 +5,15 @@ import { EMPTY_FILTER_SET, type FilterSet } from '@/utils/filters';
// Display settings for an issue board that has no saved views — the one an
// initiative or a cycle shows. Persisted in localStorage under `storeKey`, keyed by
-// the id of the thing the board belongs to; filters stay transient in state. Layout
-// (kanban/table) and its display settings are stored together so a reload restores
-// them. Mirrors the localStorage store in lib/viewSettings.
+// the id of the thing the board belongs to; filters stay transient in state. The
+// active layout and the display settings of each layout are stored, so a reload
+// restores them and every layout keeps its own. Mirrors the localStorage store in
+// lib/viewSettings.
-type Stored = { layout?: WorkItemsView } & Partial<ViewSettings>;
+type Views = Partial<Record<WorkItemsView, Partial<ViewSettings>>>;
+// An entry written before the layouts were kept apart holds one flat settings
+// object instead of `views`, which belongs to the layout it was saved with.
+type Stored = { layout?: WorkItemsView; views?: Views } & Partial<ViewSettings>;
type Store = Record<string, Stored>;
function readStore(storeKey: string): Store {
@@ -27,19 +31,25 @@ function writeStore(storeKey: string, store: Store) {
localStorage.setItem(storeKey, JSON.stringify(store));
}
+function viewsOf(stored: Stored | undefined): Views {
+ if (!stored) return {};
+ const { layout, views, ...flat } = stored;
+ return views ?? { [layout ?? 'kanban']: flat };
+}
+
export function useLocalBoardSettings(storeKey: string, id: number) {
const key = String(id);
const [state, setState] = useState<{ view: WorkItemsView; settings: ViewSettings }>(() => {
const stored = readStore(storeKey)[key];
const view: WorkItemsView = stored?.layout ?? 'kanban';
- return { view, settings: normalizeViewSettings(stored, view) };
+ return { view, settings: normalizeViewSettings(viewsOf(stored)[view], view) };
});
const [filters, setFilters] = useState<FilterSet>(EMPTY_FILTER_SET);
const persist = useCallback(
(view: WorkItemsView, settings: ViewSettings) => {
const store = readStore(storeKey);
- store[key] = { layout: view, ...settings };
+ store[key] = { layout: view, views: { ...viewsOf(store[key]), [view]: settings } };
writeStore(storeKey, store);
},
[storeKey, key],
@@ -47,7 +57,7 @@ export function useLocalBoardSettings(storeKey: string, id: number) {
const changeView = useCallback(
(view: WorkItemsView) => {
- const settings = normalizeViewSettings(readStore(storeKey)[key], view);
+ const settings = normalizeViewSettings(viewsOf(readStore(storeKey)[key])[view], view);
persist(view, settings);
setState({ view, settings });
},
diff --git a/apps/web/src/utils/project.ts b/apps/web/src/utils/project.ts
index 69adaf28..9bfd61f5 100644
--- a/apps/web/src/utils/project.ts
+++ b/apps/web/src/utils/project.ts
@@ -137,7 +137,7 @@ export interface WorkItemsViewProps {
// same thing to every viewer whatever they have filtered.
columnCounts: Map<number, number>;
// Custom field definitions applicable to this project (global + the project's
- // type-scoped fields). The Table view renders enabled ones as columns.
+ // type-scoped fields). The Table and the Timeline render enabled ones as columns.
customFields: CustomField[];
settings: ViewSettings;
// Persist a settings change (used by the flat project to store hidden columns in
diff --git a/apps/web/src/utils/viewSettings.ts b/apps/web/src/utils/viewSettings.ts
index a3133f74..eaecaf24 100644
--- a/apps/web/src/utils/viewSettings.ts
+++ b/apps/web/src/utils/viewSettings.ts
@@ -4,6 +4,7 @@
// shows only the controls that apply to the active view. Missing fields fall
// back to per-view defaults, so the store grows new options without a migration.
+import type { CustomField } from '@/lib/api/endpoints/customFields';
import type { ProjectFeatureSet } from '@/utils/projectFeatures';
import type { Sort, WorkItemsView } from '@/utils/viewTypes';
@@ -16,7 +17,8 @@ export type BuiltinGroupField =
'none' | 'status' | 'assignee' | 'delegate' | 'priority' | 'type' | 'initiative' | 'cycle';
export type GroupField = BuiltinGroupField | CustomFieldKey;
-// Issue properties that can be shown on a Project card or as a Table column.
+// Issue properties that can be shown on a Project card or as a Table or Timeline
+// column.
// 'id' is the issue identifier; 'status' the state; the rest map to issue
// fields directly.
export type DisplayProperty =
@@ -37,9 +39,10 @@ export type DisplayProperty =
| 'updated'
| 'statusAge';
-// A custom field shown as a Table column, keyed by its id as `cf:<id>`. Kept
-// distinct from the built-in DisplayProperty union so both can live in the same
-// `properties` list. Stale keys (a since-deleted field) are ignored at render.
+// A custom field shown as a Table or Timeline column, keyed by its id as
+// `cf:<id>`. Kept distinct from the built-in DisplayProperty union so both can live
+// in the same `properties` list. Stale keys (a since-deleted field) are ignored at
+// render.
export type CustomFieldKey = `cf:${number}`;
export type PropertyKey = DisplayProperty | CustomFieldKey;
@@ -99,6 +102,11 @@ export function offeredDisplayProperties(features: ProjectFeatureSet): DisplayPr
return DISPLAY_PROPERTIES.filter((p) => isFieldEnabled(p, features));
}
+// The custom fields the Timeline offers as columns. A text or markdown value does
+// not fit a Timeline row.
+export const isTimelineField = (field: CustomField): boolean =>
+ field.fieldType !== 'text' && field.fieldType !== 'markdown';
+
// Timeline zoom: how much horizontal space one day gets, which sets whether day
// numbers or only week/month ticks are legible.
export type TimelineScale = 'week' | 'month' | 'quarter';
@@ -126,8 +134,8 @@ export interface ViewSettings {
// boards do not use them.
showLinks: boolean;
// The issues' subtasks, rendered the same way under their parent. Toggled by the
- // Nested subtasks chip in Display properties, and by a row of its own on the
- // Timeline, which has no chips.
+ // Nested subtasks chip in Display properties, and on the Timeline by a row of its
+ // own.
showSubtasks: boolean;
// Whether a subtask also gets a card or row of its own next to the other issues.
// Independent of showSubtasks: with both on it shows in both places, with both