Files
pterodactyl-panel/resources/scripts/components/elements/activity/ActivityLogMetaButton.tsx
T

43 lines
1.7 KiB
TypeScript
Raw Normal View History

2026-10-05 18:10:18 -04:00
import { ClipboardList } from 'lucide-react';
import { Dialog } from '@/components/elements/dialog';
2026-10-05 18:10:18 -04:00
import Button from '@/components/elements/Button';
import type { ActivityLog } from '@/api/activity';
2026-10-05 18:10:18 -04:00
type ActivityLogMetadata = ActivityLog['attributes']['properties'];
2026-10-05 18:10:18 -04:00
export default function ActivityLogMetaButton({ meta }: { meta: ActivityLogMetadata }) {
return (
2022-06-12 15:40:14 -04:00
<div className={'self-center md:px-4'}>
2026-10-05 18:10:18 -04:00
<Dialog.Trigger
trigger={({ onClick }) => (
<button
type={'button'}
aria-label={'View additional event metadata'}
className={
'p-2 transition-colors duration-100 text-muted-foreground group-hover:text-muted-foreground hover:group-hover:text-foreground'
}
onClick={onClick}
>
<ClipboardList className={'w-5 h-5'} />
</button>
)}
>
2026-10-05 18:10:18 -04:00
{({ open, onClose }) => (
<Dialog open={open} onClose={onClose} hideCloseIcon title={'Metadata'}>
<pre
className={
'bg-muted rounded-sm p-2 font-mono text-sm leading-relaxed overflow-x-scroll whitespace-pre-wrap'
}
>
{JSON.stringify(meta, null, 2)}
</pre>
<Dialog.Footer>
<Button.Text onClick={onClose}>Close</Button.Text>
</Dialog.Footer>
</Dialog>
)}
</Dialog.Trigger>
</div>
);
2026-10-05 18:10:18 -04:00
}