|
1 | 1 | 'use client' |
2 | 2 |
|
3 | 3 | import { memo, type ReactNode, useMemo } from 'react' |
| 4 | +import { buttonVariants } from '@sim/emcn' |
4 | 5 | import { Loader } from '@sim/emcn/icons' |
5 | 6 | import { noop } from '@sim/utils/helpers' |
| 7 | +import Link from 'next/link' |
6 | 8 | import { columnTypeById } from '@/lib/table/column-types' |
7 | 9 | import { CellContent } from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells' |
8 | 10 | import { ColumnTypeIcon } from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/headers/column-type-icon' |
9 | 11 | import { expandToDisplayColumns } from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/utils' |
10 | 12 | import { useTable, useTableRow } from '@/hooks/queries/tables' |
11 | 13 |
|
12 | 14 | /** |
13 | | - * Must match the sticky anchor's `h-[184px]` class below because the row |
| 15 | + * Must match the sticky anchor's `h-[144px]` class below because the row |
14 | 16 | * virtualizer reserves this exact height. The zero-width anchor stays sticky |
15 | 17 | * across the full table width, while its `100cqw` child uses TableGrid's |
16 | 18 | * inline-size query container to cover the visible viewport. |
17 | 19 | */ |
18 | | -export const REFERENCE_ROW_PREVIEW_HEIGHT = 184 |
| 20 | +export const REFERENCE_ROW_PREVIEW_HEIGHT = 144 |
19 | 21 |
|
20 | 22 | const ReferenceIcon = columnTypeById('reference').icon |
21 | 23 |
|
@@ -124,16 +126,25 @@ export const ReferenceRowPreview = memo(function ReferenceRowPreview({ |
124 | 126 | colSpan={colSpan} |
125 | 127 | className='overflow-clip border-[var(--border)] border-r border-b bg-[var(--surface-2)] p-0' |
126 | 128 | > |
127 | | - <div className='sticky left-0 h-[184px] w-0'> |
| 129 | + <div className='sticky left-0 h-[144px] w-0'> |
128 | 130 | <div className='flex h-full w-[100cqw] min-w-0 flex-col bg-[var(--surface-2)]'> |
129 | 131 | <div className='flex h-9 shrink-0 items-center gap-1.5 px-3 text-[var(--text-primary)] text-small'> |
130 | 132 | <ReferenceIcon className='size-[14px] text-[var(--text-icon)]' /> |
131 | 133 | <span className='font-medium'>{table?.name ?? 'Referenced table'}</span> |
132 | 134 | </div> |
133 | 135 |
|
134 | | - <div className='min-h-0 flex-1 overflow-auto overscroll-x-contain bg-[var(--bg)]'> |
| 136 | + <div className='h-[72px] shrink-0 overflow-auto overscroll-x-contain bg-[var(--bg)]'> |
135 | 137 | {content} |
136 | 138 | </div> |
| 139 | + |
| 140 | + <div className='flex h-9 shrink-0 items-center bg-[var(--bg)] px-3'> |
| 141 | + <Link |
| 142 | + href={`/workspace/${workspaceId}/tables/${referenceTableId}`} |
| 143 | + className={buttonVariants({ variant: 'default', size: 'sm' })} |
| 144 | + > |
| 145 | + Go to table |
| 146 | + </Link> |
| 147 | + </div> |
137 | 148 | </div> |
138 | 149 | </div> |
139 | 150 | </td> |
|
0 commit comments