feat: refactor names

This commit is contained in:
2026-03-11 17:24:32 +01:00
parent 6471cee05f
commit fc58dcdaa2
16 changed files with 35 additions and 35 deletions

View File

@@ -17,7 +17,7 @@ import {
MenubarCheckboxItem,
} from '@/components/ui/menubar'
import { Kbd, KbdGroup } from '@/components/ui/kbd'
import { usePlatform } from '@/app/platform/platformContext'
import { usePlatform } from '@/app/kosmos/KosmosContext'
import { ArrowLeft, ClipboardPaste, Copy, CopyPlus, Download, FolderOpen, Pencil, Redo2, Undo2 } from 'lucide-react'
import { Input } from '@/components/ui/input'

View File

@@ -25,7 +25,7 @@ import {
import { AnimatedEdge } from '@/components/base/AnimatedEdge'
import FlowContext from '@/lib/flowContext'
import { useTheme } from '@/lib/themeContext'
import { usePlatform } from '@/app/platform/platformContext'
import { usePlatform } from '@/app/kosmos/KosmosContext'
import { useGraphStateWithHistory } from '@/hooks/useGraphStateWithHistory'
import {
ContextMenu,
@@ -67,7 +67,7 @@ import {
saveGraphToStorage,
PROJECT_FILE_EXT,
PROJECT_VERSION,
} from '@/app/platform/projectGraphStorage'
} from '@/app/pleroma/projectGraphStorage'
const SNAP_GRID: [number, number] = [15, 15]
const DUPLICATE_OFFSET = { x: 30, y: 30 }

View File

@@ -4,8 +4,8 @@
import React, { useEffect } from 'react'
import { useParams } from 'react-router-dom'
import { CanvasPage } from '../canvas/CanvasPage'
import { usePlatform } from './platformContext'
import { CanvasPage } from './CanvasPage'
import { usePlatform } from '../kosmos/KosmosContext'
export function CanvasRoute() {
const { projectId } = useParams<{ projectId: string }>()

View File

@@ -5,8 +5,8 @@
import React, { createContext, useCallback, useContext, useMemo, useState } from 'react'
import type { Project } from './types'
import { saveGraphToStorage } from './projectGraphStorage'
import { PROJECT_VERSION } from './projectGraphStorage'
import { saveGraphToStorage } from '../pleroma/projectGraphStorage'
import { PROJECT_VERSION } from '../pleroma/projectGraphStorage'
const STORAGE_KEY = 'zui_platform_projects'
const ORDER_STORAGE_KEY = 'zui_platform_project_order'
@@ -149,7 +149,7 @@ export function sortProjectsByOrder(projects: Project[], order: string[]): Proje
return [...ordered, ...rest]
}
export type PlatformContextValue = {
export type KosmosContextValue = {
projects: Project[]
projectOrder: string[]
/** Projects in display order (sidebar order, then lastEditedAt) */
@@ -172,9 +172,9 @@ export type PlatformContextValue = {
setAiConnection: (value: AiConnection) => void
}
const PlatformContext = createContext<PlatformContextValue | null>(null)
const KosmosContext = createContext<KosmosContextValue | null>(null)
export function PlatformProvider({ children }: { children: React.ReactNode }) {
export function KosmosProvider({ children }: { children: React.ReactNode }) {
const [projects, setProjects] = useState<Project[]>(loadProjects)
const [projectOrder, setProjectOrder] = useState<string[]>(loadOrder)
const [recentProjectIds, setRecentProjectIds] = useState<string[]>(loadRecentIds)
@@ -281,7 +281,7 @@ export function PlatformProvider({ children }: { children: React.ReactNode }) {
[projects, projectOrder]
)
const value: PlatformContextValue = useMemo(
const value: KosmosContextValue = useMemo(
() => ({
projects,
projectOrder,
@@ -320,11 +320,11 @@ export function PlatformProvider({ children }: { children: React.ReactNode }) {
]
)
return <PlatformContext.Provider value={value}>{children}</PlatformContext.Provider>
return <KosmosContext.Provider value={value}>{children}</KosmosContext.Provider>
}
export function usePlatform() {
const ctx = useContext(PlatformContext)
const ctx = useContext(KosmosContext)
if (!ctx) throw new Error('usePlatform must be used within PlatformProvider')
return ctx
}

View File

@@ -5,10 +5,10 @@
import React, { useEffect, useState } from 'react'
import { Outlet, useParams } from 'react-router-dom'
import { SidebarProvider } from '@/components/ui/sidebar'
import { PlatformProvider, usePlatform } from './platformContext'
import { AppSidebar } from './AppSidebar'
import { KosmosProvider, usePlatform } from './KosmosContext'
import { KosmosSidebar } from './KosmosSidebar'
function PlatformLayoutInner() {
function KosmosLayoutInner() {
const { projectId } = useParams<{ projectId: string }>()
const { recordProjectAccess } = usePlatform()
const [sidebarOpen, setSidebarOpen] = useState(true)
@@ -19,7 +19,7 @@ function PlatformLayoutInner() {
return (
<SidebarProvider open={sidebarOpen} onOpenChange={setSidebarOpen}>
<AppSidebar />
<KosmosSidebar />
<div className="relative flex h-dvh min-h-0 w-full flex-1 flex-col overflow-hidden bg-background">
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
<Outlet />
@@ -29,10 +29,10 @@ function PlatformLayoutInner() {
)
}
export function PlatformPage() {
export function KosmosPage() {
return (
<PlatformProvider>
<PlatformLayoutInner />
</PlatformProvider>
<KosmosProvider>
<KosmosLayoutInner />
</KosmosProvider>
)
}

View File

@@ -20,13 +20,13 @@ import {
import { Plus, Settings, Triangle } from 'lucide-react'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { useSidebar } from '@/components/ui/sidebar'
import { usePlatform } from './platformContext'
import { usePlatform } from './KosmosContext'
import { getProjectIcon } from '../../lib/iconMap'
import { NewProjectDialog } from './NewProjectDialog'
import { SettingsDialog } from './SettingsDialog'
import type { Project } from './types'
export function AppSidebar() {
export function KosmosSidebar() {
const { state, setOpen } = useSidebar()
const isCollapsed = state === 'collapsed'
const { orderedProjects, createProject, recentProjectIds } = usePlatform()

View File

@@ -22,8 +22,8 @@ import { Switch } from '@/components/ui/switch'
import { Input } from '@/components/ui/input'
import { useTheme } from '@/lib/themeContext'
import type { Theme } from '@/lib/themeContext'
import { usePlatform } from './platformContext'
import type { AiConnection, AiConnectionProvider } from './platformContext'
import { usePlatform } from './KosmosContext'
import type { AiConnection, AiConnectionProvider } from './KosmosContext'
import { Sun, Sparkles } from 'lucide-react'
type SettingsSection = 'appearance' | 'ai'

View File

@@ -55,7 +55,7 @@ import {
Copy,
} from 'lucide-react'
import { Checkbox } from '@/components/ui/checkbox'
import { usePlatform } from './platformContext'
import { usePlatform } from '../kosmos/KosmosContext'
import { getProjectIcon } from '../../lib/iconMap'
import {
loadGraphFromStorage,
@@ -65,9 +65,9 @@ import {
PROJECT_VERSION,
} from './projectGraphStorage'
import { toast } from 'sonner'
import { NewProjectDialog } from './NewProjectDialog'
import { NewProjectDialog } from '../kosmos/NewProjectDialog'
import { ProjectsPageBackground } from './ProjectsPageBackground'
import type { Project } from './types'
import type { Project } from '../kosmos/types'
const PAGE_SIZE_OPTIONS = [10, 25, 50] as const
type SortKey = 'lastEdited' | 'name' | 'created'

View File

@@ -16,7 +16,7 @@ import { NodeFooterEdgeIndicators } from '@/components/base/NodeFooterEdgeIndica
import { NodeHeaderTitle } from '@/components/base/NodeHeaderTitle'
import { InputHandle, OutputHandle } from '@/components/base/NodeHandles'
import { Button } from '@/components/ui/button'
import { usePlatform } from '@/app/platform/platformContext'
import { usePlatform } from '@/app/kosmos/KosmosContext'
import { Bot, Play, Loader2 } from 'lucide-react'
export type AgentNodeData = {

View File

@@ -18,7 +18,7 @@ import {
Turtle,
type LucideIcon,
} from 'lucide-react'
import type { ProjectIconId } from '../app/platform/types'
import type { ProjectIconId } from '../app/kosmos/types'
export const PROJECT_ICON_MAP: Record<ProjectIconId, LucideIcon> = {
bird: Bird,

View File

@@ -4,10 +4,10 @@ import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'
import { Toaster } from 'sonner'
import { ThemeProvider } from './lib/themeContext'
import { registerBuiltinNodes } from './lib/registerBuiltinNodes'
import { PlatformPage } from './app/platform/PlatformPage'
import { ProjectsPage } from './app/platform/ProjectsPage'
import { KeromaPage } from './app/platform/KeromaPage'
import { CanvasRoute } from './app/platform/CanvasRoute'
import { KosmosPage } from './app/kosmos/KosmosPage'
import { ProjectsPage } from './app/pleroma/PleromaPage'
import { KeromaPage } from './app/keroma/KeromaPage'
import { CanvasRoute } from './app/canvas/CanvasRoute'
import './styles.css'
import '@xyflow/react/dist/style.css'
@@ -18,7 +18,7 @@ createRoot(document.getElementById('root')!).render(
<ThemeProvider>
<BrowserRouter>
<Routes>
<Route path="/" element={<PlatformPage />}>
<Route path="/" element={<KosmosPage />}>
<Route index element={<Navigate to="/projects" replace />} />
<Route path="projects" element={<ProjectsPage />} />
<Route path="projects/:projectId" element={<CanvasRoute />} />