From 77562957564200ae48d1b95eb45b10448750f02f Mon Sep 17 00:00:00 2001 From: Tofik Hasanov Date: Tue, 23 Jun 2026 13:43:23 -0400 Subject: [PATCH 1/3] feat(framework-editor): resizable columns persisted to a cookie (FRAME-17) Drag the divider on a column's right edge to resize it; widths are saved to a cookie (per the ticket) and restored on the next visit. Applied to both tables Joe asked for: - Requirements view (when viewing a framework): tanstack-native column resizing with handles on every column (except the actions column), table-layout: fixed so widths hold, and the Description column's max width raised so long text can be read inline once widened. - Frameworks list: the unified tree table gets a colgroup + fixed layout, drag handles, and per-column widths. Shared helpers: a cookie load/save util (column-widths-cookie) and a useResizableColumns hook + ColumnResizeHandle for plain tables. Tests cover the width sanitisation and cookie round-trip. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01MGwXoPb6qHxuHy8miVmyxT --- .../FrameworkRequirementsClientPage.tsx | 59 ++++++++++++-- .../components/FrameworksTreeTable.tsx | 76 ++++++++++++++---- .../table/column-widths-cookie.test.ts | 48 ++++++++++++ .../components/table/column-widths-cookie.ts | 45 +++++++++++ .../components/table/resizable-columns.tsx | 78 +++++++++++++++++++ 5 files changed, 283 insertions(+), 23 deletions(-) create mode 100644 apps/framework-editor/app/components/table/column-widths-cookie.test.ts create mode 100644 apps/framework-editor/app/components/table/column-widths-cookie.ts create mode 100644 apps/framework-editor/app/components/table/resizable-columns.tsx diff --git a/apps/framework-editor/app/(pages)/frameworks/[frameworkId]/FrameworkRequirementsClientPage.tsx b/apps/framework-editor/app/(pages)/frameworks/[frameworkId]/FrameworkRequirementsClientPage.tsx index aae08cffa5..f63f98c664 100644 --- a/apps/framework-editor/app/(pages)/frameworks/[frameworkId]/FrameworkRequirementsClientPage.tsx +++ b/apps/framework-editor/app/(pages)/frameworks/[frameworkId]/FrameworkRequirementsClientPage.tsx @@ -1,6 +1,10 @@ 'use client'; import { apiClient } from '@/app/lib/api-client'; +import { + loadColumnWidths, + saveColumnWidths, +} from '@/app/components/table/column-widths-cookie'; import { createColumnHelper, flexRender, @@ -12,7 +16,7 @@ import { import { Button } from '@trycompai/ui'; import { ArrowDown, ArrowUp, ArrowUpDown, Download, PencilIcon, Plus, Trash2 } from 'lucide-react'; import { useRouter } from 'next/navigation'; -import { useCallback, useMemo, useState } from 'react'; +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { toast } from 'sonner'; import { ComboboxCell, DateCell, EditableCell, RelationalCell } from '../../../components/table'; import { EditFrameworkDialog } from './components/EditFrameworkDialog'; @@ -67,6 +71,9 @@ async function unlinkControlFromRequirement(requirementId: string, controlId: st const columnHelper = createColumnHelper(); +// FRAME-17: cookie key for this table's persisted column widths. +const REQUIREMENTS_COLS_COOKIE = 'fwk-requirements-col-widths'; + export function FrameworkRequirementsClientPage({ frameworkDetails, initialRequirements, @@ -191,7 +198,9 @@ export function FrameworkRequirementsClientPage({ columnHelper.accessor('description', { header: 'Description', size: 300, - maxSize: 300, + // FRAME-17: allow widening well past the default so long requirement + // text is readable inline once the column is resized. + maxSize: 1200, cell: ({ row, getValue }) => { const { identifier, name } = row.original; const titleSuffix = [identifier, name].filter(Boolean).join(' - '); @@ -251,6 +260,7 @@ export function FrameworkRequirementsClientPage({ id: 'actions', header: '', size: 50, + enableResizing: false, cell: ({ row }) => (