/** * Design module — collaborative design workspace via Affine. * * Wraps the Affine instance as an external app embedded in the rSpace shell. */ import { Hono } from "hono"; import { renderShell, renderExternalAppShell } from "../../server/shell"; import { getModuleInfoList } from "../../shared/module"; import type { RSpaceModule } from "../../shared/module"; const routes = new Hono(); const AFFINE_URL = "https://affine.cosmolocal.world"; routes.get("/api/health", (c) => { return c.json({ ok: true, module: "rdesign" }); }); routes.get("/", (c) => { const space = c.req.param("space") || "demo"; const view = c.req.query("view"); if (view === "demo") { return c.html(renderShell({ title: `${space} — Design | rSpace`, moduleId: "rdesign", spaceSlug: space, modules: getModuleInfoList(), theme: "dark", body: `
🎯

rDesign

Collaborative design workspace powered by Affine. Whiteboard, docs, and kanban — all in one tool for your community.

Open Affine
`, })); } // Default: show the external app directly return c.html(renderExternalAppShell({ title: `${space} — Affine | rSpace`, moduleId: "rdesign", spaceSlug: space, modules: getModuleInfoList(), appUrl: AFFINE_URL, appName: "Affine", theme: "dark", })); }); export const designModule: RSpaceModule = { id: "rdesign", name: "rDesign", icon: "🎯", description: "Collaborative design workspace with whiteboard and docs", routes, standaloneDomain: "rdesign.online", externalApp: { url: AFFINE_URL, name: "Affine" }, };