mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 09:50:33 -04:00
3f9765e2f8
## 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>
87 lines
2.2 KiB
TypeScript
87 lines
2.2 KiB
TypeScript
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
// Original storage constants
|
|
export enum URL_EXPIRY_DURATION {
|
|
WEEK = 60 * 60 * 24 * 7,
|
|
MONTH = 60 * 60 * 24 * 30,
|
|
YEAR = 60 * 60 * 24 * 365,
|
|
}
|
|
|
|
export enum STORAGE_VIEWS {
|
|
COLUMNS = 'COLUMNS',
|
|
LIST = 'LIST',
|
|
}
|
|
|
|
export enum STORAGE_SORT_BY {
|
|
NAME = 'name',
|
|
UPDATED_AT = 'updated_at',
|
|
CREATED_AT = 'created_at',
|
|
LAST_ACCESSED_AT = 'last_accessed_at',
|
|
}
|
|
|
|
export enum STORAGE_BUCKET_SORT {
|
|
ALPHABETICAL = 'alphabetical',
|
|
CREATED_AT = 'created_at',
|
|
}
|
|
|
|
export enum STORAGE_SORT_BY_ORDER {
|
|
ASC = 'asc',
|
|
DESC = 'desc',
|
|
}
|
|
|
|
export enum STORAGE_ROW_TYPES {
|
|
BUCKET = 'BUCKET',
|
|
FILE = 'FILE',
|
|
FOLDER = 'FOLDER',
|
|
}
|
|
|
|
export enum STORAGE_ROW_STATUS {
|
|
READY = 'READY',
|
|
LOADING = 'LOADING',
|
|
EDITING = 'EDITING',
|
|
}
|
|
|
|
export const STORAGE_CLIENT_LIBRARY_MAPPINGS = {
|
|
upload: ['INSERT'],
|
|
download: ['SELECT'],
|
|
list: ['SELECT'],
|
|
update: ['SELECT', 'UPDATE'],
|
|
move: ['SELECT', 'UPDATE'],
|
|
copy: ['SELECT', 'INSERT'],
|
|
remove: ['SELECT', 'DELETE'],
|
|
createSignedUrl: ['SELECT'],
|
|
createSignedUrls: ['SELECT'],
|
|
getPublicUrl: [],
|
|
}
|
|
|
|
export const BUCKET_TYPES = {
|
|
files: {
|
|
displayName: 'Files',
|
|
singularName: 'file',
|
|
article: 'a',
|
|
description: 'General file storage for most types of digital content',
|
|
valueProp: 'Store images, videos, documents, and any other file type.',
|
|
docsUrl: `${DOCS_URL}/guides/storage/buckets/fundamentals`,
|
|
},
|
|
analytics: {
|
|
displayName: 'Analytics',
|
|
singularName: 'analytics',
|
|
article: 'an',
|
|
description: 'Purpose-built storage for analytical workloads',
|
|
valueProp: 'Store large datasets for analytics and reporting.',
|
|
docsUrl: `${DOCS_URL}/guides/storage/analytics/introduction`,
|
|
},
|
|
vectors: {
|
|
displayName: 'Vectors',
|
|
singularName: 'vector',
|
|
article: 'a',
|
|
description: 'Purpose-built storage for vector data',
|
|
valueProp: 'Store, index, and query your vector embeddings at scale.',
|
|
docsUrl: `${DOCS_URL}/guides/storage/vector/introduction`,
|
|
},
|
|
}
|
|
export const BUCKET_TYPE_KEYS = Object.keys(BUCKET_TYPES) as Array<keyof typeof BUCKET_TYPES>
|
|
export const DEFAULT_BUCKET_TYPE: keyof typeof BUCKET_TYPES = 'files'
|
|
|
|
export const PUBLIC_BUCKET_TOOLTIP = 'Objects in this bucket are readable by anyone with the URL.'
|