feat: app switcher links to landing pages, demo uses standalone rApp builds

App switcher on demo/bare domain now links to rspace.online/{moduleId}
landing pages instead of jumping straight to demo. "Try Demo" buttons
use standalone domain builds (rnotes.online, rvote.online, etc.) which
have better styling and more updated features. Falls back to
demo.rspace.online for modules without a standalone domain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-02-25 23:09:10 -08:00
parent 7698e32774
commit 2cfe2c744d
2 changed files with 20 additions and 4 deletions

View File

@ -45,6 +45,10 @@ export function renderShell(opts: ShellOptions): string {
} = opts;
const moduleListJSON = JSON.stringify(modules);
const currentMod = modules.find((m) => m.id === moduleId);
const shellDemoUrl = currentMod?.standaloneDomain
? `https://${escapeAttr(currentMod.standaloneDomain)}`
: `https://demo.rspace.online/${escapeAttr(moduleId)}`;
return `<!DOCTYPE html>
<html lang="en">
@ -78,7 +82,7 @@ export function renderShell(opts: ShellOptions): string {
<rstack-mi></rstack-mi>
</div>
<div class="rstack-header__right">
<a class="rstack-header__demo-btn" ${spaceSlug === "demo" ? 'data-hide' : ''} href="https://demo.rspace.online/${escapeAttr(moduleId)}">Try Demo</a>
<a class="rstack-header__demo-btn" ${spaceSlug === "demo" ? 'data-hide' : ''} href="${shellDemoUrl}">Try Demo</a>
<rstack-identity></rstack-identity>
</div>
</header>
@ -424,10 +428,13 @@ export interface ModuleLandingOptions {
export function renderModuleLanding(opts: ModuleLandingOptions): string {
const { module: mod, modules, theme = "dark" } = opts;
const moduleListJSON = JSON.stringify(modules);
const demoUrl = `https://demo.rspace.online/${mod.id}`;
// Prefer standalone domain for demo (better styling, more updated features)
const demoUrl = mod.standaloneDomain
? `https://${mod.standaloneDomain}`
: `https://demo.rspace.online/${mod.id}`;
const standaloneLinkHtml = mod.standaloneDomain
? `<a class="ml-standalone" href="https://${escapeAttr(mod.standaloneDomain)}" target="_blank" rel="noopener">Also available at ${escapeHtml(mod.standaloneDomain)} ↗</a>`
? `<a class="ml-standalone" href="https://demo.rspace.online/${escapeAttr(mod.id)}">Also available inside rSpace demo ↗</a>`
: "";
let feedsHtml = "";

View File

@ -188,10 +188,19 @@ export class RStackAppSwitcher extends HTMLElement {
? `<span class="item-badge" style="background:${badgeInfo.color}">${badgeInfo.badge}</span>`
: `<span class="item-icon">${m.icon}</span>`;
const space = this.#getSpaceSlug();
// On demo (bare domain or demo subdomain): link to landing pages
const host = window.location.host.split(":")[0];
const onRspace = host.includes("rspace.online");
const href =
onRspace && space === "demo"
? `${window.location.protocol}//rspace.online/${m.id}`
: rspaceNavUrl(space, m.id);
return `
<div class="item-row ${m.id === current ? "active" : ""}">
<a class="item"
href="${rspaceNavUrl(this.#getSpaceSlug(), m.id)}"
href="${href}"
data-id="${m.id}">
${badgeHtml}
<div class="item-text">