mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
Moves the SQL editor, table editor, explorer and project integrations page bodies into their route files and deletes the pages (FE-3106). Part 11 of the stack. **Depends on:** #53219 **Changed:** - `routes/project/$ref/{sql,editor,explorer,integrations}/**` – 15 page bodies inlined. Every `router.push/replace` became the equivalent `navigate` with the same path, `search` and `replace`; the last-opened-table redirect splits `buildTableEditorUrl`'s absolute URL with `splitInternalUrl` so it stays a client-side navigation - `components/interfaces/SQLEditor/SnippetNotFound.tsx` – the invalid-snippet state moves out of the route because `tabs.handleTabClose` still takes a Next-shaped router - `tests/routes/project/$ref/explorer/index.test.tsx` – moved and rendered with `renderRoute` **Removed:** - 15 page files Addresses [FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages). ## To test - SQL editor: open `/sql` (redirects to the last snippet or `new`), open/close snippets and tabs, an invalid snippet id shows "Unable to find snippet" - Table editor: open `/editor` (redirects to the last table), create a table – lands on it with `?schema=` - Explorer and Integrations pages – same layout; integration sub-pages redirect as before --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
31 lines
754 B
TypeScript
31 lines
754 B
TypeScript
import { createFileRoute } from '@tanstack/react-router'
|
|
import { useParams } from 'common'
|
|
import { useEffect } from 'react'
|
|
|
|
import SQLExamples from '@/components/interfaces/SQLEditor/SQLTemplates/SQLExamples'
|
|
import { createTabId, useTabsStateSnapshot } from '@/state/tabs'
|
|
|
|
export const Route = createFileRoute('/project/$ref/sql/examples')({
|
|
component: SqlExamples,
|
|
})
|
|
|
|
function SqlExamples() {
|
|
const { ref } = useParams()
|
|
const tabs = useTabsStateSnapshot()
|
|
|
|
useEffect(() => {
|
|
const tabId = createTabId('sql', { id: 'examples' })
|
|
tabs.addTab({
|
|
id: tabId,
|
|
type: 'sql',
|
|
label: 'Examples',
|
|
metadata: {
|
|
sqlId: 'examples',
|
|
name: 'examples',
|
|
},
|
|
})
|
|
}, [ref])
|
|
|
|
return <SQLExamples />
|
|
}
|