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.

improvement(web): keep issue properties inside their width and make the sidebar resizable (#178)

Croffac3a65f9422a
diff --git a/apps/web/messages/ar/common.json b/apps/web/messages/ar/common.json
index d6dc2145..326f94ea 100644
--- a/apps/web/messages/ar/common.json
+++ b/apps/web/messages/ar/common.json
@@ -33,6 +33,7 @@
"enabled": "مُفعّل",
"fullscreen": "ملء الشاشة",
"exitFullscreen": "إنهاء ملء الشاشة",
+ "resizePropertiesPanel": "تغيير عرض لوحة الخصائص",
"resizeTitleColumn": "تغيير عرض عمود العنوان",
"openGeneralSettings": "فتح الإعدادات العامة",
"noSectionAccess": "مالكش صلاحية تدخل القسم ده.",
diff --git a/apps/web/messages/en/common.json b/apps/web/messages/en/common.json
index e082ad65..7474e336 100644
--- a/apps/web/messages/en/common.json
+++ b/apps/web/messages/en/common.json
@@ -33,6 +33,7 @@
"enabled": "Enabled",
"fullscreen": "Fullscreen",
"exitFullscreen": "Exit fullscreen",
+ "resizePropertiesPanel": "Resize the properties panel",
"resizeTitleColumn": "Resize the title column",
"openGeneralSettings": "Open General settings",
"noSectionAccess": "You do not have access to this section.",
diff --git a/apps/web/messages/ru/common.json b/apps/web/messages/ru/common.json
index 48b6a491..c37ffb7a 100644
--- a/apps/web/messages/ru/common.json
+++ b/apps/web/messages/ru/common.json
@@ -33,6 +33,7 @@
"enabled": "Включено",
"fullscreen": "На весь экран",
"exitFullscreen": "Выйти из полноэкранного режима",
+ "resizePropertiesPanel": "Изменить ширину блока свойств",
"resizeTitleColumn": "Изменить ширину колонки названий",
"openGeneralSettings": "Открыть общие настройки",
"noSectionAccess": "У вас нет доступа к этому разделу.",
diff --git a/apps/web/messages/uk/common.json b/apps/web/messages/uk/common.json
index e00b350e..cff597ac 100644
--- a/apps/web/messages/uk/common.json
+++ b/apps/web/messages/uk/common.json
@@ -33,6 +33,7 @@
"enabled": "Увімкнено",
"fullscreen": "На весь екран",
"exitFullscreen": "Вийти з повноекранного режиму",
+ "resizePropertiesPanel": "Змінити ширину блоку властивостей",
"resizeTitleColumn": "Змінити ширину колонки назв",
"openGeneralSettings": "Відкрити загальні налаштування",
"noSectionAccess": "У вас немає доступу до цього розділу.",
diff --git a/apps/web/messages/zh-CN/common.json b/apps/web/messages/zh-CN/common.json
index 95f20db3..040df089 100644
--- a/apps/web/messages/zh-CN/common.json
+++ b/apps/web/messages/zh-CN/common.json
@@ -33,6 +33,7 @@
"enabled": "已启用",
"fullscreen": "全屏",
"exitFullscreen": "退出全屏",
+ "resizePropertiesPanel": "调整属性面板宽度",
"resizeTitleColumn": "调整标题列宽",
"openGeneralSettings": "打开常规设置",
"noSectionAccess": "你无权访问此部分。",
diff --git a/apps/web/src/components/common/ResizeGrip.tsx b/apps/web/src/components/common/ResizeGrip.tsx
new file mode 100644
index 00000000..a282c97c
--- /dev/null
+++ b/apps/web/src/components/common/ResizeGrip.tsx
@@ -0,0 +1,46 @@
+'use client';
+
+import { useEffect, useRef } from 'react';
+import { cn } from '@/lib/utils';
+
+// The grip on the edge of a resizable column or panel. It reports how far the
+// pointer has moved from where the drag started; which side that grows is the
+// caller's business, so a panel on the end edge can widen as the pointer goes the
+// other way.
+export default function ResizeGrip({
+ label,
+ className,
+ onDrag,
+}: {
+ label: string;
+ className?: string;
+ onDrag: (deltaX: number) => void;
+}) {
+ // The drag listens on the window, since the pointer leaves the 6px grip as soon
+ // as it moves. The host can unmount mid-drag (switching layout or project), and
+ // the pointerup that would drop the listeners never reaches this component.
+ const endDrag = useRef<(() => void) | null>(null);
+ useEffect(() => () => endDrag.current?.(), []);
+
+ function beginResize(e: React.PointerEvent) {
+ e.preventDefault();
+ const startX = e.clientX;
+ const onMove = (ev: PointerEvent) => onDrag(ev.clientX - startX);
+ const onUp = () => {
+ window.removeEventListener('pointermove', onMove);
+ window.removeEventListener('pointerup', onUp);
+ endDrag.current = null;
+ };
+ endDrag.current = onUp;
+ window.addEventListener('pointermove', onMove);
+ window.addEventListener('pointerup', onUp);
+ }
+
+ return (
+ <div
+ onPointerDown={beginResize}
+ aria-label={label}
+ className={cn('w-1.5 cursor-col-resize hover:bg-primary/40', className)}
+ />
+ );
+}
diff --git a/apps/web/src/components/common/fields/AssigneeSelect.tsx b/apps/web/src/components/common/fields/AssigneeSelect.tsx
index 63708027..f7de3a42 100644
--- a/apps/web/src/components/common/fields/AssigneeSelect.tsx
+++ b/apps/web/src/components/common/fields/AssigneeSelect.tsx
@@ -51,7 +51,7 @@ export default function AssigneeSelect({
) : (
<CircleDashed />
)}
- {assignee?.name ?? placeholder ?? none}
+ <span className="truncate">{assignee?.name ?? placeholder ?? none}</span>
</Pill>
}
inputPlaceholder={t('assignTo')}
diff --git a/apps/web/src/components/common/fields/DatePill.tsx b/apps/web/src/components/common/fields/DatePill.tsx
index 3cbadc13..d8a81a9c 100644
--- a/apps/web/src/components/common/fields/DatePill.tsx
+++ b/apps/web/src/components/common/fields/DatePill.tsx
@@ -37,7 +37,7 @@ export default function DatePill({
const pill = trigger ?? (
<Pill active={!!value}>
<CalendarIcon />
- {value ? formatDate(value) : placeholder}
+ <span className="truncate">{value ? formatDate(value) : placeholder}</span>
</Pill>
);
if (readOnly) return <ReadOnlyPill>{pill}</ReadOnlyPill>;
diff --git a/apps/web/src/components/common/fields/DateTimePill.tsx b/apps/web/src/components/common/fields/DateTimePill.tsx
index 8bc58ec6..f485b58b 100644
--- a/apps/web/src/components/common/fields/DateTimePill.tsx
+++ b/apps/web/src/components/common/fields/DateTimePill.tsx
@@ -65,7 +65,9 @@ export default function DateTimePill({
const pill = (
<Pill active={!!value}>
<CalendarClock />
- {value ? formatDateTimeRange(value, range ? valueEnd : null) : placeholder}
+ <span className="truncate">
+ {value ? formatDateTimeRange(value, range ? valueEnd : null) : placeholder}
+ </span>
</Pill>
);
if (readOnly) return <ReadOnlyPill>{pill}</ReadOnlyPill>;
diff --git a/apps/web/src/components/common/fields/LabelsSelect.tsx b/apps/web/src/components/common/fields/LabelsSelect.tsx
index efd1e60a..6d34f234 100644
--- a/apps/web/src/components/common/fields/LabelsSelect.tsx
+++ b/apps/web/src/components/common/fields/LabelsSelect.tsx
@@ -35,7 +35,9 @@ export default function LabelsSelect({
) : (
<Tag />
)}
- {selected.length > 0 ? t('labelCount', { count: selected.length }) : t('labels')}
+ <span className="truncate">
+ {selected.length > 0 ? t('labelCount', { count: selected.length }) : t('labels')}
+ </span>
</Pill>
);
if (readOnly) return <ReadOnlyPill>{trigger}</ReadOnlyPill>;
diff --git a/apps/web/src/components/common/fields/Pill.tsx b/apps/web/src/components/common/fields/Pill.tsx
index 707b668c..a1c91a98 100644
--- a/apps/web/src/components/common/fields/Pill.tsx
+++ b/apps/web/src/components/common/fields/Pill.tsx
@@ -1,6 +1,8 @@
// A Linear-style pill trigger: rounded, muted, icon + label. Used by the field
// selects, the new-issue modal and the issue detail panel so every field trigger
-// looks the same.
+// looks the same. It never grows past the room it is given, so a caller puts its
+// text in a `truncate` span rather than letting a long value push out of the
+// column.
export function Pill({
active,
children,
@@ -9,7 +11,7 @@ export function Pill({
return (
<button
type="button"
- className={`flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-sm transition-colors hover:bg-accent [&_svg:not([class*='size-'])]:size-3.5 ${
+ className={`flex h-7 max-w-full min-w-0 items-center gap-1.5 rounded-full border px-2.5 text-sm transition-colors hover:bg-accent [&_svg:not([class*='size-'])]:size-3.5 [&>svg]:shrink-0 ${
active ? 'text-foreground' : 'text-muted-foreground'
}`}
{...props}
diff --git a/apps/web/src/components/common/fields/PrioritySelect.tsx b/apps/web/src/components/common/fields/PrioritySelect.tsx
index 0499ee36..0b8eb341 100644
--- a/apps/web/src/components/common/fields/PrioritySelect.tsx
+++ b/apps/web/src/components/common/fields/PrioritySelect.tsx
@@ -23,7 +23,7 @@ export default function PrioritySelect({
trigger={
<Pill active={!!value}>
{prio.icon}
- {value ? priorityLabel(value) : t('label')}
+ <span className="truncate">{value ? priorityLabel(value) : t('label')}</span>
</Pill>
}
inputPlaceholder={t('setTo')}
diff --git a/apps/web/src/components/common/fields/StatusSelect.tsx b/apps/web/src/components/common/fields/StatusSelect.tsx
index 40caedc7..9dbc81e0 100644
--- a/apps/web/src/components/common/fields/StatusSelect.tsx
+++ b/apps/web/src/components/common/fields/StatusSelect.tsx
@@ -24,7 +24,7 @@ export default function StatusSelect({
trigger={
<Pill active>
{column ? colorDot(column.color) : <CircleDashed />}
- {column?.name ?? t('state')}
+ <span className="truncate">{column?.name ?? t('state')}</span>
</Pill>
}
inputPlaceholder={t('changeState')}
diff --git a/apps/web/src/components/common/fields/TypeSelect.tsx b/apps/web/src/components/common/fields/TypeSelect.tsx
index 7891668c..42401798 100644
--- a/apps/web/src/components/common/fields/TypeSelect.tsx
+++ b/apps/web/src/components/common/fields/TypeSelect.tsx
@@ -24,7 +24,7 @@ export default function TypeSelect({
trigger={
<Pill active={!!type}>
{type ? colorDot(type.color) : <CircleDashed />}
- {type?.name ?? t('type')}
+ <span className="truncate">{type?.name ?? t('type')}</span>
</Pill>
}
inputPlaceholder={t('changeType')}
diff --git a/apps/web/src/components/common/timeline/TimelineLabelResizer.tsx b/apps/web/src/components/common/timeline/TimelineLabelResizer.tsx
index 07f811b4..d882d0ec 100644
--- a/apps/web/src/components/common/timeline/TimelineLabelResizer.tsx
+++ b/apps/web/src/components/common/timeline/TimelineLabelResizer.tsx
@@ -1,5 +1,5 @@
-import { useEffect, useRef } from 'react';
import { useTranslations } from 'next-intl';
+import ResizeGrip from '@/components/common/ResizeGrip';
// The grip on the right edge of a timeline's label column: dragging it sets how
// much room the labels get. It spans the whole column, header to last row, and
@@ -13,33 +13,13 @@ export function TimelineLabelResizer({
onResize: (width: number) => void;
}) {
const t = useTranslations('common');
- // The drag listens on the window, since the pointer leaves the 6px grip as soon
- // as it moves. Switching layout or project unmounts the timeline mid-drag, and
- // the pointerup that would drop the listeners never reaches this component.
- const endDrag = useRef<(() => void) | null>(null);
- useEffect(() => () => endDrag.current?.(), []);
-
- function beginResize(e: React.PointerEvent) {
- e.preventDefault();
- const startX = e.clientX;
- const onMove = (ev: PointerEvent) => onResize(labelW + (ev.clientX - startX));
- const onUp = () => {
- window.removeEventListener('pointermove', onMove);
- window.removeEventListener('pointerup', onUp);
- endDrag.current = null;
- };
- endDrag.current = onUp;
- window.addEventListener('pointermove', onMove);
- window.addEventListener('pointerup', onUp);
- }
-
return (
<div className="pointer-events-none absolute inset-0 z-30">
<div className="sticky left-0 h-full" style={{ width: labelW }}>
- <div
- onPointerDown={beginResize}
- aria-label={t('resizeTitleColumn')}
- className="pointer-events-auto absolute inset-y-0 right-0 w-1.5 cursor-col-resize hover:bg-primary/40"
+ <ResizeGrip
+ label={t('resizeTitleColumn')}
+ className="pointer-events-auto absolute inset-y-0 right-0"
+ onDrag={(deltaX) => onResize(labelW + deltaX)}
/>
</div>
</div>
diff --git a/apps/web/src/features/cycles/components/list/CyclesTimeline.tsx b/apps/web/src/features/cycles/components/list/CyclesTimeline.tsx
index 784999f7..514f5105 100644
--- a/apps/web/src/features/cycles/components/list/CyclesTimeline.tsx
+++ b/apps/web/src/features/cycles/components/list/CyclesTimeline.tsx
@@ -4,8 +4,8 @@ import type { Cycle } from '@/lib/api';
import { cyclePath } from '@/utils/paths';
import { usePermissions } from '@/hooks/usePermissions';
import { useElementWidth } from '@/hooks/useElementWidth';
-import { useTimelineLabelWidth } from '@/hooks/useTimelineLabelWidth';
-import { LABEL_NARROW_W } from '@/utils/timelineTrack';
+import { usePersistedWidth } from '@/hooks/usePersistedWidth';
+import { LABEL_MAX_W, LABEL_MIN_W, LABEL_NARROW_W, LABEL_W } from '@/utils/timelineTrack';
import { TimelineHeader } from '@/components/common/timeline/TimelineHeader';
import { TimelineLabelResizer } from '@/components/common/timeline/TimelineLabelResizer';
import { useCycleDrag } from '../../hooks/useCycleDrag';
@@ -35,8 +35,11 @@ export default function CyclesTimeline({
const openCycle = (id: number) => router.push(cyclePath(projectKey, id));
const canEdit = can('cycles', 'edit');
- const { width: labelWidth, setWidth: setLabelWidth } = useTimelineLabelWidth(
+ const { width: labelWidth, setWidth: setLabelWidth } = usePersistedWidth(
cycleLabelWidthKey(projectKey),
+ LABEL_W,
+ LABEL_MIN_W,
+ LABEL_MAX_W,
);
// 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.
diff --git a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
index 412b2d29..a51c1caf 100644
--- a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
@@ -1,7 +1,10 @@
-import { useRef, useState } from 'react';
+import { type CSSProperties, useRef, useState } from 'react';
+import { Direction } from 'radix-ui';
import { type ProjectDetail, type IssueDetail as IssueDetailRow } from '@/lib/api';
import { usePermissions } from '@/hooks/usePermissions';
+import { usePersistedWidth } from '@/hooks/usePersistedWidth';
import { useProjectFeatures } from '@/hooks/useProjectFeatures';
+import ResizeGrip from '@/components/common/ResizeGrip';
import { useIssueDetail } from '../../hooks/useIssueDetail';
import { usePersistedOpen } from '../../hooks/usePersistedOpen';
import { useFilePaste } from '../../hooks/useFilePaste';
@@ -17,6 +20,12 @@ import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';
import IssueCustomFieldBody from '../fields/IssueCustomFieldBody';
import IssueProperties from './IssueProperties';
import IssueActionsBar from '../actions/IssueActionsBar';
+import {
+ PROPERTIES_MAX_W,
+ PROPERTIES_MIN_W,
+ PROPERTIES_W,
+ propertiesWidthKey,
+} from '../../utils/propertiesWidth';
import { useTranslations } from 'next-intl';
// The body of a issue — title, description, markdown custom fields, the
@@ -46,7 +55,9 @@ export default function IssueDetailContent({
layout?: 'panel' | 'page' | 'split';
}) {
const t = useTranslations('issue');
+ const tCommon = useTranslations('common');
const tEditor = useTranslations('issue.editor');
+ const direction = Direction.useDirection();
const {
issue,
fieldDefs,
@@ -63,6 +74,12 @@ export default function IssueDetailContent({
const features = useProjectFeatures();
useFilePaste(canEdit && issue ? (files) => void attachFiles(files) : null);
const properties = usePersistedOpen('issue-properties-open');
+ const { width: propertiesWidth, setWidth: setPropertiesWidth } = usePersistedWidth(
+ propertiesWidthKey(project.project.key),
+ PROPERTIES_W,
+ PROPERTIES_MIN_W,
+ PROPERTIES_MAX_W,
+ );
// A replaced attachment keeps its URL, so an <img> already in an editor is
// never requested again. Counting the replacements remounts the editors, which
// builds the element anew and lets the raw route revalidate it.
@@ -191,6 +208,21 @@ export default function IssueDetailContent({
const actions = <IssueActionsBar project={project} issue={issue} onDeleted={onDeleted} />;
+ // The sidebar grows towards the content, so the pointer moving away from the
+ // edge the panel sits on is what widens it.
+ const propertiesGrip = (
+ <ResizeGrip
+ label={tCommon('resizePropertiesPanel')}
+ className="absolute inset-y-0 start-0 -ms-3"
+ onDrag={(deltaX) =>
+ setPropertiesWidth(propertiesWidth + (direction === 'rtl' ? deltaX : -deltaX))
+ }
+ />
+ );
+ // The dragged width reaches the layout as a variable, since the two blocks it
+ // sizes only take it from the breakpoint where the sidebar exists.
+ const propertiesWidthVar = { '--issue-properties-w': `${propertiesWidth}px` } as CSSProperties;
+
// A feed entry stores the author's name, not their picture, so the uploaded avatar
// comes from the project's candidate list by actor id. An author who is no longer a
// member falls back to the initials circle.
@@ -235,7 +267,7 @@ export default function IssueDetailContent({
// under the description.
return (
<>
- <div className="max-w-3xl xl:me-[340px]">
+ <div className="max-w-3xl xl:me-(--issue-properties-w)" style={propertiesWidthVar}>
{/* Stuck to the top of the scrolling page, with the same translucent,
blurred backdrop the side panel's header uses. The negative top
margin cancels the page's padding so the row starts where the title
@@ -248,9 +280,17 @@ export default function IssueDetailContent({
{sections}
{activity}
</div>
- <aside className="hidden xl:fixed xl:end-6 xl:top-16 xl:block xl:max-h-[calc(100vh-5.5rem)] xl:w-[340px] xl:overflow-y-auto">
- {actions}
- {sidebarProperties}
+ {/* The grip sits outside the scrolling box: a panel that scrolls on one
+ axis clips the other too, which would cut it off. */}
+ <aside
+ className="hidden xl:fixed xl:end-6 xl:top-16 xl:block xl:w-(--issue-properties-w)"
+ style={propertiesWidthVar}
+ >
+ {propertiesGrip}
+ <div className="max-h-[calc(100vh-5.5rem)] overflow-y-auto">
+ {actions}
+ {sidebarProperties}
+ </div>
</aside>
</>
);
@@ -272,7 +312,11 @@ export default function IssueDetailContent({
{sections}
{activity}
</div>
- <aside className="hidden w-[320px] shrink-0 @3xl:block">
+ <aside
+ className="relative hidden w-(--issue-properties-w) shrink-0 @3xl:block"
+ style={propertiesWidthVar}
+ >
+ {propertiesGrip}
{actions}
{sidebarProperties}
</aside>
diff --git a/apps/web/src/features/issue/components/detail/IssueProperties.tsx b/apps/web/src/features/issue/components/detail/IssueProperties.tsx
index fcc30c11..e9fdde32 100644
--- a/apps/web/src/features/issue/components/detail/IssueProperties.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueProperties.tsx
@@ -31,7 +31,9 @@ import { useTranslations } from 'next-intl';
function PropertyRow({ label, children }: { label: string; children: ReactNode }) {
return (
<>
- <div className="pt-1.5 text-sm text-muted-foreground">{label}</div>
+ <div className="truncate pt-1.5 text-sm text-muted-foreground" title={label}>
+ {label}
+ </div>
<div className="min-w-0">{children}</div>
</>
);
@@ -160,7 +162,7 @@ export default function IssueProperties({
<ReadOnlyPill>
<Pill active={!!issue.initiative}>
<Target />
- {issue.initiative?.title ?? t('initiative')}
+ <span className="truncate">{issue.initiative?.title ?? t('initiative')}</span>
</Pill>
</ReadOnlyPill>
) : (
@@ -181,7 +183,7 @@ export default function IssueProperties({
<ReadOnlyPill>
<Pill active={!!issue.cycle}>
<RefreshCw />
- {issue.cycle?.name ?? t('cycle')}
+ <span className="truncate">{issue.cycle?.name ?? t('cycle')}</span>
</Pill>
</ReadOnlyPill>
) : (
@@ -260,7 +262,12 @@ export default function IssueProperties({
className={cn('h-7', open && 'mb-3')}
/>
{open && (
- <div className="grid grid-cols-[180px_1fr] items-start gap-x-2 gap-y-2.5">{rows}</div>
+ // The name column takes a share of whatever room the section has, capped at
+ // the width long names need, so a narrow sidebar leaves the controls enough
+ // space instead of pushing them out of it.
+ <div className="grid grid-cols-[minmax(0,min(40%,180px))_minmax(0,1fr)] items-start gap-x-2 gap-y-2.5">
+ {rows}
+ </div>
)}
</div>
);
diff --git a/apps/web/src/features/issue/components/fields/CycleSelect.tsx b/apps/web/src/features/issue/components/fields/CycleSelect.tsx
index 9d56dfd9..aeb4124e 100644
--- a/apps/web/src/features/issue/components/fields/CycleSelect.tsx
+++ b/apps/web/src/features/issue/components/fields/CycleSelect.tsx
@@ -47,7 +47,7 @@ export default function CycleSelect({
<PopoverTrigger asChild>
<Pill active={value != null}>
{value != null ? <RefreshCw /> : <CircleDashed />}
- {value?.name ?? t('label')}
+ <span className="truncate">{value?.name ?? t('label')}</span>
</Pill>
</PopoverTrigger>
<PopoverContent className="w-56 p-0" align="start">
diff --git a/apps/web/src/features/issue/components/fields/DelegateSelect.tsx b/apps/web/src/features/issue/components/fields/DelegateSelect.tsx
index 86f48d0c..0f612d8c 100644
--- a/apps/web/src/features/issue/components/fields/DelegateSelect.tsx
+++ b/apps/web/src/features/issue/components/fields/DelegateSelect.tsx
@@ -40,7 +40,7 @@ export default function DelegateSelect({
) : (
<CircleDashed />
)}
- {delegate?.name ?? placeholder ?? none}
+ <span className="truncate">{delegate?.name ?? placeholder ?? none}</span>
</Pill>
}
inputPlaceholder={t('delegateTo')}
diff --git a/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx b/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx
index 2184179d..6eff34eb 100644
--- a/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx
+++ b/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx
@@ -56,7 +56,7 @@ export default function InitiativeSelect({
<PopoverTrigger asChild>
<Pill active={value != null}>
{value != null ? <Target /> : <CircleDashed />}
- {current?.title ?? t('label')}
+ <span className="truncate">{current?.title ?? t('label')}</span>
</Pill>
</PopoverTrigger>
<PopoverContent className="w-56 p-0" align="start">
diff --git a/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx b/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx
index 1537f777..fd17a224 100644
--- a/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx
+++ b/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx
@@ -43,7 +43,7 @@ export default function IssueCustomFieldPill({
on && 'border-primary bg-primary',
)}
/>
- {def.name}
+ <span className="truncate">{def.name}</span>
</Pill>
);
}
@@ -57,7 +57,9 @@ export default function IssueCustomFieldPill({
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
- <Pill active={selected.length > 0}>{label}</Pill>
+ <Pill active={selected.length > 0}>
+ <span className="truncate">{label}</span>
+ </Pill>
</PopoverTrigger>
<PopoverContent className="w-56 p-0" align="start">
<Command>
diff --git a/apps/web/src/features/issue/utils/propertiesWidth.ts b/apps/web/src/features/issue/utils/propertiesWidth.ts
new file mode 100644
index 00000000..f5e3f100
--- /dev/null
+++ b/apps/web/src/features/issue/utils/propertiesWidth.ts
@@ -0,0 +1,9 @@
+// The dragged width of the Properties sidebar is a client-only preference, kept
+// per project so each of them keeps the room its fields need.
+export const PROPERTIES_W = 340;
+export const PROPERTIES_MIN_W = 260;
+export const PROPERTIES_MAX_W = 560;
+
+export function propertiesWidthKey(projectKey: string): string {
+ return `issue-properties-width:${projectKey}`;
+}
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 d85603fb..d75c0c08 100644
--- a/apps/web/src/features/work-items/components/timeline/TimelineView.tsx
+++ b/apps/web/src/features/work-items/components/timeline/TimelineView.tsx
@@ -5,8 +5,8 @@ import { buildMaps, issueColor, type WorkItemsViewProps } from '@/utils/project'
import { usePermissions } from '@/hooks/usePermissions';
import { useGroupLabels } from '@/hooks/useGroupLabels';
import { useElementWidth } from '@/hooks/useElementWidth';
-import { useTimelineLabelWidth } from '@/hooks/useTimelineLabelWidth';
-import { LABEL_NARROW_W } from '@/utils/timelineTrack';
+import { usePersistedWidth } from '@/hooks/usePersistedWidth';
+import { LABEL_MAX_W, LABEL_MIN_W, LABEL_NARROW_W, LABEL_W } from '@/utils/timelineTrack';
import { TimelineHeader } from '@/components/common/timeline/TimelineHeader';
import { TimelineLabelResizer } from '@/components/common/timeline/TimelineLabelResizer';
import { useTimelineDrag } from '../../hooks/useTimelineDrag';
@@ -55,8 +55,11 @@ export default function TimelineView({
});
});
const DAY_W = SCALE_DAY_W[settings.timelineScale];
- const { width: titleWidth, setWidth: setTitleWidth } = useTimelineLabelWidth(
+ const { width: titleWidth, setWidth: setTitleWidth } = usePersistedWidth(
labelWidthKey(project.project.key, viewId ?? null),
+ LABEL_W,
+ LABEL_MIN_W,
+ LABEL_MAX_W,
);
const maps = buildMaps(project);
const scrollRef = useRef<HTMLDivElement>(null);
diff --git a/apps/web/src/hooks/usePersistedWidth.ts b/apps/web/src/hooks/usePersistedWidth.ts
new file mode 100644
index 00000000..14076fd3
--- /dev/null
+++ b/apps/web/src/hooks/usePersistedWidth.ts
@@ -0,0 +1,50 @@
+import { useCallback, useEffect, useState } from 'react';
+
+// A width the user drags, clamped to [min, max] and stored under `storageKey`
+// (see labelWidthKey, cycleLabelWidthKey and propertiesWidthKey for what each
+// width is scoped to). Reloads when the key changes, so switching tab or project
+// picks up its own width.
+//
+// The stored value is read in an effect, not in the state initializer: the
+// initializer also runs in the server render, where a client-only value would not
+// match the markup.
+export function usePersistedWidth(
+ storageKey: string,
+ initial: number,
+ min: number,
+ max: number,
+): { width: number; setWidth: (width: number) => void } {
+ const [width, setStored] = useState(initial);
+
+ useEffect(() => {
+ setStored(load(storageKey, initial, min, max));
+ }, [storageKey, initial, min, max]);
+
+ const setWidth = useCallback(
+ (next: number) => {
+ const clamped = clamp(next, min, max);
+ setStored(clamped);
+ try {
+ localStorage.setItem(storageKey, String(clamped));
+ } catch {
+ // ignore write failures (private mode / quota); the width still applies.
+ }
+ },
+ [storageKey, min, max],
+ );
+
+ return { width, setWidth };
+}
+
+function load(storageKey: string, initial: number, min: number, max: number): number {
+ try {
+ const stored = Number(localStorage.getItem(storageKey));
+ return stored ? clamp(stored, min, max) : initial;
+ } catch {
+ return initial;
+ }
+}
+
+function clamp(width: number, min: number, max: number): number {
+ return Math.min(max, Math.max(min, Math.round(width)));
+}
diff --git a/apps/web/src/hooks/useTimelineLabelWidth.ts b/apps/web/src/hooks/useTimelineLabelWidth.ts
deleted file mode 100644
index dcdcba21..00000000
--- a/apps/web/src/hooks/useTimelineLabelWidth.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { useCallback, useEffect, useState } from 'react';
-import { LABEL_MAX_W, LABEL_MIN_W, LABEL_W } from '@/utils/timelineTrack';
-
-// Width of a timeline's label column, dragged by the header's resize handle and
-// stored under `storageKey` (see labelWidthKey and cycleLabelWidthKey: one width
-// per project and view). Reloads when the key changes, so switching tabs picks up
-// that tab's width.
-//
-// The stored value is read in an effect, not in the state initializer: the
-// initializer also runs in the server render, where a client-only value would not
-// match the markup.
-export function useTimelineLabelWidth(storageKey: string): {
- width: number;
- setWidth: (width: number) => void;
-} {
- const [width, setStored] = useState(LABEL_W);
-
- useEffect(() => {
- setStored(load(storageKey));
- }, [storageKey]);
-
- const setWidth = useCallback(
- (next: number) => {
- const clamped = clamp(next);
- setStored(clamped);
- try {
- localStorage.setItem(storageKey, String(clamped));
- } catch {
- // ignore write failures (private mode / quota); the width still applies.
- }
- },
- [storageKey],
- );
-
- return { width, setWidth };
-}
-
-function load(storageKey: string): number {
- try {
- const stored = Number(localStorage.getItem(storageKey));
- return stored ? clamp(stored) : LABEL_W;
- } catch {
- return LABEL_W;
- }
-}
-
-function clamp(width: number): number {
- return Math.min(LABEL_MAX_W, Math.max(LABEL_MIN_W, Math.round(width)));
-}