Files
EpicNext-Cms/src/components/public/ui.tsx
T
openhands 17847545dd
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m52s
Improvements: remove dead config, fix ESM, add URL validation, unify types, add missing logging
- Remove .prettierrc (dead config, Biome replaces Prettier)
- Rename lighthouserc.json to lighthouserc.cjs with module.exports for ESM compat
- Add logger.warn to empty catch blocks in auth, register, site-settings, prisma-cache, redis, security, rate-limit
- Unify ActionResult type: action-helper.ts uses 'ok' consistent with safe-action-shared.ts
- Add noUnusedLocals + noUnusedParameters to tsconfig + fix 25 pre-existing unused vars
- Replace barrel export src/types/index.ts with direct @/types/common imports
- Make trustHost conditional (development only) in auth.ts
- Add pre-flight URL validation to update-Nitrov3.sh to catch image.library.url misconfigurations
- Improve NITRO_IMAGE_LIBRARY_URL content validation in pre-flight & post-compute checks
2026-07-26 20:28:11 +02:00

122 lines
2.8 KiB
TypeScript

import type { ReactNode } from "react";
/**
* Public-site design system, faithful to AtomCMS's "atom" theme. The signature
* element is the content-card: a surface card with a primary-tinted header
* (icon circle + title + subtitle) and a padded body. These mirror the atom
* Blade components (content-card, stat blocks, empty states) so every public
* page shares one consistent, themeable look.
*/
export function ContentCard({
icon,
title,
subtitle,
action,
children,
className,
padded = true,
}: {
icon?: string;
title?: ReactNode;
subtitle?: ReactNode;
action?: ReactNode;
children?: ReactNode;
className?: string;
padded?: boolean;
}) {
const hasHead =
title != null || icon != null || subtitle != null || action != null;
return (
<div className={`content-card${className ? ` ${className}` : ""}`}>
{hasHead ? (
<div className="content-card-head">
{icon ? (
<span className="content-card-icon" aria-hidden>
{icon}
</span>
) : null}
<div className="content-card-head-text">
{title != null ? (
<p className="content-card-title">{title}</p>
) : null}
{subtitle != null ? (
<p className="content-card-subtitle">{subtitle}</p>
) : null}
</div>
{action ? <div className="content-card-action">{action}</div> : null}
</div>
) : null}
<div className={padded ? "content-card-body" : undefined}>{children}</div>
</div>
);
}
/** A value + label tile (profile stats, rare-value summaries, …). */
export function StatBlock({
value,
label,
icon,
}: {
value: ReactNode;
label: string;
icon?: string;
}) {
return (
<div className="stat-block">
<div className="stat-block-value">
{icon ? <span aria-hidden>{icon} </span> : null}
{value}
</div>
<div className="stat-block-label">{label}</div>
</div>
);
}
/** Friendly empty state with an icon and a muted line. */
export function EmptyState({
icon = "📭",
children,
}: {
icon?: string;
children: ReactNode;
}) {
return (
<div className="empty-state">
<div className="empty-state-icon" aria-hidden>
{icon}
</div>
<p className="muted" style={{ margin: 0 }}>
{children}
</p>
</div>
);
}
/** Online / offline pill with a status dot. */
export function OnlineBadge({ online }: { online: boolean }) {
return (
<span className={`online-badge${online ? " online" : ""}`}>
<span className="online-dot" aria-hidden />
{online ? "Online" : "Offline"}
</span>
);
}
/** Leaderboard rank chip — medals for the top three, number otherwise. */
export function RankBadge({ position }: { position: number }) {
const medal =
position === 1
? "🥇"
: position === 2
? "🥈"
: position === 3
? "🥉"
: null;
return (
<span className={`rank-badge rank-${position <= 3 ? position : "n"}`}>
{medal ?? `#${position}`}
</span>
);
}