mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Fix codebase audit regressions while preserving UI/UX behavior and adding review-driven hardening.
16 lines
626 B
TypeScript
16 lines
626 B
TypeScript
import type { ReactNode } from 'react';
|
|
import { useCurrentTime } from '../hooks/use-current-time';
|
|
import { getFormattedTimeAgo } from '../lib/utils/time-utils';
|
|
import Tooltip from './tooltip';
|
|
|
|
const TimeAgoTooltipContent = ({ timestamp }: { timestamp?: number }) => {
|
|
useCurrentTime();
|
|
return <>{timestamp === undefined || Number.isNaN(timestamp) ? '' : getFormattedTimeAgo(timestamp)}</>;
|
|
};
|
|
|
|
const TimeAgoTooltip = ({ timestamp, children }: { timestamp?: number; children: ReactNode }) => (
|
|
<Tooltip content={<TimeAgoTooltipContent timestamp={timestamp} />}>{children}</Tooltip>
|
|
);
|
|
|
|
export default TimeAgoTooltip;
|