|
|
|
|
@ -45,10 +45,7 @@ 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)}`;
|
|
|
|
|
const shellDemoUrl = `https://rspace.online/${escapeAttr(moduleId)}`;
|
|
|
|
|
|
|
|
|
|
return `<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
@ -428,35 +425,54 @@ export interface ModuleLandingOptions {
|
|
|
|
|
export function renderModuleLanding(opts: ModuleLandingOptions): string {
|
|
|
|
|
const { module: mod, modules, theme = "dark" } = opts;
|
|
|
|
|
const moduleListJSON = JSON.stringify(modules);
|
|
|
|
|
// 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://demo.rspace.online/${escapeAttr(mod.id)}">Also available inside rSpace demo ↗</a>`
|
|
|
|
|
: "";
|
|
|
|
|
|
|
|
|
|
let feedsHtml = "";
|
|
|
|
|
if (mod.feeds && mod.feeds.length > 0) {
|
|
|
|
|
feedsHtml = `
|
|
|
|
|
<div class="ml-feeds">
|
|
|
|
|
<h3 class="ml-feeds-title">Capabilities</h3>
|
|
|
|
|
<div class="ml-feeds-grid">
|
|
|
|
|
${mod.feeds
|
|
|
|
|
.map(
|
|
|
|
|
(f) => `
|
|
|
|
|
<div class="ml-feed-card">
|
|
|
|
|
<div class="ml-feed-name">${escapeHtml(f.name)}</div>
|
|
|
|
|
<div class="ml-feed-desc">${escapeHtml(f.description)}</div>
|
|
|
|
|
<span class="ml-feed-kind">${escapeHtml(f.kind)}</span>
|
|
|
|
|
</div>`,
|
|
|
|
|
)
|
|
|
|
|
.join("")}
|
|
|
|
|
</div>
|
|
|
|
|
</div>`;
|
|
|
|
|
// Modules with a standalone domain: embed it in a full-page iframe
|
|
|
|
|
if (mod.standaloneDomain) {
|
|
|
|
|
const embedUrl = `https://${escapeAttr(mod.standaloneDomain)}`;
|
|
|
|
|
return `<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>${mod.icon}</text></svg>">
|
|
|
|
|
<title>${escapeHtml(mod.name)} — rSpace</title>
|
|
|
|
|
<link rel="stylesheet" href="/shell.css">
|
|
|
|
|
<style>
|
|
|
|
|
body { margin: 0; overflow: hidden; }
|
|
|
|
|
.ml-frame-wrap {
|
|
|
|
|
position: fixed; top: 48px; left: 0; right: 0; bottom: 0;
|
|
|
|
|
}
|
|
|
|
|
.ml-frame-wrap iframe {
|
|
|
|
|
width: 100%; height: 100%; border: none;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<script defer src="https://rdata.online/collect.js" data-website-id="6ee7917b-0ed7-44cb-a4c8-91037638526b"></script>
|
|
|
|
|
</head>
|
|
|
|
|
<body data-theme="${theme}">
|
|
|
|
|
<header class="rstack-header" data-theme="${theme}">
|
|
|
|
|
<div class="rstack-header__left">
|
|
|
|
|
<rstack-app-switcher current="${escapeAttr(mod.id)}"></rstack-app-switcher>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="rstack-header__center"></div>
|
|
|
|
|
<div class="rstack-header__right">
|
|
|
|
|
<a class="rstack-header__demo-btn" href="${embedUrl}" target="_blank">Open ${escapeHtml(mod.standaloneDomain)}</a>
|
|
|
|
|
<rstack-identity></rstack-identity>
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
<div class="ml-frame-wrap">
|
|
|
|
|
<iframe src="${embedUrl}" allow="clipboard-write; fullscreen"></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
<script type="module">
|
|
|
|
|
import '/shell.js';
|
|
|
|
|
document.querySelector('rstack-app-switcher')?.setModules(${moduleListJSON});
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Modules without a standalone domain: simple generated landing page
|
|
|
|
|
const demoUrl = `https://demo.rspace.online/${mod.id}`;
|
|
|
|
|
|
|
|
|
|
return `<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
@ -479,7 +495,6 @@ export function renderModuleLanding(opts: ModuleLandingOptions): string {
|
|
|
|
|
<rstack-identity></rstack-identity>
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<div class="ml-hero">
|
|
|
|
|
<div class="ml-container">
|
|
|
|
|
<span class="ml-icon">${mod.icon}</span>
|
|
|
|
|
@ -489,21 +504,14 @@ export function renderModuleLanding(opts: ModuleLandingOptions): string {
|
|
|
|
|
<a href="${demoUrl}" class="ml-cta-primary" id="ml-primary">Try Demo</a>
|
|
|
|
|
<a href="/create-space" class="ml-cta-secondary">Create a Space</a>
|
|
|
|
|
</div>
|
|
|
|
|
${standaloneLinkHtml}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
${feedsHtml}
|
|
|
|
|
|
|
|
|
|
<div class="ml-back">
|
|
|
|
|
<a href="/">← Back to rSpace</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script type="module">
|
|
|
|
|
import '/shell.js';
|
|
|
|
|
document.querySelector('rstack-app-switcher')?.setModules(${moduleListJSON});
|
|
|
|
|
|
|
|
|
|
// If logged in, update CTA to personal space
|
|
|
|
|
try {
|
|
|
|
|
var raw = localStorage.getItem('encryptid_session');
|
|
|
|
|
if (raw) {
|
|
|
|
|
@ -535,88 +543,33 @@ body {
|
|
|
|
|
display: flex; flex-direction: column; align-items: center;
|
|
|
|
|
justify-content: center; min-height: calc(80vh - 56px); width: 100%;
|
|
|
|
|
}
|
|
|
|
|
.ml-container {
|
|
|
|
|
text-align: center; max-width: 560px; padding: 40px 20px;
|
|
|
|
|
}
|
|
|
|
|
.ml-icon {
|
|
|
|
|
font-size: 4rem; display: block; margin-bottom: 1rem;
|
|
|
|
|
}
|
|
|
|
|
.ml-container { text-align: center; max-width: 560px; padding: 40px 20px; }
|
|
|
|
|
.ml-icon { font-size: 4rem; display: block; margin-bottom: 1rem; }
|
|
|
|
|
.ml-name {
|
|
|
|
|
font-size: 2.5rem; margin-bottom: 0.75rem;
|
|
|
|
|
background: linear-gradient(135deg, #14b8a6, #22d3ee);
|
|
|
|
|
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
|
|
|
|
|
}
|
|
|
|
|
.ml-desc {
|
|
|
|
|
font-size: 1.15rem; color: #94a3b8; margin-bottom: 2.5rem; line-height: 1.6;
|
|
|
|
|
}
|
|
|
|
|
.ml-ctas {
|
|
|
|
|
display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
|
|
|
|
|
}
|
|
|
|
|
.ml-desc { font-size: 1.15rem; color: #94a3b8; margin-bottom: 2.5rem; line-height: 1.6; }
|
|
|
|
|
.ml-ctas { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
|
|
|
|
|
.ml-cta-primary {
|
|
|
|
|
display: inline-block; padding: 14px 32px; border-radius: 8px;
|
|
|
|
|
background: linear-gradient(135deg, #14b8a6, #0d9488);
|
|
|
|
|
color: white; font-size: 1rem; font-weight: 600;
|
|
|
|
|
text-decoration: none; transition: transform 0.2s, box-shadow 0.2s;
|
|
|
|
|
}
|
|
|
|
|
.ml-cta-primary:hover {
|
|
|
|
|
transform: translateY(-2px); box-shadow: 0 8px 20px rgba(20,184,166,0.3);
|
|
|
|
|
}
|
|
|
|
|
.ml-cta-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(20,184,166,0.3); }
|
|
|
|
|
.ml-cta-secondary {
|
|
|
|
|
display: inline-block; padding: 14px 32px; border-radius: 8px;
|
|
|
|
|
background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.2);
|
|
|
|
|
color: #94a3b8; font-size: 1rem; font-weight: 600;
|
|
|
|
|
text-decoration: none; transition: transform 0.2s, border-color 0.2s, color 0.2s;
|
|
|
|
|
}
|
|
|
|
|
.ml-cta-secondary:hover {
|
|
|
|
|
transform: translateY(-2px); border-color: rgba(255,255,255,0.4); color: white;
|
|
|
|
|
}
|
|
|
|
|
.ml-standalone {
|
|
|
|
|
display: inline-block; margin-top: 1.5rem;
|
|
|
|
|
font-size: 0.85rem; color: #64748b; text-decoration: none;
|
|
|
|
|
transition: color 0.2s;
|
|
|
|
|
}
|
|
|
|
|
.ml-standalone:hover { color: #22d3ee; }
|
|
|
|
|
.ml-feeds {
|
|
|
|
|
width: 100%; max-width: 640px; padding: 0 20px 3rem;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
|
|
|
|
.ml-feeds-title {
|
|
|
|
|
font-size: 1rem; font-weight: 600; color: #94a3b8;
|
|
|
|
|
text-transform: uppercase; letter-spacing: 0.05em;
|
|
|
|
|
margin-bottom: 1rem; text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.ml-feeds-grid {
|
|
|
|
|
display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
|
|
|
|
gap: 0.75rem;
|
|
|
|
|
}
|
|
|
|
|
.ml-feed-card {
|
|
|
|
|
background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
|
|
|
|
|
border-radius: 10px; padding: 1rem;
|
|
|
|
|
}
|
|
|
|
|
.ml-feed-name {
|
|
|
|
|
font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; color: #e2e8f0;
|
|
|
|
|
}
|
|
|
|
|
.ml-feed-desc {
|
|
|
|
|
font-size: 0.8rem; color: #94a3b8; line-height: 1.5; margin-bottom: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
.ml-feed-kind {
|
|
|
|
|
display: inline-block; font-size: 0.65rem; font-weight: 600;
|
|
|
|
|
text-transform: uppercase; letter-spacing: 0.05em;
|
|
|
|
|
padding: 2px 8px; border-radius: 4px;
|
|
|
|
|
background: rgba(20,184,166,0.15); color: #14b8a6;
|
|
|
|
|
}
|
|
|
|
|
.ml-back {
|
|
|
|
|
padding: 2rem 0 3rem; text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.ml-back a {
|
|
|
|
|
font-size: 0.85rem; color: #64748b; text-decoration: none; transition: color 0.2s;
|
|
|
|
|
}
|
|
|
|
|
.ml-cta-secondary:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.4); color: white; }
|
|
|
|
|
.ml-back { padding: 2rem 0 3rem; text-align: center; }
|
|
|
|
|
.ml-back a { font-size: 0.85rem; color: #64748b; text-decoration: none; transition: color 0.2s; }
|
|
|
|
|
.ml-back a:hover { color: #e2e8f0; }
|
|
|
|
|
@media (max-width: 600px) {
|
|
|
|
|
.ml-name { font-size: 2rem; }
|
|
|
|
|
.ml-icon { font-size: 3rem; }
|
|
|
|
|
.ml-feeds-grid { grid-template-columns: 1fr; }
|
|
|
|
|
}
|
|
|
|
|
@media (max-width: 600px) { .ml-name { font-size: 2rem; } .ml-icon { font-size: 3rem; } }
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
function escapeHtml(s: string): string {
|
|
|
|
|
|