Skip to content

Commit

Permalink
♻️ [#445] Simplify AppDebug implementation
Browse files Browse the repository at this point in the history
Dropped the value prop in favour of always passing children.
  • Loading branch information
sergei-maertens committed Mar 10, 2025
1 parent 8e35d37 commit 5c22554
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/AppDebug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import {getVersion} from '@/utils';

export interface DebugInfoProps {
label: string;
value?: string;
children?: React.ReactNode;
}

const DebugInfo: React.FC<DebugInfoProps> = ({label, value, children}) => (
const DebugInfo: React.FC<DebugInfoProps> = ({label, children}) => (
<div className="debug-info">
<div className="debug-info__label">{label}</div>
<div className="debug-info__value">{value ?? children}</div>
<div className="debug-info__value">{children}</div>
</div>
);

Expand All @@ -22,7 +21,7 @@ const AppDebug: React.FC = () => {
const [{expiry}] = useGlobalState(sessionExpiresAt);
return (
<div className="debug-info-container" title="Debug information (only available in dev)">
<DebugInfo label="Current locale" value={locale} />
<DebugInfo label="Current locale">{locale}</DebugInfo>
<DebugInfo label="Session expires at">
{expiry ? (
<>
Expand Down

0 comments on commit 5c22554

Please sign in to comment.