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.

Make TableCardHeader title-only render nothing

rcourtman4cbae25d3497
diff --git a/frontend-modern/src/components/shared/TableCardHeader.tsx b/frontend-modern/src/components/shared/TableCardHeader.tsx
index 50fd6a9790..ff407d43da 100644
--- a/frontend-modern/src/components/shared/TableCardHeader.tsx
+++ b/frontend-modern/src/components/shared/TableCardHeader.tsx
@@ -1,7 +1,7 @@
import { Show, type Component, type JSX } from 'solid-js';
export type TableCardHeaderProps = {
- title: JSX.Element;
+ title?: JSX.Element;
actions?: JSX.Element;
showClearAction?: boolean;
clearLabel?: string;
@@ -23,13 +23,16 @@ const TABLE_CARD_HEADER_ACTIONS_CLEAR_BUTTON_CLASS = TABLE_CARD_HEADER_CLEAR_BUT
);
export const TableCardHeader: Component<TableCardHeaderProps> = (props) => {
+ const hasActions = () => Boolean(props.actions || (props.showClearAction && props.onClear));
const clearLabel = () => props.clearLabel ?? 'Clear';
const clearAriaLabel = () => props.clearAriaLabel ?? 'Clear selection';
return (
- <div class={TABLE_CARD_HEADER_CLASS}>
- <span>{props.title}</span>
- <Show when={props.actions || (props.showClearAction && props.onClear)}>
+ <Show when={hasActions()}>
+ <div class={TABLE_CARD_HEADER_CLASS}>
+ <Show when={props.title}>
+ <span>{props.title}</span>
+ </Show>
<div class="ml-auto flex items-center gap-2 normal-case tracking-normal">
{props.actions}
<Show when={props.showClearAction && props.onClear}>
@@ -46,8 +49,8 @@ export const TableCardHeader: Component<TableCardHeaderProps> = (props) => {
</button>
</Show>
</div>
- </Show>
- </div>
+ </div>
+ </Show>
);
};