rspace-online/modules/rchats/mod.ts

82 lines
3.4 KiB
TypeScript

/**
* rChats module — encrypted community messaging.
*
* Stub module: landing page + "Coming Soon" dashboard.
* Real chat functionality (Automerge CRDT, channels, threads) will come later.
*/
import { Hono } from "hono";
import { renderShell } from "../../server/shell";
import { getModuleInfoList } from "../../shared/module";
import type { RSpaceModule } from "../../shared/module";
import { renderLanding } from "./landing";
const routes = new Hono();
// ── Hub page (Coming Soon dashboard) ──
routes.get("/", (c) => {
const space = c.req.param("space") || "demo";
return c.html(renderShell({
title: `rChats — ${space} | rSpace`,
moduleId: "rchats",
spaceSlug: space,
modules: getModuleInfoList(),
styles: `<style>
.rs-hub{max-width:720px;margin:2rem auto;padding:0 1.5rem}
.rs-hub h1{font-size:1.8rem;margin-bottom:.5rem;color:var(--rs-text-primary)}
.rs-hub p{color:var(--rs-text-secondary);margin-bottom:2rem}
.rs-coming{display:flex;flex-direction:column;align-items:center;gap:1.5rem;padding:3rem 1.5rem;border-radius:16px;background:var(--rs-bg-surface);border:1px solid var(--rs-border);text-align:center}
.rs-coming .coming-icon{font-size:3rem}
.rs-coming h2{font-size:1.4rem;color:var(--rs-text-primary);margin:0}
.rs-coming p{color:var(--rs-text-secondary);max-width:480px;margin:0}
.rs-coming .coming-badge{display:inline-block;padding:4px 12px;border-radius:8px;background:rgba(99,102,241,0.15);color:var(--rs-accent,#6366f1);font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em}
.rs-features{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem;margin-top:2rem}
.rs-feature{padding:1.25rem;border-radius:12px;background:var(--rs-bg-surface);border:1px solid var(--rs-border)}
.rs-feature h3{font-size:1rem;margin:0 0 .5rem;color:var(--rs-text-primary)}
.rs-feature p{font-size:.85rem;color:var(--rs-text-secondary);margin:0}
@media(max-width:600px){.rs-hub{margin:1rem auto;padding:0 .75rem}}
</style>`,
body: `<div class="rs-hub">
<h1>rChats</h1>
<p>Encrypted community messaging — channels, threads, and bridges</p>
<div class="rs-coming">
<span class="coming-icon">🗨️</span>
<span class="coming-badge">Coming Soon</span>
<h2>Encrypted Community Chat</h2>
<p>Real-time messaging with channels and threads, end-to-end encrypted via EncryptID. Local-first with Automerge CRDTs — works offline, syncs seamlessly.</p>
</div>
<div class="rs-features">
<div class="rs-feature">
<h3>🔐 E2E Encrypted</h3>
<p>Messages encrypted with EncryptID passkeys. The server never sees plaintext.</p>
</div>
<div class="rs-feature">
<h3>💬 Channels &amp; Threads</h3>
<p>Organize conversations by topic. Threaded replies keep the main feed clean.</p>
</div>
<div class="rs-feature">
<h3>🔗 Chat Bridges</h3>
<p>Connect Slack, Discord, Matrix, Telegram, and Mattermost into one unified view.</p>
</div>
<div class="rs-feature">
<h3>📡 Local-First</h3>
<p>Built on Automerge CRDTs. Send messages offline and sync when reconnected.</p>
</div>
</div>
</div>`,
}));
});
// ── Module export ──
export const chatsModule: RSpaceModule = {
id: "rchats",
name: "rChats",
icon: "🗨️",
description: "Encrypted community messaging",
scoping: { defaultScope: "space", userConfigurable: false },
routes,
landingPage: renderLanding,
};