Status Page¶
A standalone, themed card page that the C# StatusPage.Render renders. It has a logo, a heading, a message, an optional spinner, an optional button, and an optional raw content slot. It needs none of the dashboard assets and is not part of the CSS and JS bundle.
Decision¶
| When | Use |
|---|---|
| Served pages such as a sign in prompt or a loading page | Status Page. |
| Anything inside a config page | Not the Status Page. It is a whole HTML page. |
Usage¶
var html = StatusPage.Render(
heading: "Sign In Required",
message: "Sign in to Jellyfin first.",
buttonText: "Back to Jellyfin",
buttonHref: "../web/");
The template is src/templates/status.html, embedded as <RootNamespace>.Templates.status.html. Each part sits under a comment that names it: favicon, styles, card, logo, heading, message, spinner, button, and content. See Pages and Templates for the C# side.
{{TITLE}}: the document title, HTML encoded. It defaults to the heading.{{HEADING}}: theh1, encoded.{{MESSAGE}}: the paragraph, encoded.{{SPINNER}}:<div class="stolon-spinner" role="status" aria-label="Loading">, or empty whenshowSpinneris off.{{BUTTON}}: ana.stolon-btn, or empty whenbuttonTextorbuttonHrefis null or empty. The defaults are "Back to Jellyfin" and../web/.{{CONTENT}}: raw HTML that is not encoded. Pass only markup the plugin owns.
Classes, all defined in the template's own <style> block: stolon-status-page-card, stolon-logo, stolon-spinner, stolon-btn, stolon-fields, stolon-hint, stolon-field-pair, stolon-submit, stolon-note, and stolon-hidden.
States and Modifiers¶
- The page is always dark, a
#101010page with a#1c1c1fcard and the Jellyfin blue accent. It is centered with a 420px maximum width and 24px page padding, so it fits 375px. stolon-fields,stolon-hint,stolon-field-pair,stolon-submit, andstolon-noteare for a form a plugin supplies throughcontent.StatusPage.Renderdoes not produce them.- The template carries its own copy of
stolon-hiddenand astolon-spinanimation.
Gotchas¶
- It links a relative
favicon.ico(serve one withPublicPage.Favicon) and the logo../web/favicons/touchicon.png. CssCollisionTestsfails if any template class is also defined in the kit CSS, other thanstolon-hidden, so the card is never restyled when both load on one page.
Example¶
Example Code¶
<!-- title: Status Page -->
<!-- min-height: 440 -->
<iframe id="card" title="Status page" style="width: 100%; height: 420px; border: 0; border-radius: 8px;"></iframe>
<script type="module">
await window.__baseReady;
// The built preview copies the real template next to the bundle, and this fills it the way StatusPage.Render does.
const template = await (await fetch('./base/status.html')).text();
const encode = (value) => value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
const values = {
TITLE: 'Sign in required',
HEADING: 'Sign in required',
MESSAGE: encode('Sign in to Jellyfin first.'),
SPINNER: '',
BUTTON: '<a class="stolon-btn" href="#">Back to Jellyfin</a>',
CONTENT: ''
};
const logo = window.__gallery.rect(72, 72, '#00a4dc', 'J');
const page = template
.replace('../web/favicons/touchicon.png', logo)
.replace('<link rel="icon" href="favicon.ico" />', '')
.replace(/\{\{(\w+)\}\}/g, (_, key) => values[key] ?? '');
document.getElementById('card').srcdoc = page;
</script>