openclaw/apps/web/app/page.tsx

124 lines
8.2 KiB
TypeScript
Raw Normal View History

"use client";
Dench workspace: virtual folders (Skills, Memories, Chats), landing page, and unified workspace layout Add virtual folder system that surfaces Skills, Memories, and Chat sessions in the workspace sidebar alongside real dench files. Rearchitect the home page into a landing hub and move the ChatPanel into the workspace as the default view. New API route — virtual-file: - apps/web/app/api/workspace/virtual-file/route.ts: new GET/POST API that resolves virtual paths (~skills/*, ~memories/*) to absolute filesystem paths in ~/.openclaw/skills/ d ~/.openclaw/workspace/. Includes path traversal protection and directory allowlisting. Tree API — virtual folder builders: - apps/web/app/api/workspace/tree/route.ts: add `virtual` field to TreeNode type. Add ildSkillsVirtualFolder() scanning ~/.openclaw/skills/ and ~/.openclaw/workspace/skills/ with SKILL.md frontmatter parsing (name + emoji). Add buildMemoriesVirtualFolder() scanning MEMORY.md and daily logs from ~/.openclaw/workspace/memory/. Virtual folders are appended after real workspace entries and are also returned when no dench root exists. File manager tree — virtual node awareness: - apps/web/app/components/workspace/file-manager-tree.tsx: add isVirtualNode() helper and RESERVED_FOLDER_NAMES set (Chats, Skills, Memories). Virtual nodes show a lock badge, disable drag-and-drop, block rename/delete, and reject reserved names during create/rename. Add ChatBubbleIcon for ~chats/ paths. Markdown editor — virtual path routing: - apps/web/app/components/workspace/markdown-editor.tsx: save to /api/workspace/virtual-file for paths starting with ~ instead of the regular /api/workspace/file endpoint. Home page redesign: - apps/web/app/page.tsx: replace the chat-first layout (SidebarhatPanel) with a branded landing page showing the OpenClaw Dench heading, tagline, and a single "Open Workspace" CTA linking to /workspace. Workspace page — unified layout with integrated chat: - apps/web/app/workspace/page.tsx: ChatPanel is now the default main view when no file is selected. Add session fetching from /api/web-sessions and build an enhanced tree with a virtual "Chats" folder listing all sessions. Clicking ~chats/<id> loads the session; clicking ~chats starts a new one. Add isVirtualPath()/fileApiUrl() helpers for virtual file reads. Add a "Back to chat" button in the top bar alongside the chat sidebar toggle. Sidebar + empty-state cosmetic updates: - apps/web/app/components/workspace/workspace-sidebar.tsx: rename BackIcon to HomeIcon (house SVG), change label from "Back to Chat" to "Home". - apps/web/app/components/workspace/empty-state.tsx: update link text from "Back to Chat" to "Back to Home".
2026-02-11 22:09:59 -08:00
import Link from "next/link";
2026-02-13 14:39:06 -08:00
// Three dramatic slash marks — like a panther raking its claws
const CLAW_ASCII = [
" ░░░░",
" ░░░░░░",
" ░░░░ ░░░░░░░",
" ░░░░░░ ░░░░ ░░░▓▓░░░",
" ░░░░ ░░░░░░░ ░░░░░░ ░░▓▓▓▓░░░",
" ░░░░░░ ░░░▓▓░░░ ░░░░ ░░░░░░░ ░░▓▓▓▓▓░░ ",
" ░░░░░░░ ░░▓▓▓▓░░░ ░░░░░░ ░░░▓▓░░░ ░░▓▓▓▓▓░░ ",
" ░░░▓▓░░░ ░░▓▓▓▓▓░░ ░░░░░░░ ░░▓▓▓▓░░░ ░▓▓▓▓▓▓░░ ",
" ░░▓▓▓▓░░░ ░░▓▓▓▓▓░░ ░░░▓▓░░░ ░░▓▓▓▓▓░░ ░▓▓▓▓▓▓░░ ",
" ░░▓▓▓▓▓░░ ░▓▓▓▓▓▓░░ ░░▓▓▓▓░░░ ░░▓▓▓▓▓░░ ▓▓▓▓▓▓░░ ",
" ░░▓▓▓▓▓░░ ░▓▓▓▓▓▓░░ ░░▓▓▓▓▓░░ ░▓▓▓▓▓▓░░ ▓▓▓▓▓▓░░ ",
" ░░▓▓▓▓▓░░ ▓▓▓▓▓▓░░ ░░▓▓▓▓▓░░ ░▓▓▓▓▓░░ ▓▓▓▓▓░░░ ",
" ░▓▓▓▓▓▓░░ ▓▓▓▓▓▓░░ ░░▓▓▓▓▓░░ ▓▓▓▓▓▓░░ ▓▓▓▓▓░░ ",
" ░▓▓▓▓▓▓░░ ▓▓▓▓▓░░░ ░▓▓▓▓▓▓░░ ▓▓▓▓▓▓░░ ▓▓▓▓▓░░ ",
" ░▓▓▓▓▓▓░░ ▓▓▓▓▓░░ ░▓▓▓▓▓▓░░ ▓▓▓▓▓░░░ ▓▓▓▓▓░░ ",
" ░▓▓▓▓▓░░░ ▓▓▓▓▓░░ ░▓▓▓▓▓▓░░ ▓▓▓▓▓░░ ▓▓▓▓▓░░ ",
" ░▓▓▓▓▓░░ ▓▓▓▓░░░ ░▓▓▓▓▓░░░ ▓▓▓▓▓░░ ▓▓▓▓░░░ ",
" ░▓▓▓▓▓░░ ▓▓▓▓░░ ░░▓▓▓▓▓░░ ▓▓▓▓░░░ ▓▓▓▓░░ ",
" ░▓▓▓▓░░░ ▓▓▓▓░░ ░░▓▓▓▓▓░░ ▓▓▓▓░░ ▓▓▓▓░░ ",
" ░▓▓▓▓░░ ▓▓▓░░░ ░▓▓▓▓▓░░░ ▓▓▓▓░░ ▓▓▓░░░ ",
" ░▓▓▓▓░░ ▓▓▓░░ ░░▓▓▓▓░░ ▓▓▓░░░ ▓▓▓░░ ",
" ░▓▓▓░░░ ▓▓░░░ ░▓▓▓▓░░░ ▓▓▓░░ ▓▓▓░░ ",
" ░▓▓▓░░ ▓▓░░ ░░▓▓▓░░ ▓▓░░░ ▓▓░░░ ",
" ░▓▓░░░ ░▓░░ ░░▓▓▓░░ ▓▓░░ ▓▓░░ ",
" ░▓▓░░ ░▓░░ ░▓▓▓░░░ ░▓░░░ ░▓░░ ",
" ░▓░░░ ░░░ ░▓▓░░ ░▓░░ ░▓░░ ",
" ░▓░░ ░░ ░░▓░░░ ░░░░ ░░░░ ",
" ░░░░ ░ ░░▓░░ ░░░ ░░░ ",
" ░░░ ░░░░░ ░░ ░░ ",
" ░░ ░░░ ░ ",
" ░ ░░ ",
];
const IRONCLAW_ASCII = [
" ██╗██████╗ ██████╗ ███╗ ██╗ ██████╗██╗ █████╗ ██╗ ██╗",
" ██║██╔══██╗██╔═══██╗████╗ ██║██╔════╝██║ ██╔══██╗██║ ██║",
" ██║██████╔╝██║ ██║██╔██╗ ██║██║ ██║ ███████║██║ █╗ ██║",
" ██║██╔══██╗██║ ██║██║╚██╗██║██║ ██║ ██╔══██║██║███╗██║",
" ██║██║ ██║╚██████╔╝██║ ╚████║╚██████╗███████╗██║ ██║╚███╔███╔╝",
" ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝ ",
];
export default function Home() {
Dench workspace: virtual folders (Skills, Memories, Chats), landing page, and unified workspace layout Add virtual folder system that surfaces Skills, Memories, and Chat sessions in the workspace sidebar alongside real dench files. Rearchitect the home page into a landing hub and move the ChatPanel into the workspace as the default view. New API route — virtual-file: - apps/web/app/api/workspace/virtual-file/route.ts: new GET/POST API that resolves virtual paths (~skills/*, ~memories/*) to absolute filesystem paths in ~/.openclaw/skills/ d ~/.openclaw/workspace/. Includes path traversal protection and directory allowlisting. Tree API — virtual folder builders: - apps/web/app/api/workspace/tree/route.ts: add `virtual` field to TreeNode type. Add ildSkillsVirtualFolder() scanning ~/.openclaw/skills/ and ~/.openclaw/workspace/skills/ with SKILL.md frontmatter parsing (name + emoji). Add buildMemoriesVirtualFolder() scanning MEMORY.md and daily logs from ~/.openclaw/workspace/memory/. Virtual folders are appended after real workspace entries and are also returned when no dench root exists. File manager tree — virtual node awareness: - apps/web/app/components/workspace/file-manager-tree.tsx: add isVirtualNode() helper and RESERVED_FOLDER_NAMES set (Chats, Skills, Memories). Virtual nodes show a lock badge, disable drag-and-drop, block rename/delete, and reject reserved names during create/rename. Add ChatBubbleIcon for ~chats/ paths. Markdown editor — virtual path routing: - apps/web/app/components/workspace/markdown-editor.tsx: save to /api/workspace/virtual-file for paths starting with ~ instead of the regular /api/workspace/file endpoint. Home page redesign: - apps/web/app/page.tsx: replace the chat-first layout (SidebarhatPanel) with a branded landing page showing the OpenClaw Dench heading, tagline, and a single "Open Workspace" CTA linking to /workspace. Workspace page — unified layout with integrated chat: - apps/web/app/workspace/page.tsx: ChatPanel is now the default main view when no file is selected. Add session fetching from /api/web-sessions and build an enhanced tree with a virtual "Chats" folder listing all sessions. Clicking ~chats/<id> loads the session; clicking ~chats starts a new one. Add isVirtualPath()/fileApiUrl() helpers for virtual file reads. Add a "Back to chat" button in the top bar alongside the chat sidebar toggle. Sidebar + empty-state cosmetic updates: - apps/web/app/components/workspace/workspace-sidebar.tsx: rename BackIcon to HomeIcon (house SVG), change label from "Back to Chat" to "Home". - apps/web/app/components/workspace/empty-state.tsx: update link text from "Back to Chat" to "Back to Home".
2026-02-11 22:09:59 -08:00
return (
2026-02-13 14:39:06 -08:00
<>
<style>{`
@keyframes iron-shimmer {
0% {
background-position: -200% center;
}
100% {
background-position: 200% center;
}
}
2026-02-13 14:39:06 -08:00
.ascii-banner {
font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono",
"Courier New", monospace;
white-space: pre;
line-height: 1.15;
font-size: clamp(0.5rem, 1.8vw, 1.4rem);
background: linear-gradient(
90deg,
#374151 0%,
#4b5563 10%,
#6b7280 20%,
#9ca3af 30%,
#d1d5db 40%,
#f3f4f6 50%,
#d1d5db 60%,
#9ca3af 70%,
#6b7280 80%,
#4b5563 90%,
#374151 100%
);
background-size: 200% 100%;
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: iron-shimmer 2.5s ease-in-out infinite;
}
`}</style>
<div className="relative flex flex-col items-center justify-center min-h-screen bg-stone-50 overflow-hidden px-4">
{/* Claw slash marks as full background — hidden on small screens */}
2026-02-13 14:39:06 -08:00
<div
className="absolute inset-0 hidden md:flex items-center justify-center select-none pointer-events-none text-stone-200/40"
2026-02-13 14:39:06 -08:00
style={{
fontFamily: '"SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", "Courier New", monospace',
whiteSpace: "pre",
lineHeight: 1.0,
fontSize: "clamp(0.75rem, 1.6vw, 1.5rem)",
}}
Dench workspace: virtual folders (Skills, Memories, Chats), landing page, and unified workspace layout Add virtual folder system that surfaces Skills, Memories, and Chat sessions in the workspace sidebar alongside real dench files. Rearchitect the home page into a landing hub and move the ChatPanel into the workspace as the default view. New API route — virtual-file: - apps/web/app/api/workspace/virtual-file/route.ts: new GET/POST API that resolves virtual paths (~skills/*, ~memories/*) to absolute filesystem paths in ~/.openclaw/skills/ d ~/.openclaw/workspace/. Includes path traversal protection and directory allowlisting. Tree API — virtual folder builders: - apps/web/app/api/workspace/tree/route.ts: add `virtual` field to TreeNode type. Add ildSkillsVirtualFolder() scanning ~/.openclaw/skills/ and ~/.openclaw/workspace/skills/ with SKILL.md frontmatter parsing (name + emoji). Add buildMemoriesVirtualFolder() scanning MEMORY.md and daily logs from ~/.openclaw/workspace/memory/. Virtual folders are appended after real workspace entries and are also returned when no dench root exists. File manager tree — virtual node awareness: - apps/web/app/components/workspace/file-manager-tree.tsx: add isVirtualNode() helper and RESERVED_FOLDER_NAMES set (Chats, Skills, Memories). Virtual nodes show a lock badge, disable drag-and-drop, block rename/delete, and reject reserved names during create/rename. Add ChatBubbleIcon for ~chats/ paths. Markdown editor — virtual path routing: - apps/web/app/components/workspace/markdown-editor.tsx: save to /api/workspace/virtual-file for paths starting with ~ instead of the regular /api/workspace/file endpoint. Home page redesign: - apps/web/app/page.tsx: replace the chat-first layout (SidebarhatPanel) with a branded landing page showing the OpenClaw Dench heading, tagline, and a single "Open Workspace" CTA linking to /workspace. Workspace page — unified layout with integrated chat: - apps/web/app/workspace/page.tsx: ChatPanel is now the default main view when no file is selected. Add session fetching from /api/web-sessions and build an enhanced tree with a virtual "Chats" folder listing all sessions. Clicking ~chats/<id> loads the session; clicking ~chats starts a new one. Add isVirtualPath()/fileApiUrl() helpers for virtual file reads. Add a "Back to chat" button in the top bar alongside the chat sidebar toggle. Sidebar + empty-state cosmetic updates: - apps/web/app/components/workspace/workspace-sidebar.tsx: rename BackIcon to HomeIcon (house SVG), change label from "Back to Chat" to "Home". - apps/web/app/components/workspace/empty-state.tsx: update link text from "Back to Chat" to "Back to Home".
2026-02-11 22:09:59 -08:00
>
2026-02-13 14:39:06 -08:00
{CLAW_ASCII.join("\n")}
</div>
2026-02-13 14:39:06 -08:00
{/* Foreground content */}
<div className="relative z-10 flex flex-col items-center">
<div className="ascii-banner select-none hidden sm:block" aria-label="IRONCLAW">
2026-02-13 14:39:06 -08:00
{IRONCLAW_ASCII.join("\n")}
</div>
<h1 className="sm:hidden text-3xl font-bold text-stone-600" style={{ fontFamily: "monospace" }}>
IRONCLAW
</h1>
2026-02-13 14:39:06 -08:00
<Link
href="/workspace"
className="mt-10 text-lg text-stone-400 hover:text-stone-600 transition-all min-h-[44px] flex items-center"
2026-02-13 14:39:06 -08:00
style={{ fontFamily: "monospace" }}
>
enter the app &rarr;
</Link>
</div>
</div>
</>
);
}