Files
supabase/apps/studio/routes/project/$ref/editor/new.tsx
Joshen Lim df6eafef7c Joshenlim/fe 5116 support editduplicatedelete tables from (#53662)
## Context

We previously introduced context menus to the table editor
[here](https://github.com/supabase/supabase/pull/53506), but prevented
edit, delete, and duplicate actions as those actions were coupled to the
router. Hence this PR decouples that by making those actions target a
table by a provided ID

"More options" action now also shows on every row, just visibly shown
only if its active or the user hovers over the row
<img width="335" height="183" alt="image"
src="https://github.com/user-attachments/assets/9897945d-37f4-4658-9420-29b948173208"
/>

## To test

Can test edit / delete / duplicate table on a table that you're not
currently actively on, via both context menu and dropdown menu
2026-11-20 10:19:00 +07:00

32 lines
1.1 KiB
TypeScript

import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { DeleteConfirmationDialogs } from '@/components/interfaces/TableGridEditor/DeleteConfirmationDialogs'
import { SidePanelEditor } from '@/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor'
import { useCloseDeletedTableTab } from '@/components/interfaces/TableGridEditor/useCloseDeletedTableTab'
import { NewTab } from '@/components/layouts/Tabs/NewTab'
export const Route = createFileRoute('/project/$ref/editor/new')({
component: EditorNewPage,
})
function EditorNewPage() {
const navigate = useNavigate()
const { closeDeletedTableTab } = useCloseDeletedTableTab()
const { ref: projectRef } = Route.useParams()
const onTableCreated = (table: { id: number }) => {
void navigate({
to: '/project/$ref/editor/$id',
params: { ref: projectRef, id: String(table.id) },
})
}
return (
<>
<NewTab />
<SidePanelEditor onTableCreated={onTableCreated} />
<DeleteConfirmationDialogs onTableDeleted={closeDeletedTableTab} />
</>
)
}