Files
supabase/apps/studio/components/layouts/ExplorerLayout/ExplorerNavHome.tsx
Joshen Lim a7671019a8 Scaffold the explorer layout (#48740)
## Context

Resolves FE-4074

Just adds scaffolding for the explorer UI - no data fetching yet.
Initializes the page + side nav, based off Saxon's POC in
`poc/explorer-prototype`

<img width="1389" height="500" alt="image"
src="https://github.com/user-attachments/assets/8f293992-97d9-403e-91d6-2e104cd20eb5"
/>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## New Features
- Added a project Explorer page accessible from
`/project/:ref/explorer`.
- Added navigation for browsing notebooks and chats.
- Added search fields, back navigation, animated transitions, and empty
states for Explorer sections.
- Added a conditional Explorer link to the SQL Editor menu when enabled.

## Documentation
- Marked the Explorer route migration as complete in the migration
checklist.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-06 12:11:35 +07:00

56 lines
1.7 KiB
TypeScript

import { motion } from 'framer-motion'
import { ChevronRight } from 'lucide-react'
import {
EXPLORER_SECTIONS,
ExplorerResourceType,
LEVEL_OFFSET,
LEVEL_TRANSITION,
rowClassName,
} from './ExplorerLayout.constants'
export const ExplorerNavHome = ({
onSelectSection,
}: {
onSelectSection: (section: ExplorerResourceType) => void
}) => {
return (
<motion.div
key="root"
role="group"
aria-label="All resources"
initial={{ opacity: 0, x: -LEVEL_OFFSET }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -LEVEL_OFFSET }}
transition={LEVEL_TRANSITION}
className="absolute inset-0 flex flex-col gap-4 overflow-y-auto p-3"
>
<nav className="flex flex-col gap-px">
{EXPLORER_SECTIONS.map(({ type, label, icon: Icon }) => {
return (
<button
key={type}
type="button"
tabIndex={0}
className={rowClassName(false)}
onClick={() => onSelectSection(type)}
>
<Icon size={14} className="shrink-0" />
<span className="flex-1 text-left">{label}</span>
<span className="text-xs text-foreground-lighter">{/* Length will be here */}</span>
<ChevronRight size={14} className="shrink-0 text-foreground-muted" />
</button>
)
})}
</nav>
<section className="flex flex-col gap-px">
<h3 className="mb-2 px-3 font-mono text-sm font-normal uppercase text-foreground-lighter">
Recent
</h3>
<p className="px-3 text-xs text-foreground-lighter">Nothing edited yet</p>
</section>
</motion.div>
)
}