Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Use shared header for pricing handoff

rcourtman1234f9140e17
diff --git a/frontend-modern/src/components/shared/PageHeader.tsx b/frontend-modern/src/components/shared/PageHeader.tsx
index 2b3b77f16e..505bb438a9 100644
--- a/frontend-modern/src/components/shared/PageHeader.tsx
+++ b/frontend-modern/src/components/shared/PageHeader.tsx
@@ -5,6 +5,8 @@ type PageHeaderProps = {
id?: string;
title: JSX.Element;
description?: JSX.Element;
+ descriptionVisibility?: 'desktop' | 'always';
+ updateDocumentTitle?: boolean;
titleMeta?: JSX.Element;
actions?: JSX.Element;
class?: string;
@@ -17,6 +19,8 @@ export function PageHeader(props: PageHeaderProps) {
'id',
'title',
'description',
+ 'descriptionVisibility',
+ 'updateDocumentTitle',
'titleMeta',
'actions',
'class',
@@ -33,11 +37,20 @@ export function PageHeader(props: PageHeaderProps) {
// AppLayout. Non-string titles (rich JSX) fall back to whatever
// AppLayout already set.
createEffect(() => {
- if (typeof local.title === 'string' && local.title.trim()) {
+ if (
+ local.updateDocumentTitle !== false &&
+ typeof local.title === 'string' &&
+ local.title.trim()
+ ) {
document.title = `${local.title.trim()} · Pulse`;
}
});
+ const descriptionClass = () =>
+ local.descriptionVisibility === 'always'
+ ? `mt-1 text-sm font-medium text-muted ${local.descriptionClass ?? ''}`.trim()
+ : `mt-1 hidden text-sm font-medium text-muted sm:block ${local.descriptionClass ?? ''}`.trim();
+
return (
<Show when={!kioskMode()}>
<div
@@ -55,11 +68,7 @@ export function PageHeader(props: PageHeaderProps) {
<Show when={local.titleMeta}>{local.titleMeta}</Show>
</div>
<Show when={local.description}>
- <p
- class={`mt-1 hidden text-sm font-medium text-muted sm:block ${local.descriptionClass ?? ''}`.trim()}
- >
- {local.description}
- </p>
+ <p class={descriptionClass()}>{local.description}</p>
</Show>
</div>
<Show when={local.actions}>
diff --git a/frontend-modern/src/pages/PricingHandoff.tsx b/frontend-modern/src/pages/PricingHandoff.tsx
index 9d774ba10c..59efdf01a6 100644
--- a/frontend-modern/src/pages/PricingHandoff.tsx
+++ b/frontend-modern/src/pages/PricingHandoff.tsx
@@ -1,5 +1,6 @@
import { Navigate, useLocation } from '@solidjs/router';
import { Show, createMemo, onMount } from 'solid-js';
+import { PageHeader } from '@/components/shared/PageHeader';
import {
getPricingRouteDestination,
handoffToExternalPricing,
@@ -35,16 +36,23 @@ export default function PricingHandoff() {
>
<div class="flex min-h-[50vh] items-center justify-center">
<div class="max-w-xl space-y-2 text-center">
- <h1 class="text-lg font-semibold tracking-tight text-base-content">
- Redirecting to {handoffLabel()}
- </h1>
- <p class="text-sm text-muted">
- If the handoff does not start automatically,{' '}
- <a href={destination()} class="text-blue-600 hover:underline dark:text-blue-400">
- {handoffLinkLabel()}
- </a>
- .
- </p>
+ <PageHeader
+ title={<>Redirecting to {handoffLabel()}</>}
+ description={
+ <>
+ If the handoff does not start automatically,{' '}
+ <a href={destination()} class="text-blue-600 hover:underline dark:text-blue-400">
+ {handoffLinkLabel()}
+ </a>
+ .
+ </>
+ }
+ descriptionVisibility="always"
+ updateDocumentTitle={false}
+ class="!items-center !justify-center text-center sm:!flex-col"
+ titleClass="!text-lg !font-semibold"
+ descriptionClass="!font-normal"
+ />
</div>
</div>
</Show>
diff --git a/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx b/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx
index 1d9951615e..4be8fa1b50 100644
--- a/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx
+++ b/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx
@@ -53,16 +53,14 @@ describe('PricingHandoff', () => {
);
});
- it('bypasses PageHeader so the manual-redirect link stays visible on mobile', () => {
- // PageHeader hides its description below sm: with `hidden sm:block`, and
- // mutates document.title in a createEffect. Both behaviors are wrong for
- // this transient redirect splash — the description IS the recovery path
- // when the auto-redirect fails, so it must render at every breakpoint.
- expect(pricingHandoffSource).not.toContain(
+ it('uses PageHeader without hiding the manual-redirect link on mobile', () => {
+ expect(pricingHandoffSource).toContain(
"import { PageHeader } from '@/components/shared/PageHeader';",
);
- expect(pricingHandoffSource).not.toContain('<PageHeader');
- expect(pricingHandoffSource).toContain('<h1');
+ expect(pricingHandoffSource).toContain('<PageHeader');
+ expect(pricingHandoffSource).toContain('descriptionVisibility="always"');
+ expect(pricingHandoffSource).toContain('updateDocumentTitle={false}');
+ expect(pricingHandoffSource).not.toContain('<h1');
});
// The earlier 'retired monitored-system pricing handoffs' case has been