Merge branch 'dev'
This commit is contained in:
commit
3233f5057c
|
|
@ -506,17 +506,10 @@ routes.post("/api/proposals/:id/final-vote", async (c) => {
|
||||||
return c.json({ ok: true, tally });
|
return c.json({ ok: true, tally });
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Page routes ──
|
// ── Demo page body (reused by / when space=demo, and /demo fallback) ──
|
||||||
|
|
||||||
// Demo page — interactive polls with live sync
|
function renderDemoBody(): string {
|
||||||
routes.get("/demo", (c) => {
|
return `
|
||||||
return c.html(renderShell({
|
|
||||||
title: "rVote Demo — Interactive Polls | rSpace",
|
|
||||||
moduleId: "rvote",
|
|
||||||
spaceSlug: "demo",
|
|
||||||
modules: getModuleInfoList(),
|
|
||||||
theme: "dark",
|
|
||||||
body: `
|
|
||||||
<div class="rd-page">
|
<div class="rd-page">
|
||||||
<div class="rd-hero">
|
<div class="rd-hero">
|
||||||
<span class="rl-badge" style="background:#1e293b;color:#94a3b8;font-size:0.7rem;padding:0.25rem 0.75rem;display:inline-block;margin-bottom:0.75rem;border-radius:9999px">Interactive Demo</span>
|
<span class="rl-badge" style="background:#1e293b;color:#94a3b8;font-size:0.7rem;padding:0.25rem 0.75rem;display:inline-block;margin-bottom:0.75rem;border-radius:9999px">Interactive Demo</span>
|
||||||
|
|
@ -635,15 +628,33 @@ routes.get("/demo", (c) => {
|
||||||
<div class="rd-footer">
|
<div class="rd-footer">
|
||||||
<a href="/rvote">← Back to rVote</a>
|
<a href="/rvote">← Back to rVote</a>
|
||||||
</div>
|
</div>
|
||||||
</div>`,
|
</div>`;
|
||||||
scripts: `<script type="module" src="/modules/rvote/vote-demo.js"></script>`,
|
}
|
||||||
styles: `<link rel="stylesheet" href="/modules/rvote/vote.css">`,
|
|
||||||
}));
|
// ── Page routes ──
|
||||||
|
|
||||||
|
// Legacy /demo path — redirect to demo.rspace.online/rvote
|
||||||
|
routes.get("/demo", (c) => {
|
||||||
|
return c.redirect("https://demo.rspace.online/rvote", 301);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dashboard — full voting app with spaces, proposals, conviction voting
|
// Main route — serves demo page when space=demo, dashboard otherwise
|
||||||
routes.get("/", (c) => {
|
routes.get("/", (c) => {
|
||||||
const space = c.req.param("space") || "demo";
|
const space = c.req.param("space") || "demo";
|
||||||
|
|
||||||
|
if (space === "demo") {
|
||||||
|
return c.html(renderShell({
|
||||||
|
title: "rVote Demo — Interactive Polls | rSpace",
|
||||||
|
moduleId: "rvote",
|
||||||
|
spaceSlug: "demo",
|
||||||
|
modules: getModuleInfoList(),
|
||||||
|
theme: "dark",
|
||||||
|
body: renderDemoBody(),
|
||||||
|
scripts: `<script type="module" src="/modules/rvote/vote-demo.js"></script>`,
|
||||||
|
styles: `<link rel="stylesheet" href="/modules/rvote/vote.css">`,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
return c.html(renderShell({
|
return c.html(renderShell({
|
||||||
title: `${space} — Vote | rSpace`,
|
title: `${space} — Vote | rSpace`,
|
||||||
moduleId: "rvote",
|
moduleId: "rvote",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue