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:
parent
c0ba24fcb9
commit
fe6e46ca2c
|
|
@ -45,6 +45,10 @@ export function renderShell(opts: ShellOptions): string {
|
||||||
} = opts;
|
} = opts;
|
||||||
|
|
||||||
const moduleListJSON = JSON.stringify(modules);
|
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>
|
return `<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
@ -78,7 +82,7 @@ export function renderShell(opts: ShellOptions): string {
|
||||||
<rstack-mi></rstack-mi>
|
<rstack-mi></rstack-mi>
|
||||||
</div>
|
</div>
|
||||||
<div class="rstack-header__right">
|
<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>
|
<rstack-identity></rstack-identity>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
@ -424,10 +428,13 @@ export interface ModuleLandingOptions {
|
||||||
export function renderModuleLanding(opts: ModuleLandingOptions): string {
|
export function renderModuleLanding(opts: ModuleLandingOptions): string {
|
||||||
const { module: mod, modules, theme = "dark" } = opts;
|
const { module: mod, modules, theme = "dark" } = opts;
|
||||||
const moduleListJSON = JSON.stringify(modules);
|
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
|
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 = "";
|
let feedsHtml = "";
|
||||||
|
|
|
||||||
|
|
@ -188,10 +188,19 @@ export class RStackAppSwitcher extends HTMLElement {
|
||||||
? `<span class="item-badge" style="background:${badgeInfo.color}">${badgeInfo.badge}</span>`
|
? `<span class="item-badge" style="background:${badgeInfo.color}">${badgeInfo.badge}</span>`
|
||||||
: `<span class="item-icon">${m.icon}</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 `
|
return `
|
||||||
<div class="item-row ${m.id === current ? "active" : ""}">
|
<div class="item-row ${m.id === current ? "active" : ""}">
|
||||||
<a class="item"
|
<a class="item"
|
||||||
href="${rspaceNavUrl(this.#getSpaceSlug(), m.id)}"
|
href="${href}"
|
||||||
data-id="${m.id}">
|
data-id="${m.id}">
|
||||||
${badgeHtml}
|
${badgeHtml}
|
||||||
<div class="item-text">
|
<div class="item-text">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue