From ed0debfeac7e4f489b527b590158c303ad454fbb Mon Sep 17 00:00:00 2001 From: Andre Padez Date: Sun, 22 Feb 2026 22:43:28 +0000 Subject: [PATCH] WorkspaceLayout in officerdev workspace --- .../Screens/Dashboard/Automation/index.tsx | 4 ++-- .../Dashboard/ChatHistory/defaultLayout.ts | 2 +- .../Screens/Dashboard/ChatHistory/index.tsx | 5 ++--- .../Screens/Dashboard/Files/FilesScreen.tsx | 5 ++--- .../Screens/Dashboard/Files/defaultLayout.ts | 2 +- .../Screens/Dashboard/Home/HomeScreen.tsx | 4 ++-- .../Screens/Dashboard/Home/defaultLayout.tsx | 2 +- .../Dashboard/Projects/ProjectListScreen.tsx | 6 +++--- .../Dashboard/Projects/ProjectScreen.tsx | 4 ++-- .../Dashboard/Projects/defaultLayout.ts | 2 +- .../Settings/ProfileSettings/index.tsx | 4 ++-- .../Settings/ResourceSettings/index.tsx | 5 ++--- .../Dashboard/Settings/SystemSettings.tsx | 5 ++--- .../Dashboard/Terminal/TerminalScreen.tsx | 4 ++-- .../Dashboard/Terminal/defaultLayout.ts | 2 +- .../Dashboard/Workspaces/WorkspaceScreen.tsx | 4 ++-- .../Dashboard/Workspaces/WorkspacesScreen.tsx | 4 ++-- .../Dashboard/Workspaces/defaultLayout.ts | 2 +- src/workspaces/components/package.json | 1 - .../useAppRegistry/useAppRegistry.ts | 2 +- .../src/apps/ChatHistory/ChatDetailPanel.tsx | 19 +++++++++++++------ .../officerdev/src/apps/ChatHistory/index.ts | 2 +- .../src/apps/CodeEditor/CodeEditorHeader.tsx | 2 +- .../FileBrowserPanelWrapper.tsx | 2 +- .../src/apps/Preview/PreviewContext.tsx | 2 +- .../src/apps/Preview/PreviewProvider.tsx | 4 ++-- .../src/apps/Projects/ProjectListApp.tsx | 2 +- .../src/apps/Projects/ProjectPreview.tsx | 4 ++-- .../apps/Terminal/CommandTerminalWrapper.tsx | 2 +- .../officerdev/src/apps/Terminal/Headers.tsx | 2 +- .../src/apps/Terminal/HostTerminalWrapper.tsx | 2 +- .../src/apps/Terminal/TerminalWrapper.tsx | 2 +- .../src/apps/Workspaces/WorkspaceListApp.tsx | 2 +- .../src/apps/Workspaces/WorkspacePreview.tsx | 4 ++-- .../src}/components/Workspace/AppPicker.tsx | 0 .../src}/components/Workspace/DragOverlay.tsx | 0 .../components/Workspace/LayoutEditor.tsx | 0 .../src}/components/Workspace/PanelSlot.tsx | 4 ++-- .../components/Workspace/WorkspaceContext.ts | 0 .../components/Workspace/WorkspaceHeader.tsx | 0 .../components/Workspace/WorkspaceLayout.tsx | 2 +- .../Workspace/WorkspaceRenderer.tsx | 2 +- .../components/Workspace/WorkspaceView.tsx | 4 ++-- .../src}/components/Workspace/index.ts | 0 .../src}/components/Workspace/layout-utils.ts | 0 .../src}/components/Workspace/types.ts | 0 .../src/hooks/useFileViewerPanels/layouts.ts | 2 +- .../useFileViewerPanels.tsx | 2 +- src/workspaces/officerdev/src/index.ts | 5 +++++ .../officerdev/src/useAppRegistry.ts | 2 +- src/workspaces/widgets/widget-registry.tsx | 2 +- 51 files changed, 76 insertions(+), 69 deletions(-) rename src/workspaces/{ => officerdev/src}/components/Workspace/AppPicker.tsx (100%) rename src/workspaces/{ => officerdev/src}/components/Workspace/DragOverlay.tsx (100%) rename src/workspaces/{ => officerdev/src}/components/Workspace/LayoutEditor.tsx (100%) rename src/workspaces/{ => officerdev/src}/components/Workspace/PanelSlot.tsx (99%) rename src/workspaces/{ => officerdev/src}/components/Workspace/WorkspaceContext.ts (100%) rename src/workspaces/{ => officerdev/src}/components/Workspace/WorkspaceHeader.tsx (100%) rename src/workspaces/{ => officerdev/src}/components/Workspace/WorkspaceLayout.tsx (95%) rename src/workspaces/{ => officerdev/src}/components/Workspace/WorkspaceRenderer.tsx (99%) rename src/workspaces/{ => officerdev/src}/components/Workspace/WorkspaceView.tsx (98%) rename src/workspaces/{ => officerdev/src}/components/Workspace/index.ts (100%) rename src/workspaces/{ => officerdev/src}/components/Workspace/layout-utils.ts (100%) rename src/workspaces/{ => officerdev/src}/components/Workspace/types.ts (100%) diff --git a/src/apps/officer-web/Screens/Dashboard/Automation/index.tsx b/src/apps/officer-web/Screens/Dashboard/Automation/index.tsx index e267878c..6c028f8d 100644 --- a/src/apps/officer-web/Screens/Dashboard/Automation/index.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Automation/index.tsx @@ -3,8 +3,8 @@ import { useQuery } from '@tanstack/react-query'; import { useClient } from 'hooks/useClient'; import { useAuth } from 'hooks/useAuth'; import { usePanelChannel } from 'hooks/usePanelChannel'; -import type { LayoutNode, PanelComponents } from '@/components/Workspace'; -import { WorkspaceLayout } from '@/components/Workspace'; +import type { LayoutNode, PanelComponents } from 'officerdev'; +import { WorkspaceLayout } from 'officerdev'; import { useUserState } from 'state/useUserState'; import { AutomationRightPanel } from './AutomationRightPanel'; diff --git a/src/apps/officer-web/Screens/Dashboard/ChatHistory/defaultLayout.ts b/src/apps/officer-web/Screens/Dashboard/ChatHistory/defaultLayout.ts index 70c8d2df..79cf3de4 100644 --- a/src/apps/officer-web/Screens/Dashboard/ChatHistory/defaultLayout.ts +++ b/src/apps/officer-web/Screens/Dashboard/ChatHistory/defaultLayout.ts @@ -1,4 +1,4 @@ -import type { LayoutNode } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; export const defaultLayout: LayoutNode = { type: 'group', diff --git a/src/apps/officer-web/Screens/Dashboard/ChatHistory/index.tsx b/src/apps/officer-web/Screens/Dashboard/ChatHistory/index.tsx index 3f5abe93..50d89864 100644 --- a/src/apps/officer-web/Screens/Dashboard/ChatHistory/index.tsx +++ b/src/apps/officer-web/Screens/Dashboard/ChatHistory/index.tsx @@ -1,11 +1,10 @@ import { useEffect } from 'react'; import { useParams } from 'react-router'; -import { WorkspaceView } from '@/components/Workspace'; -import type { LayoutNode } from '@/components/Workspace'; +import type { LayoutNode, SelectedSession } from 'officerdev'; +import { WorkspaceView } from 'officerdev'; import { useWorkspacesState } from 'state/useWorkspacesState'; import { usePanelChannel } from 'hooks/usePanelChannel'; import { useChatSessions } from 'state/useChatSessions'; -import type { SelectedSession } from 'officerdev'; import { defaultLayout } from './defaultLayout'; export { ChatHistory as ChatHistoryApp } from './Widget'; diff --git a/src/apps/officer-web/Screens/Dashboard/Files/FilesScreen.tsx b/src/apps/officer-web/Screens/Dashboard/Files/FilesScreen.tsx index cc227cf1..e72ea7c6 100644 --- a/src/apps/officer-web/Screens/Dashboard/Files/FilesScreen.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Files/FilesScreen.tsx @@ -1,7 +1,6 @@ -import type { LayoutNode } from '@/components/Workspace'; -import { WorkspaceView } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; +import { WorkspaceView, useFileViewerPanels } from 'officerdev'; import { useWorkspacesState } from 'state/useWorkspacesState'; -import { useFileViewerPanels } from 'officerdev'; import { defaultLayout } from './defaultLayout'; export const FilesScreen = () => { diff --git a/src/apps/officer-web/Screens/Dashboard/Files/defaultLayout.ts b/src/apps/officer-web/Screens/Dashboard/Files/defaultLayout.ts index 8981a693..59331c8e 100644 --- a/src/apps/officer-web/Screens/Dashboard/Files/defaultLayout.ts +++ b/src/apps/officer-web/Screens/Dashboard/Files/defaultLayout.ts @@ -1,4 +1,4 @@ -import type { LayoutNode } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; export const defaultLayout: LayoutNode = { type: 'panel', diff --git a/src/apps/officer-web/Screens/Dashboard/Home/HomeScreen.tsx b/src/apps/officer-web/Screens/Dashboard/Home/HomeScreen.tsx index 9805d538..4dd6e2f7 100644 --- a/src/apps/officer-web/Screens/Dashboard/Home/HomeScreen.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Home/HomeScreen.tsx @@ -1,5 +1,5 @@ -import type { LayoutNode } from '@/components/Workspace'; -import { WorkspaceView } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; +import { WorkspaceView } from 'officerdev'; import { useWorkspacesState } from 'state/useWorkspacesState'; import { defaultLayout } from './defaultLayout'; diff --git a/src/apps/officer-web/Screens/Dashboard/Home/defaultLayout.tsx b/src/apps/officer-web/Screens/Dashboard/Home/defaultLayout.tsx index d22bf202..967c377c 100644 --- a/src/apps/officer-web/Screens/Dashboard/Home/defaultLayout.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Home/defaultLayout.tsx @@ -1,4 +1,4 @@ -import type { LayoutNode } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; export const defaultLayout: LayoutNode = { type: 'group', diff --git a/src/apps/officer-web/Screens/Dashboard/Projects/ProjectListScreen.tsx b/src/apps/officer-web/Screens/Dashboard/Projects/ProjectListScreen.tsx index 74dbf363..ecfebbe6 100644 --- a/src/apps/officer-web/Screens/Dashboard/Projects/ProjectListScreen.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Projects/ProjectListScreen.tsx @@ -2,10 +2,9 @@ import { useEffect } from 'react'; import { useNavigate, useSearchParams } from 'react-router'; import { useGlobal } from 'hooks/useGlobal'; import { useWorkspacesState } from 'state/useWorkspacesState'; -import { WorkspaceView } from '@/components/Workspace'; -import type { LayoutNode, ProjectType } from '@/components/Workspace'; -import { generateSlug } from 'helpers/slug'; +import type { LayoutNode, ProjectType } from 'officerdev'; import { + WorkspaceView, SELECTED_PROJECT, CREATING_PROJECT, EDITING_PROJECT, @@ -16,6 +15,7 @@ import { NEW_PROJ_HAS_BACKEND, NEW_PROJ_HAS_AUTH, } from 'officerdev'; +import { generateSlug } from 'helpers/slug'; import { defaultLayout } from './defaultLayout'; export const ProjectListScreen = () => { diff --git a/src/apps/officer-web/Screens/Dashboard/Projects/ProjectScreen.tsx b/src/apps/officer-web/Screens/Dashboard/Projects/ProjectScreen.tsx index fadc3fed..4dfdf181 100644 --- a/src/apps/officer-web/Screens/Dashboard/Projects/ProjectScreen.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Projects/ProjectScreen.tsx @@ -1,7 +1,7 @@ import { useParams, Navigate } from 'react-router'; import { useWorkspacesState } from 'state/useWorkspacesState'; -import { WorkspaceView, createDefaultLayout } from '@/components/Workspace'; -import type { LayoutNode, ProjectDefinition } from '@/components/Workspace'; +import type { LayoutNode, ProjectDefinition } from 'officerdev'; +import { WorkspaceView, createDefaultLayout } from 'officerdev'; export const ProjectScreen = () => { const { id } = useParams<{ id: string }>(); diff --git a/src/apps/officer-web/Screens/Dashboard/Projects/defaultLayout.ts b/src/apps/officer-web/Screens/Dashboard/Projects/defaultLayout.ts index ea6d69ff..658626e1 100644 --- a/src/apps/officer-web/Screens/Dashboard/Projects/defaultLayout.ts +++ b/src/apps/officer-web/Screens/Dashboard/Projects/defaultLayout.ts @@ -1,4 +1,4 @@ -import type { LayoutNode } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; export const defaultLayout: LayoutNode = { type: 'group', diff --git a/src/apps/officer-web/Screens/Dashboard/Settings/ProfileSettings/index.tsx b/src/apps/officer-web/Screens/Dashboard/Settings/ProfileSettings/index.tsx index 7ca4af21..dfa3f868 100644 --- a/src/apps/officer-web/Screens/Dashboard/Settings/ProfileSettings/index.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Settings/ProfileSettings/index.tsx @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { User, Lock, Globe, ListChecks } from 'lucide-react'; -import type { LayoutNode, PanelComponents } from '@/components/Workspace'; -import { WorkspaceLayout } from '@/components/Workspace'; +import type { LayoutNode, PanelComponents } from 'officerdev'; +import { WorkspaceLayout } from 'officerdev'; import { createSettingsPanelComponents, type SettingsSection } from '../SettingsPanel'; import { UserData } from './UserData'; diff --git a/src/apps/officer-web/Screens/Dashboard/Settings/ResourceSettings/index.tsx b/src/apps/officer-web/Screens/Dashboard/Settings/ResourceSettings/index.tsx index 136bf401..36aa901a 100644 --- a/src/apps/officer-web/Screens/Dashboard/Settings/ResourceSettings/index.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Settings/ResourceSettings/index.tsx @@ -2,11 +2,10 @@ import { useState, useEffect, useMemo } from 'react'; import { X } from 'lucide-react'; import { toast } from 'sonner'; import { useQueryClient } from '@tanstack/react-query'; -import type { LayoutNode, PanelComponents } from '@/components/Workspace'; -import { WorkspaceLayout } from '@/components/Workspace'; +import type { LayoutNode, PanelComponents } from 'officerdev'; +import { WorkspaceLayout, TerminalView, FileViewerView } from 'officerdev'; import { usePanelChannel } from 'hooks/usePanelChannel'; import { useClient } from 'hooks/useClient'; -import { TerminalView, FileViewerView } from 'officerdev'; import { Resources } from './Resources'; import { ResourceSidebar } from './ResourceSidebar'; diff --git a/src/apps/officer-web/Screens/Dashboard/Settings/SystemSettings.tsx b/src/apps/officer-web/Screens/Dashboard/Settings/SystemSettings.tsx index 2a31e6ca..c0e7dfb6 100644 --- a/src/apps/officer-web/Screens/Dashboard/Settings/SystemSettings.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Settings/SystemSettings.tsx @@ -8,10 +8,9 @@ import { Textarea } from '@/components/ui/textarea'; import { Slider } from '@/components/ui/slider'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { useQueryClient } from '@tanstack/react-query'; -import type { LayoutNode, PanelComponents } from '@/components/Workspace'; -import { WorkspaceLayout } from '@/components/Workspace'; +import type { LayoutNode, PanelComponents } from 'officerdev'; +import { WorkspaceLayout, TerminalView } from 'officerdev'; import { usePanelChannel } from 'hooks/usePanelChannel'; -import { TerminalView } from 'officerdev'; import { createSettingsPanelComponents, type SettingsSectionGroup } from './SettingsPanel'; import { useSettings } from 'state/useSettings'; diff --git a/src/apps/officer-web/Screens/Dashboard/Terminal/TerminalScreen.tsx b/src/apps/officer-web/Screens/Dashboard/Terminal/TerminalScreen.tsx index 5dc563de..dd38b3de 100644 --- a/src/apps/officer-web/Screens/Dashboard/Terminal/TerminalScreen.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Terminal/TerminalScreen.tsx @@ -1,5 +1,5 @@ -import type { LayoutNode } from '@/components/Workspace'; -import { WorkspaceView } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; +import { WorkspaceView } from 'officerdev'; import { useWorkspacesState } from 'state/useWorkspacesState'; import { defaultLayout } from './defaultLayout'; diff --git a/src/apps/officer-web/Screens/Dashboard/Terminal/defaultLayout.ts b/src/apps/officer-web/Screens/Dashboard/Terminal/defaultLayout.ts index 1daea597..2280ca2e 100644 --- a/src/apps/officer-web/Screens/Dashboard/Terminal/defaultLayout.ts +++ b/src/apps/officer-web/Screens/Dashboard/Terminal/defaultLayout.ts @@ -1,4 +1,4 @@ -import type { LayoutNode } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; export const defaultLayout: LayoutNode = { type: 'panel', diff --git a/src/apps/officer-web/Screens/Dashboard/Workspaces/WorkspaceScreen.tsx b/src/apps/officer-web/Screens/Dashboard/Workspaces/WorkspaceScreen.tsx index ed179c2c..03695772 100644 --- a/src/apps/officer-web/Screens/Dashboard/Workspaces/WorkspaceScreen.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Workspaces/WorkspaceScreen.tsx @@ -1,7 +1,7 @@ import { useParams, Navigate } from 'react-router'; import { useWorkspacesState } from 'state/useWorkspacesState'; -import { WorkspaceView, createDefaultLayout } from '@/components/Workspace'; -import type { LayoutNode, WorkspaceDefinition } from '@/components/Workspace'; +import type { LayoutNode, WorkspaceDefinition } from 'officerdev'; +import { WorkspaceView, createDefaultLayout } from 'officerdev'; export const WorkspaceScreen = () => { const { id } = useParams<{ id: string }>(); diff --git a/src/apps/officer-web/Screens/Dashboard/Workspaces/WorkspacesScreen.tsx b/src/apps/officer-web/Screens/Dashboard/Workspaces/WorkspacesScreen.tsx index c48773a3..a71af450 100644 --- a/src/apps/officer-web/Screens/Dashboard/Workspaces/WorkspacesScreen.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Workspaces/WorkspacesScreen.tsx @@ -1,5 +1,5 @@ -import type { LayoutNode } from '@/components/Workspace'; -import { WorkspaceView } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; +import { WorkspaceView } from 'officerdev'; import { useWorkspacesState } from 'state/useWorkspacesState'; import { defaultLayout } from './defaultLayout'; diff --git a/src/apps/officer-web/Screens/Dashboard/Workspaces/defaultLayout.ts b/src/apps/officer-web/Screens/Dashboard/Workspaces/defaultLayout.ts index 81614cbf..98762bcf 100644 --- a/src/apps/officer-web/Screens/Dashboard/Workspaces/defaultLayout.ts +++ b/src/apps/officer-web/Screens/Dashboard/Workspaces/defaultLayout.ts @@ -1,4 +1,4 @@ -import type { LayoutNode } from '@/components/Workspace'; +import type { LayoutNode } from 'officerdev'; export const defaultLayout: LayoutNode = { type: 'group', diff --git a/src/workspaces/components/package.json b/src/workspaces/components/package.json index 448e51b6..86cba905 100644 --- a/src/workspaces/components/package.json +++ b/src/workspaces/components/package.json @@ -5,7 +5,6 @@ "type": "module", "exports": { ".": "./index.ts", - "./Workspace": "./Workspace/index.ts", "./*": "./*.tsx", "./ui/*": "./ui/*.tsx" }, diff --git a/src/workspaces/officerdev/src/AppRegistry/useAppRegistry/useAppRegistry.ts b/src/workspaces/officerdev/src/AppRegistry/useAppRegistry/useAppRegistry.ts index 03659e25..f3f9937c 100644 --- a/src/workspaces/officerdev/src/AppRegistry/useAppRegistry/useAppRegistry.ts +++ b/src/workspaces/officerdev/src/AppRegistry/useAppRegistry/useAppRegistry.ts @@ -1,4 +1,4 @@ -import type { AppRegistry, AppRegistryEntry } from '@/components/Workspace'; +import type { AppRegistry, AppRegistryEntry } from '../../components/Workspace'; import { useGlobal } from 'hooks/useGlobal'; export type AppRegistryMeta = { key: string } & AppRegistryEntry; diff --git a/src/workspaces/officerdev/src/apps/ChatHistory/ChatDetailPanel.tsx b/src/workspaces/officerdev/src/apps/ChatHistory/ChatDetailPanel.tsx index 66413437..0669206d 100644 --- a/src/workspaces/officerdev/src/apps/ChatHistory/ChatDetailPanel.tsx +++ b/src/workspaces/officerdev/src/apps/ChatHistory/ChatDetailPanel.tsx @@ -2,6 +2,7 @@ import { useState } from 'react'; import { useLocation } from 'react-router'; import { Trash2, Home, Monitor } from 'lucide-react'; import { usePanelChannel } from 'hooks/usePanelChannel'; +import { useAuth } from 'hooks/useAuth'; import { useChatSessions } from 'state/useChatSessions'; import { getHostHome } from 'state/useModels'; import { usePiChat, EmbeddableChat } from '../Chat'; @@ -126,15 +127,17 @@ function CwdToggle({ cwdMode, onChange }: { cwdMode: 'user' | 'host'; onChange: ); } -function NewChat() { +function NewChat({ allowHostMode }: { allowHostMode?: boolean }) { const location = useLocation(); const locationState = location.state as ChatLocationState; + const { user } = useAuth(); + const showToggle = allowHostMode && user?.role === 'Super Admin'; const [cwdMode, setCwdMode] = useState<'user' | 'host'>('user'); const chat = usePiChat(undefined, locationState?.model); - const sandboxed = cwdMode === 'user'; - const cwd = cwdMode === 'host' ? { path: getHostHome() } : locationState?.cwd; + const sandboxed = showToggle ? cwdMode === 'user' : true; + const cwd = !sandboxed ? { path: getHostHome() } : locationState?.cwd; const initialMessage = locationState?.initialMessage ? { @@ -153,7 +156,7 @@ function NewChat() { isGenerating={chat.isGenerating} onDelete={undefined} /> - {!chat.hasStarted && } + {!chat.hasStarted && showToggle && } { +type ChatDetailPanelProps = { + allowHostMode?: boolean; +}; + +export const ChatDetailPanel = ({ allowHostMode }: ChatDetailPanelProps) => { const [selected] = usePanelChannel(CHANNEL, null); if (!selected) { @@ -180,7 +187,7 @@ export const ChatDetailPanel = () => { } if (selected.id.startsWith('new')) { - return ; + return ; } return ; diff --git a/src/workspaces/officerdev/src/apps/ChatHistory/index.ts b/src/workspaces/officerdev/src/apps/ChatHistory/index.ts index fbce3b09..7464eb88 100644 --- a/src/workspaces/officerdev/src/apps/ChatHistory/index.ts +++ b/src/workspaces/officerdev/src/apps/ChatHistory/index.ts @@ -20,7 +20,7 @@ export const appRegistryMetas: AppRegistryMeta[] = [ key: 'chat-detail', name: 'Chat', icon: MessageSquare, - component: ChatDetailPanel, + component: () => ChatDetailPanel({ allowHostMode: true }), availableOnPanel: false, }, ]; diff --git a/src/workspaces/officerdev/src/apps/CodeEditor/CodeEditorHeader.tsx b/src/workspaces/officerdev/src/apps/CodeEditor/CodeEditorHeader.tsx index 6c923540..7b75ccf8 100644 --- a/src/workspaces/officerdev/src/apps/CodeEditor/CodeEditorHeader.tsx +++ b/src/workspaces/officerdev/src/apps/CodeEditor/CodeEditorHeader.tsx @@ -1,5 +1,5 @@ import { Code } from 'lucide-react'; -import { useWorkspace } from '@/components/Workspace'; +import { useWorkspace } from '../../components/Workspace'; export const CodeEditorHeader = () => { const { cwd } = useWorkspace(); diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserPanelWrapper.tsx b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserPanelWrapper.tsx index 970c3909..bc95236c 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserPanelWrapper.tsx +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserPanelWrapper.tsx @@ -1,4 +1,4 @@ -import { useWorkspace } from '@/components/Workspace'; +import { useWorkspace } from '../../../components/Workspace'; import { FileBrowserApp } from './FileBrowserApp'; const cwdToPath = (cwd: string) => (cwd === '~' ? '/' : cwd.slice(1)); diff --git a/src/workspaces/officerdev/src/apps/Preview/PreviewContext.tsx b/src/workspaces/officerdev/src/apps/Preview/PreviewContext.tsx index 1b906876..2f4d30d9 100644 --- a/src/workspaces/officerdev/src/apps/Preview/PreviewContext.tsx +++ b/src/workspaces/officerdev/src/apps/Preview/PreviewContext.tsx @@ -1,5 +1,5 @@ import { createContext, useContext } from 'react'; -import type { ProjectDefinition } from '@/components/Workspace'; +import type { ProjectDefinition } from '../../components/Workspace'; export type PreviewContextValue = { slug: string | null; diff --git a/src/workspaces/officerdev/src/apps/Preview/PreviewProvider.tsx b/src/workspaces/officerdev/src/apps/Preview/PreviewProvider.tsx index 306ad8bc..32c01b5e 100644 --- a/src/workspaces/officerdev/src/apps/Preview/PreviewProvider.tsx +++ b/src/workspaces/officerdev/src/apps/Preview/PreviewProvider.tsx @@ -2,8 +2,8 @@ import { useState, useEffect, useCallback } from 'react'; import type { ReactNode } from 'react'; import { useClient } from 'hooks/useClient'; import { useAuth } from 'hooks/useAuth'; -import { useWorkspace } from '@/components/Workspace'; -import type { ProjectDefinition } from '@/components/Workspace'; +import { useWorkspace } from '../../components/Workspace'; +import type { ProjectDefinition } from '../../components/Workspace'; import { useWorkspacesState } from 'state/useWorkspacesState'; import { PreviewContext } from './PreviewContext'; diff --git a/src/workspaces/officerdev/src/apps/Projects/ProjectListApp.tsx b/src/workspaces/officerdev/src/apps/Projects/ProjectListApp.tsx index d27f9b85..fc74548a 100644 --- a/src/workspaces/officerdev/src/apps/Projects/ProjectListApp.tsx +++ b/src/workspaces/officerdev/src/apps/Projects/ProjectListApp.tsx @@ -6,7 +6,7 @@ import { useGlobal } from 'hooks/useGlobal'; import { useClient } from 'hooks/useClient'; import { generateSlug } from 'helpers/slug'; import { useWorkspacesState } from 'state/useWorkspacesState'; -import type { ProjectDefinition, ProjectType } from '@/components/Workspace'; +import type { ProjectDefinition, ProjectType } from '../../components/Workspace'; import { AlertDialog, AlertDialogAction, diff --git a/src/workspaces/officerdev/src/apps/Projects/ProjectPreview.tsx b/src/workspaces/officerdev/src/apps/Projects/ProjectPreview.tsx index 155b8de1..577ffb4c 100644 --- a/src/workspaces/officerdev/src/apps/Projects/ProjectPreview.tsx +++ b/src/workspaces/officerdev/src/apps/Projects/ProjectPreview.tsx @@ -5,8 +5,8 @@ import { useQueryClient } from '@tanstack/react-query'; import { useGlobal } from 'hooks/useGlobal'; import { useClient } from 'hooks/useClient'; import { useWorkspacesState } from 'state/useWorkspacesState'; -import { WorkspaceLayout, WorkspaceView, createDefaultLayout } from '@/components/Workspace'; -import type { LayoutNode, ProjectDefinition, ProjectType } from '@/components/Workspace'; +import { WorkspaceLayout, WorkspaceView, createDefaultLayout } from '../../components/Workspace'; +import type { LayoutNode, ProjectDefinition, ProjectType } from '../../components/Workspace'; import { Button } from '@/components/ui/button'; import { generateSlug, slugify } from 'helpers/slug'; import { useAppRegistry } from '../../AppRegistry'; diff --git a/src/workspaces/officerdev/src/apps/Terminal/CommandTerminalWrapper.tsx b/src/workspaces/officerdev/src/apps/Terminal/CommandTerminalWrapper.tsx index b931a3bb..748db675 100644 --- a/src/workspaces/officerdev/src/apps/Terminal/CommandTerminalWrapper.tsx +++ b/src/workspaces/officerdev/src/apps/Terminal/CommandTerminalWrapper.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react'; -import { useWorkspace } from '@/components/Workspace'; +import { useWorkspace } from '../../components/Workspace'; import { useWorkspacesState } from 'state/useWorkspacesState'; import { TerminalView } from './Terminal'; diff --git a/src/workspaces/officerdev/src/apps/Terminal/Headers.tsx b/src/workspaces/officerdev/src/apps/Terminal/Headers.tsx index 03f7d39d..8f5f1f71 100644 --- a/src/workspaces/officerdev/src/apps/Terminal/Headers.tsx +++ b/src/workspaces/officerdev/src/apps/Terminal/Headers.tsx @@ -1,5 +1,5 @@ import { TerminalSquare, Monitor, Columns2, PenLine } from 'lucide-react'; -import { useWorkspace } from '@/components/Workspace'; +import { useWorkspace } from '../../components/Workspace'; import { useAuth } from 'hooks/useAuth'; import { useTerminalMode } from './useTerminalMode'; diff --git a/src/workspaces/officerdev/src/apps/Terminal/HostTerminalWrapper.tsx b/src/workspaces/officerdev/src/apps/Terminal/HostTerminalWrapper.tsx index 1a55a220..f6eb6e78 100644 --- a/src/workspaces/officerdev/src/apps/Terminal/HostTerminalWrapper.tsx +++ b/src/workspaces/officerdev/src/apps/Terminal/HostTerminalWrapper.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react'; -import { useWorkspace } from '@/components/Workspace'; +import { useWorkspace } from '../../components/Workspace'; import { useAuth } from 'hooks/useAuth'; import { useWorkspacesState } from 'state/useWorkspacesState'; import { TerminalView } from './Terminal'; diff --git a/src/workspaces/officerdev/src/apps/Terminal/TerminalWrapper.tsx b/src/workspaces/officerdev/src/apps/Terminal/TerminalWrapper.tsx index 21a9746f..286033d9 100644 --- a/src/workspaces/officerdev/src/apps/Terminal/TerminalWrapper.tsx +++ b/src/workspaces/officerdev/src/apps/Terminal/TerminalWrapper.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react'; -import { useWorkspace } from '@/components/Workspace'; +import { useWorkspace } from '../../components/Workspace'; import { useWorkspacesState } from 'state/useWorkspacesState'; import { TerminalView } from './Terminal'; import { useTerminalMode } from './useTerminalMode'; diff --git a/src/workspaces/officerdev/src/apps/Workspaces/WorkspaceListApp.tsx b/src/workspaces/officerdev/src/apps/Workspaces/WorkspaceListApp.tsx index 1340b248..fd7bd2fe 100644 --- a/src/workspaces/officerdev/src/apps/Workspaces/WorkspaceListApp.tsx +++ b/src/workspaces/officerdev/src/apps/Workspaces/WorkspaceListApp.tsx @@ -7,7 +7,7 @@ import { useClient } from 'hooks/useClient'; import { generateSlug } from 'helpers/slug'; import { useUserState } from 'state/useUserState'; import { useWorkspacesState } from 'state/useWorkspacesState'; -import type { WorkspaceDefinition } from '@/components/Workspace'; +import type { WorkspaceDefinition } from '../../components/Workspace'; import { AlertDialog, AlertDialogAction, diff --git a/src/workspaces/officerdev/src/apps/Workspaces/WorkspacePreview.tsx b/src/workspaces/officerdev/src/apps/Workspaces/WorkspacePreview.tsx index a09641c2..83d0e01b 100644 --- a/src/workspaces/officerdev/src/apps/Workspaces/WorkspacePreview.tsx +++ b/src/workspaces/officerdev/src/apps/Workspaces/WorkspacePreview.tsx @@ -6,8 +6,8 @@ import { useGlobal } from 'hooks/useGlobal'; import { useClient } from 'hooks/useClient'; import { useUserState } from 'state/useUserState'; import { useWorkspacesState } from 'state/useWorkspacesState'; -import { WorkspaceLayout, WorkspaceView, createDefaultLayout } from '@/components/Workspace'; -import type { LayoutNode, WorkspaceDefinition } from '@/components/Workspace'; +import { WorkspaceLayout, WorkspaceView, createDefaultLayout } from '../../components/Workspace'; +import type { LayoutNode, WorkspaceDefinition } from '../../components/Workspace'; import { Button } from '@/components/ui/button'; import { generateSlug, slugify } from 'helpers/slug'; import { FileBrowserApp } from '../FileBrowser'; diff --git a/src/workspaces/components/Workspace/AppPicker.tsx b/src/workspaces/officerdev/src/components/Workspace/AppPicker.tsx similarity index 100% rename from src/workspaces/components/Workspace/AppPicker.tsx rename to src/workspaces/officerdev/src/components/Workspace/AppPicker.tsx diff --git a/src/workspaces/components/Workspace/DragOverlay.tsx b/src/workspaces/officerdev/src/components/Workspace/DragOverlay.tsx similarity index 100% rename from src/workspaces/components/Workspace/DragOverlay.tsx rename to src/workspaces/officerdev/src/components/Workspace/DragOverlay.tsx diff --git a/src/workspaces/components/Workspace/LayoutEditor.tsx b/src/workspaces/officerdev/src/components/Workspace/LayoutEditor.tsx similarity index 100% rename from src/workspaces/components/Workspace/LayoutEditor.tsx rename to src/workspaces/officerdev/src/components/Workspace/LayoutEditor.tsx diff --git a/src/workspaces/components/Workspace/PanelSlot.tsx b/src/workspaces/officerdev/src/components/Workspace/PanelSlot.tsx similarity index 99% rename from src/workspaces/components/Workspace/PanelSlot.tsx rename to src/workspaces/officerdev/src/components/Workspace/PanelSlot.tsx index 80738de7..1da5c356 100644 --- a/src/workspaces/components/Workspace/PanelSlot.tsx +++ b/src/workspaces/officerdev/src/components/Workspace/PanelSlot.tsx @@ -4,7 +4,7 @@ import { createPortal } from 'react-dom'; import { ArrowLeftRight, X, Minus } from 'lucide-react'; import type { LayoutPanel, AppRegistry, PanelComponents, PanelComponentEntry } from './types'; import { useWorkspace } from './WorkspaceContext'; -import { Card } from '../Card'; +import { Card } from '@/components/Card'; import { AppPicker } from './AppPicker'; import { ContextMenu, @@ -12,7 +12,7 @@ import { ContextMenuContent, ContextMenuItem, ContextMenuSeparator, -} from '../ui/context-menu'; +} from '@/components/ui/context-menu'; type PanelSlotProps = { panel: LayoutPanel; diff --git a/src/workspaces/components/Workspace/WorkspaceContext.ts b/src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts similarity index 100% rename from src/workspaces/components/Workspace/WorkspaceContext.ts rename to src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts diff --git a/src/workspaces/components/Workspace/WorkspaceHeader.tsx b/src/workspaces/officerdev/src/components/Workspace/WorkspaceHeader.tsx similarity index 100% rename from src/workspaces/components/Workspace/WorkspaceHeader.tsx rename to src/workspaces/officerdev/src/components/Workspace/WorkspaceHeader.tsx diff --git a/src/workspaces/components/Workspace/WorkspaceLayout.tsx b/src/workspaces/officerdev/src/components/Workspace/WorkspaceLayout.tsx similarity index 95% rename from src/workspaces/components/Workspace/WorkspaceLayout.tsx rename to src/workspaces/officerdev/src/components/Workspace/WorkspaceLayout.tsx index ae6c20b9..f6febd8b 100644 --- a/src/workspaces/components/Workspace/WorkspaceLayout.tsx +++ b/src/workspaces/officerdev/src/components/Workspace/WorkspaceLayout.tsx @@ -3,7 +3,7 @@ import type { LayoutNode, AppRegistry, PanelComponents } from './types'; import { updateSizes } from './layout-utils'; import { WorkspaceProvider } from './WorkspaceContext'; import { WorkspaceRenderer } from './WorkspaceRenderer'; -import { useAppRegistry } from 'officerdev'; +import { useAppRegistry } from '../../AppRegistry/useAppRegistry'; type WorkspaceLayoutProps = { layout: LayoutNode; diff --git a/src/workspaces/components/Workspace/WorkspaceRenderer.tsx b/src/workspaces/officerdev/src/components/Workspace/WorkspaceRenderer.tsx similarity index 99% rename from src/workspaces/components/Workspace/WorkspaceRenderer.tsx rename to src/workspaces/officerdev/src/components/Workspace/WorkspaceRenderer.tsx index d7d885fe..881f82bd 100644 --- a/src/workspaces/components/Workspace/WorkspaceRenderer.tsx +++ b/src/workspaces/officerdev/src/components/Workspace/WorkspaceRenderer.tsx @@ -1,5 +1,5 @@ import { useCallback, useRef } from 'react'; -import { ResizablePanel, ResizablePanelGroup, ResizableHandle } from '../ui/resizable'; +import { ResizablePanel, ResizablePanelGroup, ResizableHandle } from '@/components/ui/resizable'; import type { LayoutNode, AppRegistry, PanelComponents } from './types'; import { countPanels } from './layout-utils'; import { PanelSlot } from './PanelSlot'; diff --git a/src/workspaces/components/Workspace/WorkspaceView.tsx b/src/workspaces/officerdev/src/components/Workspace/WorkspaceView.tsx similarity index 98% rename from src/workspaces/components/Workspace/WorkspaceView.tsx rename to src/workspaces/officerdev/src/components/Workspace/WorkspaceView.tsx index 7f83e926..d73c14de 100644 --- a/src/workspaces/components/Workspace/WorkspaceView.tsx +++ b/src/workspaces/officerdev/src/components/Workspace/WorkspaceView.tsx @@ -1,12 +1,12 @@ import { useState, useCallback, useEffect } from 'react'; import { flushSync } from 'react-dom'; -import { ResizablePanel, ResizablePanelGroup, ResizableHandle } from '../ui/resizable'; +import { ResizablePanel, ResizablePanelGroup, ResizableHandle } from '@/components/ui/resizable'; import type { LayoutNode, WorkspaceState, EphemeralPanels } from './types'; import type { DropPosition } from './layout-utils'; import { splitPanel, removePanel, setApp, updateSizes, swapPanels, movePanel, countPanels } from './layout-utils'; import { WorkspaceProvider } from './WorkspaceContext'; import { WorkspaceRenderer } from './WorkspaceRenderer'; -import { useAppRegistry } from 'officerdev'; +import { useAppRegistry } from '../../AppRegistry/useAppRegistry'; type WorkspaceViewProps = { workspace: WorkspaceState; diff --git a/src/workspaces/components/Workspace/index.ts b/src/workspaces/officerdev/src/components/Workspace/index.ts similarity index 100% rename from src/workspaces/components/Workspace/index.ts rename to src/workspaces/officerdev/src/components/Workspace/index.ts diff --git a/src/workspaces/components/Workspace/layout-utils.ts b/src/workspaces/officerdev/src/components/Workspace/layout-utils.ts similarity index 100% rename from src/workspaces/components/Workspace/layout-utils.ts rename to src/workspaces/officerdev/src/components/Workspace/layout-utils.ts diff --git a/src/workspaces/components/Workspace/types.ts b/src/workspaces/officerdev/src/components/Workspace/types.ts similarity index 100% rename from src/workspaces/components/Workspace/types.ts rename to src/workspaces/officerdev/src/components/Workspace/types.ts diff --git a/src/workspaces/officerdev/src/hooks/useFileViewerPanels/layouts.ts b/src/workspaces/officerdev/src/hooks/useFileViewerPanels/layouts.ts index f81c764b..3f9b468c 100644 --- a/src/workspaces/officerdev/src/hooks/useFileViewerPanels/layouts.ts +++ b/src/workspaces/officerdev/src/hooks/useFileViewerPanels/layouts.ts @@ -1,4 +1,4 @@ -import type { LayoutNode } from '@/components/Workspace'; +import type { LayoutNode } from '../../components/Workspace'; export const singleViewerLayout: LayoutNode = { type: 'panel', diff --git a/src/workspaces/officerdev/src/hooks/useFileViewerPanels/useFileViewerPanels.tsx b/src/workspaces/officerdev/src/hooks/useFileViewerPanels/useFileViewerPanels.tsx index 37166ca9..f7f8e2e8 100644 --- a/src/workspaces/officerdev/src/hooks/useFileViewerPanels/useFileViewerPanels.tsx +++ b/src/workspaces/officerdev/src/hooks/useFileViewerPanels/useFileViewerPanels.tsx @@ -1,5 +1,5 @@ import { useSearchParams } from 'react-router'; -import type { EphemeralPanels } from '@/components/Workspace'; +import type { EphemeralPanels } from '../../components/Workspace'; import { FileViewerHeader, FileViewerBody } from '../../apps/FileViewer'; import { singleViewerLayout, viewerWithEphemeralLayout, viewerWithEphemeralSplitLayout } from './layouts'; import { ViewerProvider, EphemeralProvider, Ephemeral2Provider } from './Providers'; diff --git a/src/workspaces/officerdev/src/index.ts b/src/workspaces/officerdev/src/index.ts index 88df2b22..af2ad811 100644 --- a/src/workspaces/officerdev/src/index.ts +++ b/src/workspaces/officerdev/src/index.ts @@ -16,3 +16,8 @@ export { TerminalView } from './apps/Terminal'; export type { TerminalViewProps } from './apps/Terminal'; export { WorkspaceListApp, WorkspacePreview, SELECTED_WORKSPACE_KEY, CREATING_WORKSPACE_KEY, EDITING_WORKSPACE_KEY, NEW_WS_NAME_KEY, NEW_WS_DESC_KEY, NEW_WS_TEMPLATE_KEY } from './apps/Workspaces'; export { ProjectListApp, ProjectPreview, SELECTED_PROJECT, CREATING_PROJECT, EDITING_PROJECT, NEW_PROJ_NAME, NEW_PROJ_DESC, NEW_PROJ_TEMPLATE, NEW_PROJ_TYPE, NEW_PROJ_HAS_BACKEND, NEW_PROJ_HAS_AUTH, NEW_PROJ_PREVIEW_LAYOUT } from './apps/Projects'; + +// Workspace +export { WorkspaceView, WorkspaceLayout, WorkspaceProvider, useWorkspace } from './components/Workspace'; +export { createDefaultLayout, splitPanel, removePanel, setApp, updateSizes, swapPanels, movePanel, pruneEmptyPanels, countPanels, hasAnyApp } from './components/Workspace'; +export type { LayoutNode, LayoutGroup, LayoutPanel, WorkspaceDefinition, WorkspaceState, ProjectType, ProjectDefinition, AppRegistry, AppRegistryEntry, PanelComponents, PanelComponentEntry, EphemeralPanels, DropPosition } from './components/Workspace'; diff --git a/src/workspaces/officerdev/src/useAppRegistry.ts b/src/workspaces/officerdev/src/useAppRegistry.ts index 3a73800e..2fffbea2 100644 --- a/src/workspaces/officerdev/src/useAppRegistry.ts +++ b/src/workspaces/officerdev/src/useAppRegistry.ts @@ -1,4 +1,4 @@ -import type { AppRegistry } from '@/components/Workspace'; +import type { AppRegistry } from './components/Workspace'; export function useAppRegistry(): AppRegistry { return {}; diff --git a/src/workspaces/widgets/widget-registry.tsx b/src/workspaces/widgets/widget-registry.tsx index 8d4e5fe3..86c48d94 100644 --- a/src/workspaces/widgets/widget-registry.tsx +++ b/src/workspaces/widgets/widget-registry.tsx @@ -1,5 +1,5 @@ import { Clock as ClockIcon, CloudSun, Timer, Target, StickyNote } from 'lucide-react'; -import type { AppRegistryEntry } from '@/components/Workspace'; +import type { AppRegistryEntry } from 'officerdev'; import { Clock } from './Clock/index'; import { Weather } from './Weather/index'; import { Pomodoro } from './Pomodoro/index';