mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 19:05:06 +03:00
## Context More groundwork for the Explorer - this one's focused on initializing the valtio store for managing notebooks Store architecture will follow closely with the existing sql-editor-store No data persistence yet, but can test creating a new notebook <img width="195" height="143" alt="image" src="https://github.com/user-attachments/assets/8656fb5b-3a8e-4f71-b2ce-d2f34ca9b552" /> Which should open a placeholder page <img width="1387" height="527" alt="image" src="https://github.com/user-attachments/assets/4a81b1ae-a740-40e6-9d33-29fa4f83b541" /> Closing the notebook brings you back to the explorer home page <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for creating and opening project notebooks from the Explorer. * Added notebook tabs alongside existing entity and SQL tabs. * Added notebook management, including loading, renaming, removing, editing cells, and tracking unsaved changes. * Added support for SQL, logs, and Markdown notebook cells. * Added dedicated notebook routes and an initial notebook editor view. * Added notebook icons throughout the Explorer interface. * **Documentation** * Documented session-scoped notebook state for query results and row limits. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
27 lines
780 B
TypeScript
27 lines
780 B
TypeScript
import { useParams } from 'common'
|
|
import { useEffect, useEffectEvent } from 'react'
|
|
|
|
import { useNotebooksStateSnapshot } from '@/state/notebooks/notebooks-state'
|
|
import { createTabId, useTabsStateSnapshot } from '@/state/tabs'
|
|
|
|
export const NotebookEditor = () => {
|
|
const { id } = useParams()
|
|
const tabs = useTabsStateSnapshot()
|
|
const snap = useNotebooksStateSnapshot()
|
|
const stateNotebook = id ? snap.notebooks[id] : undefined
|
|
|
|
const registerTab = useEffectEvent(() => {
|
|
if (!id) return
|
|
tabs.addTab({
|
|
id: createTabId('notebook', { id }),
|
|
type: 'notebook',
|
|
label: stateNotebook?.notebook.name ?? 'New Notebook',
|
|
metadata: { notebookId: id },
|
|
})
|
|
})
|
|
|
|
useEffect(() => registerTab(), [id])
|
|
|
|
return <div>This is a notebook</div>
|
|
}
|