refactor: replace ?view= query params with path-based routes in rSocials
/rsocials → canvas view (default) /rsocials/scheduler → Postiz iframe /rsocials/feed → demo feed / landing /rsocials/landing → landing page Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bc9f5bcfb4
commit
99749d8cf2
|
|
@ -512,54 +512,56 @@ function renderDemoFeedHTML(): string {
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Main page route ──
|
// ── Path-based sub-routes ──
|
||||||
|
|
||||||
|
routes.get("/scheduler", (c) => {
|
||||||
|
const space = c.req.param("space") || "demo";
|
||||||
|
return c.html(renderExternalAppShell({
|
||||||
|
title: `${space} — Postiz | rSpace`,
|
||||||
|
moduleId: "rsocials",
|
||||||
|
spaceSlug: space,
|
||||||
|
modules: getModuleInfoList(),
|
||||||
|
appUrl: "https://social.jeffemmett.com",
|
||||||
|
appName: "Postiz",
|
||||||
|
theme: "dark",
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
routes.get("/feed", (c) => {
|
||||||
|
const space = c.req.param("space") || "demo";
|
||||||
|
const isDemo = space === "demo";
|
||||||
|
const body = isDemo ? renderDemoFeedHTML() : renderLanding();
|
||||||
|
const styles = isDemo
|
||||||
|
? `<link rel="stylesheet" href="/modules/rsocials/socials.css">`
|
||||||
|
: `<style>${RICH_LANDING_CSS}</style>`;
|
||||||
|
return c.html(renderShell({
|
||||||
|
title: `${space} — Socials Feed | rSpace`,
|
||||||
|
moduleId: "rsocials",
|
||||||
|
spaceSlug: space,
|
||||||
|
modules: getModuleInfoList(),
|
||||||
|
theme: "dark",
|
||||||
|
body,
|
||||||
|
styles,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
routes.get("/landing", (c) => {
|
||||||
|
const space = c.req.param("space") || "demo";
|
||||||
|
return c.html(renderShell({
|
||||||
|
title: `${space} — rSocials | rSpace`,
|
||||||
|
moduleId: "rsocials",
|
||||||
|
spaceSlug: space,
|
||||||
|
modules: getModuleInfoList(),
|
||||||
|
theme: "dark",
|
||||||
|
body: renderLanding(),
|
||||||
|
styles: `<style>${RICH_LANDING_CSS}</style>`,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
// ── Default: canvas view ──
|
||||||
|
|
||||||
routes.get("/", (c) => {
|
routes.get("/", (c) => {
|
||||||
const space = c.req.param("space") || "demo";
|
const space = c.req.param("space") || "demo";
|
||||||
const view = c.req.query("view");
|
|
||||||
|
|
||||||
if (view === "app") {
|
|
||||||
return c.html(renderExternalAppShell({
|
|
||||||
title: `${space} — Postiz | rSpace`,
|
|
||||||
moduleId: "rsocials",
|
|
||||||
spaceSlug: space,
|
|
||||||
modules: getModuleInfoList(),
|
|
||||||
appUrl: "https://social.jeffemmett.com",
|
|
||||||
appName: "Postiz",
|
|
||||||
theme: "dark",
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (view === "feed") {
|
|
||||||
const isDemo = space === "demo";
|
|
||||||
const body = isDemo ? renderDemoFeedHTML() : renderLanding();
|
|
||||||
const styles = isDemo
|
|
||||||
? `<link rel="stylesheet" href="/modules/rsocials/socials.css">`
|
|
||||||
: `<style>${RICH_LANDING_CSS}</style>`;
|
|
||||||
return c.html(renderShell({
|
|
||||||
title: `${space} — Socials Feed | rSpace`,
|
|
||||||
moduleId: "rsocials",
|
|
||||||
spaceSlug: space,
|
|
||||||
modules: getModuleInfoList(),
|
|
||||||
theme: "dark",
|
|
||||||
body,
|
|
||||||
styles,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (view === "landing") {
|
|
||||||
return c.html(renderShell({
|
|
||||||
title: `${space} — rSocials | rSpace`,
|
|
||||||
moduleId: "rsocials",
|
|
||||||
spaceSlug: space,
|
|
||||||
modules: getModuleInfoList(),
|
|
||||||
theme: "dark",
|
|
||||||
body: renderLanding(),
|
|
||||||
styles: `<style>${RICH_LANDING_CSS}</style>`,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default: canvas view
|
|
||||||
return c.html(renderShell({
|
return c.html(renderShell({
|
||||||
title: `${space} — rSocials | rSpace`,
|
title: `${space} — rSocials | rSpace`,
|
||||||
moduleId: "rsocials",
|
moduleId: "rsocials",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue