mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## 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
32 lines
1.1 KiB
TypeScript
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} />
|
|
</>
|
|
)
|
|
}
|