mirror of
https://github.com/supabase/supabase.git
synced 2026-05-11 19:26:38 +08:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Refactor ## What is the current behavior? Studio uses `react-contexify` (an imperative, ID-based context menu library) for right-click menus in the Table Editor grid, Log Table, and Storage file explorer. This requires `createPortal` workarounds, a separate CSS file, and has known bugs with fragment rendering. ## What is the new behavior? All context menus now use the declarative `ContextMenu_Shadcn_` (Radix-based) component that is already the standard across Studio. Each context menu wraps its trigger element directly, removing the need for imperative `show()` calls, portal hacks, and menu ID constants. The `react-contexify` dependency and all associated styles are removed. **Changes by area:** - **Grid row context menu**: `RowRenderer` wraps each `<Row>` with `ContextMenu_Shadcn_`. `RowContextMenu` refactored to accept `row` directly as a prop instead of looking it up by index. - **Log table**: Row renderer wraps each row with a context menu for "Copy event message". Removes `cellPosition` state and `createPortal`. - **Storage**: `FileExplorerRow` reuses its existing `rowOptions` array for both the dropdown and context menu. `FileExplorerColumn` inlines the column menu (new folder, select all, view/sort submenus). Three standalone context menu files deleted. - **Cleanup**: Removed `react-contexify` from `package.json`, deleted `contextMenu.scss`, removed styles from `grid.scss`. ## Additional context Net -370 lines. Follows the TODO comment in `CellContextMenuWrapper.tsx` and the existing eslint ban on `react-contexify` imports. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Replaced legacy right-click menus with a unified shadcn-style context menu across grids, logs, and the storage explorer. * Simplified row/column/item context menu behavior and copy actions; menus now mount and trigger more reliably. * **New Features** * Added row-level context menu providers to ensure consistent triggering and positioning for row actions. * **Chores** * Removed legacy context-menu styles and deprecated menu components. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
15 lines
456 B
TypeScript
15 lines
456 B
TypeScript
export const COLUMN_MIN_WIDTH = 100
|
|
|
|
export const STORAGE_KEY_PREFIX = 'supabase_grid'
|
|
|
|
export const TOTAL_ROWS_INITIAL = -1
|
|
export const TOTAL_ROWS_RESET = -2
|
|
|
|
export const SELECT_COLUMN_KEY = 'supabase-grid-select-row'
|
|
export const ADD_COLUMN_KEY = 'supabase-grid-add-column'
|
|
|
|
const RLS_ACKNOWLEDGED_KEY = 'supabase-acknowledge-rls-warning'
|
|
|
|
export const rlsAcknowledgedKey = (tableID?: string | number) =>
|
|
`${RLS_ACKNOWLEDGED_KEY}-${String(tableID)}`
|