Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 143 additions & 47 deletions apps/web/src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { Routes, Route, Navigate, useNavigate } from 'react-router-dom';
import { Pane, PaneBody, PaneHeader, SplitShell, Button } from '@ghostodon/ui';
import { Pane, PaneBody, PaneHeader, Button, Container, Row, Column } from '@ghostodon/ui';
import LeftNav from '../components/LeftNav';
import TimelinePage from '../pages/TimelinePage';
import SearchPage from '../pages/SearchPage';
import MePage from '../pages/MePage';
import LoginPage from '../pages/LoginPage';
import RegisterPage from '../pages/RegisterPage';
import AuthCallbackPage from '../pages/AuthCallbackPage';
import ComponentsPage from '../pages/ComponentsPage';
import LayoutPage from '../pages/LayoutPage';
import LayoutPrimitivesPage from '../pages/LayoutPrimitivesPage';
import Inspector from '../components/Inspector';
import StoryViewer from '../components/stories/StoryViewer';
import { useInspectorStore, useThemeStore, useSessionStore } from '@ghostodon/state';
Expand All @@ -18,6 +21,18 @@ export default function App() {
const session = useSessionStore((s) => s.session);
const theme = useThemeStore((s) => s.theme);
const noise = useThemeStore((s) => s.noise);
const [leftOpen, setLeftOpen] = useState(true);
const [rightOpen, setRightOpen] = useState(true);

const renderChevron = (direction: 'left' | 'right') => (
<svg viewBox="0 0 24 24" className="h-4 w-4" aria-hidden="true">
{direction === 'left' ? (
<path d="M15 6 9 12l6 6" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
) : (
<path d="m9 6 6 6-6 6" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
)}
</svg>
);

// Apply theme (HTML class) + effects (BODY class)
useEffect(() => {
Expand Down Expand Up @@ -87,51 +102,132 @@ export default function App() {

return (
<>
<SplitShell
left={
<Pane>
<PaneHeader title="GHOSTODON" subtitle="Bird's-eye Mastodon control room" />
<PaneBody>
<LeftNav />
</PaneBody>
</Pane>
}
center={
<Pane>
<PaneHeader
title="FEED"
right={
<div className="flex items-center gap-2">
<Button variant="ghost" size="sm" onClick={() => setInspector({ type: 'settings' })}>
Theme
</Button>
<Button variant="ghost" size="sm" onClick={() => setInspector({ type: 'stages' })}>
Stages
</Button>
<Button size="sm" onClick={() => setInspector({ type: 'compose' })}>
New
</Button>
</div>
}
/>
<PaneBody>
<Routes>
<Route path="/" element={<Navigate to={session ? '/home' : '/login'} replace />} />
<Route path="/login" element={<LoginPage />} />
<Route path="/register" element={<RegisterPage />} />
<Route path="/auth/callback" element={<AuthCallbackPage />} />
<Route path="/home" element={<TimelinePage mode="home" />} />
<Route path="/local" element={<TimelinePage mode="local" />} />
<Route path="/federated" element={<TimelinePage mode="federated" />} />
<Route path="/search" element={<SearchPage />} />
<Route path="/me" element={<MePage />} />
<Route path="*" element={<div className="text-white/60">Not found</div>} />
</Routes>
</PaneBody>
</Pane>
}
right={<Inspector />}
/>
<Container className="h-full">
<Row className="min-h-0">
{leftOpen ? (
<Column
resizable
width={260}
minWidth={200}
maxWidth={360}
className="ghost-pane-slot ghost-pane-slot-left"
>
<Pane>
<PaneHeader
title="GHOSTODON"
subtitle="Bird's-eye Mastodon control room"
right={
<Button
variant="ghost"
size="sm"
title="Close left pane"
aria-label="Close left pane"
onClick={() => setLeftOpen(false)}
>
{renderChevron('left')}
</Button>
}
/>
<PaneBody>
<LeftNav />
</PaneBody>
</Pane>
</Column>
) : (
<div className="ghost-card flex items-start p-2">
<Button
variant="ghost"
size="sm"
title="Open left pane"
aria-label="Open left pane"
onClick={() => setLeftOpen(true)}
>
{renderChevron('right')}
</Button>
</div>
)}

<Column className="flex-1 min-w-0">
<Pane>
<PaneHeader
title="FEED"
right={
<div className="flex items-center gap-2">
<Button variant="ghost" size="sm" onClick={() => setInspector({ type: 'settings' })}>
Theme
</Button>
<Button variant="ghost" size="sm" onClick={() => setInspector({ type: 'stages' })}>
Stages
</Button>
<Button size="sm" onClick={() => setInspector({ type: 'compose' })}>
New
</Button>
</div>
}
/>
<PaneBody>
<Routes>
<Route path="/" element={<Navigate to={session ? '/home' : '/login'} replace />} />
<Route path="/login" element={<LoginPage />} />
<Route path="/register" element={<RegisterPage />} />
<Route path="/auth/callback" element={<AuthCallbackPage />} />
<Route path="/home" element={<TimelinePage mode="home" />} />
<Route path="/local" element={<TimelinePage mode="local" />} />
<Route path="/federated" element={<TimelinePage mode="federated" />} />
<Route path="/search" element={<SearchPage />} />
<Route path="/components" element={<ComponentsPage />} />
<Route path="/layout" element={<LayoutPage />} />
<Route path="/layout-primitives" element={<LayoutPrimitivesPage />} />
<Route path="/me" element={<MePage />} />
<Route path="*" element={<div className="text-white/60">Not found</div>} />
</Routes>
</PaneBody>
</Pane>
</Column>

{rightOpen ? (
<Column
resizable
width={360}
minWidth={260}
maxWidth={480}
className="ghost-pane-slot ghost-pane-slot-right"
>
<Pane>
<PaneHeader
title="INSPECTOR"
right={
<Button
variant="ghost"
size="sm"
title="Close right pane"
aria-label="Close right pane"
onClick={() => setRightOpen(false)}
>
{renderChevron('right')}
</Button>
}
/>
<PaneBody>
<Inspector />
</PaneBody>
</Pane>
</Column>
) : (
<div className="ghost-card flex items-start p-2">
<Button
variant="ghost"
size="sm"
title="Open right pane"
aria-label="Open right pane"
onClick={() => setRightOpen(true)}
>
{renderChevron('left')}
</Button>
</div>
)}
</Row>
</Container>
<StoryViewer />
</>
);
Expand Down
36 changes: 32 additions & 4 deletions apps/web/src/components/LeftNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ import { Link, NavLink } from 'react-router-dom';
import { Button, BrandLockup } from '@ghostodon/ui';
import { plugins } from '@ghostodon/plugins';
import { useInspectorStore, useSessionStore } from '@ghostodon/state';
import SurfaceOverlay from './SurfaceOverlay';

function NavItem(props: { to: string; label: string; hint?: string; icon?: React.ReactNode }) {
return (
<NavLink
to={props.to}
className={({ isActive }) =>
'ghost-navitem ' + (isActive ? 'ghost-navitem--active' : '')
'ghost-navitem relative overflow-hidden ' + (isActive ? 'ghost-navitem--active' : '')
}
>
<SurfaceOverlay />
<span className="ghost-navleft">
{props.icon ? <span className="ghost-navicon" aria-hidden="true">{props.icon}</span> : null}
<span className="truncate">{props.label}</span>
Expand Down Expand Up @@ -108,6 +110,26 @@ function UserPlusIcon() {
);
}

function LayersIcon() {
return (
<Icon>
<path d="M12 3 3 8l9 5 9-5-9-5Z" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" />
<path d="m3 13 9 5 9-5" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" />
<path d="m3 18 9 5 9-5" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" />
</Icon>
);
}

function LayoutIcon() {
return (
<Icon>
<rect x="3" y="4" width="8" height="16" stroke="currentColor" strokeWidth="2" />
<rect x="13" y="4" width="8" height="7" stroke="currentColor" strokeWidth="2" />
<rect x="13" y="13" width="8" height="7" stroke="currentColor" strokeWidth="2" />
</Icon>
);
}

export default function LeftNav() {
const setInspector = useInspectorStore((s) => s.setInspector);
const session = useSessionStore((s) => s.session);
Expand All @@ -130,6 +152,9 @@ export default function LeftNav() {
<div className="ghost-leftnav-section">
<div className="ghost-leftnav-kicker">Discovery</div>
<NavItem to="/search" label="Search" hint="Ctrl+4" icon={<SearchIcon />} />
<NavItem to="/components" label="Components" icon={<LayersIcon />} />
<NavItem to="/layout" label="Layout" icon={<LayoutIcon />} />
<NavItem to="/layout-primitives" label="Layout Primitives" icon={<LayoutIcon />} />
<NavItem to="/me" label="Me" hint="Ctrl+5" icon={<UserIcon />} />
</div>

Expand All @@ -140,7 +165,8 @@ export default function LeftNav() {
</div>

{extItems.length ? (
<div className="mt-1 ghost-card ghost-leftnav-card p-3">
<div className="mt-1 ghost-card ghost-leftnav-card relative overflow-hidden p-3">
<SurfaceOverlay />
<div className="ghost-leftnav-kicker">Extensions</div>
<div className="flex flex-col gap-2">
{extItems.map((it) =>
Expand All @@ -149,9 +175,10 @@ export default function LeftNav() {
) : (
<button
key={it.id}
className="ghost-navitem"
className="ghost-navitem relative overflow-hidden"
onClick={() => it.onSelect?.()}
>
<SurfaceOverlay />
<span>{it.label}</span>
{it.shortcutHint ? <span className="text-[11px] text-white/40">{it.shortcutHint}</span> : null}
</button>
Expand All @@ -161,7 +188,8 @@ export default function LeftNav() {
</div>
) : null}

<div className="mt-2 ghost-card ghost-leftnav-card p-3">
<div className="mt-2 ghost-card ghost-leftnav-card relative overflow-hidden p-3">
<SurfaceOverlay />
<div className="ghost-leftnav-kicker">Session</div>
{session ? (
<div className="mt-1 text-[12px] text-white/60">
Expand Down
34 changes: 34 additions & 0 deletions apps/web/src/components/SurfaceOverlay.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';

export default function SurfaceOverlay() {
return (
<div aria-hidden="true" className="pointer-events-none absolute inset-0">
<div
className="absolute inset-0 opacity-40"
style={{
backgroundImage:
'linear-gradient(135deg, rgba(var(--g-accent), 0.22), transparent 60%)',
}}
/>
<div
className="absolute inset-0 opacity-35"
style={{
backgroundImage:
'radial-gradient(circle, rgba(255,255,255,0.18) 1px, transparent 1.6px)',
backgroundSize: '18px 18px',
}}
/>
<div
className="absolute -right-10 -top-10 h-24 w-24 rounded-full blur-2xl"
style={{ background: 'rgba(var(--g-accent-2), 0.18)' }}
/>
<div
className="absolute bottom-0 left-0 h-[2px] w-full"
style={{
background:
'linear-gradient(90deg, rgba(var(--g-accent), 0.6), transparent)',
}}
/>
</div>
);
}
Loading