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.

fix(web): apply link and subtask display settings on initiative and cycle boards (#196)

Croffe264ed093b5c
diff --git a/apps/web/src/features/cycles/components/detail/CycleIssuesBoard.tsx b/apps/web/src/features/cycles/components/detail/CycleIssuesBoard.tsx
index 6c6d7a3f..14416236 100644
--- a/apps/web/src/features/cycles/components/detail/CycleIssuesBoard.tsx
+++ b/apps/web/src/features/cycles/components/detail/CycleIssuesBoard.tsx
@@ -10,10 +10,7 @@ import { countIssuesByColumn } from '@/features/work-items/utils/wipLimit';
import { useLocalBoardSettings } from '@/hooks/useLocalBoardSettings';
import FilterBar from '@/components/layout/FilterBar';
import DisplayPopover from '@/components/layout/DisplayPopover';
-import KanbanBoard from '@/features/work-items/components/kanban/KanbanBoard';
-import TableView from '@/features/work-items/components/table/TableView';
-import TimelineView from '@/features/work-items/components/timeline/TimelineView';
-import CalendarView from '@/features/work-items/components/calendar/CalendarView';
+import BoardLayout from '@/features/work-items/components/BoardLayout';
// Where this board's layout and display settings are kept, per cycle.
const CYCLE_BOARD_STORE_KEY = 'planner_cycle_board_settings';
@@ -57,21 +54,6 @@ export default function CycleIssuesBoard({ cycle }: { cycle: Cycle }) {
}),
};
- let view;
- switch (board.view) {
- case 'table':
- view = <TableView {...viewProps} widthScope="cycles" />;
- break;
- case 'timeline':
- view = <TimelineView {...viewProps} />;
- break;
- case 'calendar':
- view = <CalendarView {...viewProps} />;
- break;
- default:
- view = <KanbanBoard {...viewProps} />;
- }
-
return (
<div className="flex min-h-0 flex-1 flex-col">
<div className="flex items-center justify-between gap-2 border-b px-3 py-2">
@@ -90,7 +72,14 @@ export default function CycleIssuesBoard({ cycle }: { cycle: Cycle }) {
issueTypes={project.issueTypes}
/>
</div>
- <div className="relative flex-1 overflow-hidden">{view}</div>
+ <div className="relative flex-1 overflow-hidden">
+ <BoardLayout
+ {...viewProps}
+ view={board.view}
+ widthScope="cycles"
+ allIssues={project.issues}
+ />
+ </div>
</div>
);
}
diff --git a/apps/web/src/features/initiatives/components/detail/InitiativeIssuesBoard.tsx b/apps/web/src/features/initiatives/components/detail/InitiativeIssuesBoard.tsx
index 591bd77a..ea924f34 100644
--- a/apps/web/src/features/initiatives/components/detail/InitiativeIssuesBoard.tsx
+++ b/apps/web/src/features/initiatives/components/detail/InitiativeIssuesBoard.tsx
@@ -8,10 +8,7 @@ import { useInitiativeOptionsQuery } from '@/services/initiatives.service';
import { countIssuesByColumn } from '@/features/work-items/utils/wipLimit';
import FilterBar from '@/components/layout/FilterBar';
import DisplayPopover from '@/components/layout/DisplayPopover';
-import KanbanBoard from '@/features/work-items/components/kanban/KanbanBoard';
-import TableView from '@/features/work-items/components/table/TableView';
-import TimelineView from '@/features/work-items/components/timeline/TimelineView';
-import CalendarView from '@/features/work-items/components/calendar/CalendarView';
+import BoardLayout from '@/features/work-items/components/BoardLayout';
import { useLocalBoardSettings } from '@/hooks/useLocalBoardSettings';
// Where this board's layout and display settings are kept, per initiative.
@@ -55,21 +52,6 @@ export default function InitiativeIssuesBoard({ initiativeId }: { initiativeId:
}),
};
- let view;
- switch (board.view) {
- case 'table':
- view = <TableView {...viewProps} widthScope="initiatives" />;
- break;
- case 'timeline':
- view = <TimelineView {...viewProps} />;
- break;
- case 'calendar':
- view = <CalendarView {...viewProps} />;
- break;
- default:
- view = <KanbanBoard {...viewProps} />;
- }
-
return (
<div className="flex min-h-0 flex-1 flex-col">
<div className="flex items-center justify-between gap-2 border-b px-3 py-2">
@@ -88,7 +70,14 @@ export default function InitiativeIssuesBoard({ initiativeId }: { initiativeId:
issueTypes={project.issueTypes}
/>
</div>
- <div className="relative flex-1 overflow-hidden">{view}</div>
+ <div className="relative flex-1 overflow-hidden">
+ <BoardLayout
+ {...viewProps}
+ view={board.view}
+ widthScope="initiatives"
+ allIssues={project.issues}
+ />
+ </div>
</div>
);
}
diff --git a/apps/web/src/features/work-items/components/BoardLayout.tsx b/apps/web/src/features/work-items/components/BoardLayout.tsx
new file mode 100644
index 00000000..9a1efb30
--- /dev/null
+++ b/apps/web/src/features/work-items/components/BoardLayout.tsx
@@ -0,0 +1,62 @@
+import type { BoardIssue } from '@/lib/api';
+import type { WorkItemsViewProps } from '@/utils/project';
+import type { WorkItemsView } from '@/utils/viewTypes';
+import { withoutShownSubtasks } from '@/utils/subtasks';
+import { IssueLinksProvider } from '../context/useIssueLinks';
+import { SubtasksProvider } from '../context/useSubtasks';
+import KanbanBoard from './kanban/KanbanBoard';
+import TableView from './table/TableView';
+import TimelineView from './timeline/TimelineView';
+import CalendarView from './calendar/CalendarView';
+
+interface BoardLayoutProps extends WorkItemsViewProps {
+ view: WorkItemsView;
+ widthScope: string;
+ // The project's whole issue list, not just the scoped and filtered ones in
+ // `project`: the link and subtask rows read it so a card shows every link and
+ // subtask it has, wherever the other end sits.
+ allIssues: BoardIssue[];
+}
+
+// The board in its selected layout, with the relations and subtasks its cards and
+// rows read. Used by the cycle and initiative boards and by the public share; the
+// work items page composes the layouts itself, since its timeline carries the
+// saved view's collapse state.
+export default function BoardLayout({
+ view,
+ widthScope,
+ allIssues,
+ ...viewProps
+}: BoardLayoutProps) {
+ const { project, settings } = viewProps;
+ const subtasksEnabled = project.project.subtasksEnabled;
+
+ // Subtasks are rendered under their parent, so they are left out of the layouts'
+ // own rows — unless the display asks for them separately, or the Subtasks section
+ // is off and nothing renders the hierarchy.
+ const hideSubtaskRows = subtasksEnabled && !settings.separateSubtasks;
+ const layoutProps: WorkItemsViewProps = hideSubtaskRows
+ ? { ...viewProps, project: { ...project, issues: withoutShownSubtasks(project.issues) } }
+ : viewProps;
+
+ function renderLayout() {
+ switch (view) {
+ case 'table':
+ return <TableView {...layoutProps} widthScope={widthScope} />;
+ case 'timeline':
+ return <TimelineView {...layoutProps} />;
+ case 'calendar':
+ return <CalendarView {...layoutProps} />;
+ default:
+ return <KanbanBoard {...layoutProps} />;
+ }
+ }
+
+ return (
+ <IssueLinksProvider issues={allIssues} enabled={settings.showLinks}>
+ <SubtasksProvider issues={allIssues} enabled={subtasksEnabled && settings.showSubtasks}>
+ {renderLayout()}
+ </SubtasksProvider>
+ </IssueLinksProvider>
+ );
+}
diff --git a/apps/web/src/features/work-items/components/public/ReadOnlyBoard.tsx b/apps/web/src/features/work-items/components/public/ReadOnlyBoard.tsx
index 590c9c39..806ad15e 100644
--- a/apps/web/src/features/work-items/components/public/ReadOnlyBoard.tsx
+++ b/apps/web/src/features/work-items/components/public/ReadOnlyBoard.tsx
@@ -3,14 +3,8 @@ import { defaultViewSettings } from '@/utils/viewSettings';
import { EMPTY_FILTER_SET } from '@/utils/filters';
import { type WorkItemsViewProps } from '@/utils/project';
import { toPublicProjectDetail } from '@/utils/publicProject';
-import { withoutShownSubtasks } from '@/utils/subtasks';
import PublicShareHeader from '@/components/common/page/PublicShareHeader';
-import { IssueLinksProvider } from '../../context/useIssueLinks';
-import { SubtasksProvider } from '../../context/useSubtasks';
-import KanbanBoard from '../kanban/KanbanBoard';
-import TableView from '../table/TableView';
-import TimelineView from '../timeline/TimelineView';
-import CalendarView from '../calendar/CalendarView';
+import BoardLayout from '../BoardLayout';
const noop = () => {};
@@ -30,21 +24,11 @@ export default function ReadOnlyBoard({
const { layout: _omit, ...displaySettings } = bundle.view.display;
const settings = { ...defaultViewSettings(layout), ...displaySettings };
- // The server applied the view's filters: a link that hides labels and custom
- // field values does not carry enough to re-run them here. Subtasks are rendered
- // under their parent, so they are left out of the layouts' own rows — unless the
- // view asks for them separately, or the Subtasks section is off and nothing
- // renders the hierarchy.
- const subtasksEnabled = bundle.project.project.subtasksEnabled;
- const hideSubtaskRows = subtasksEnabled && !settings.separateSubtasks;
- const boardProject = {
- ...project,
- issues: hideSubtaskRows ? withoutShownSubtasks(project.issues) : project.issues,
- };
-
const viewProps: WorkItemsViewProps = {
- project: boardProject,
- // The view's filters stay on the server, which sends only the issues they match.
+ project,
+ // The view's filters stay on the server, which sends only the issues they
+ // match: a link that hides labels and custom field values does not carry
+ // enough to re-run them here.
filters: EMPTY_FILTER_SET,
// No real column totals to measure a limit against for the same reason, and a
// share has nothing to drop anyway: empty leaves the counters plain.
@@ -57,19 +41,6 @@ export default function ReadOnlyBoard({
readOnly: true,
};
- function renderView() {
- switch (layout) {
- case 'table':
- return <TableView {...viewProps} widthScope="all" />;
- case 'timeline':
- return <TimelineView {...viewProps} />;
- case 'calendar':
- return <CalendarView {...viewProps} />;
- default:
- return <KanbanBoard {...viewProps} />;
- }
- }
-
return (
<div className="flex h-screen flex-col overflow-hidden">
<PublicShareHeader
@@ -78,14 +49,7 @@ export default function ReadOnlyBoard({
trailing={bundle.view.name}
/>
<div className="relative min-h-0 flex-1">
- <IssueLinksProvider issues={project.issues} enabled={settings.showLinks}>
- <SubtasksProvider
- issues={project.issues}
- enabled={subtasksEnabled && settings.showSubtasks}
- >
- {renderView()}
- </SubtasksProvider>
- </IssueLinksProvider>
+ <BoardLayout {...viewProps} view={layout} widthScope="all" allIssues={project.issues} />
</div>
</div>
);