2022-11-25 20:25:03 +00:00
|
|
|
import { useState } from 'react';
|
2022-06-12 19:08:26 +00:00
|
|
|
import { ClipboardListIcon } from '@heroicons/react/outline';
|
|
|
|
import { Dialog } from '@/components/elements/dialog';
|
|
|
|
import { Button } from '@/components/elements/button/index';
|
|
|
|
|
|
|
|
export default ({ meta }: { meta: Record<string, unknown> }) => {
|
2022-06-26 19:13:52 +00:00
|
|
|
const [open, setOpen] = useState(false);
|
2022-06-12 19:08:26 +00:00
|
|
|
|
|
|
|
return (
|
2022-06-12 19:40:14 +00:00
|
|
|
<div className={'self-center md:px-4'}>
|
2022-06-26 19:13:52 +00:00
|
|
|
<Dialog open={open} onClose={() => setOpen(false)} hideCloseIcon title={'Metadata'}>
|
2022-07-10 18:53:15 +00:00
|
|
|
<pre
|
|
|
|
className={
|
2022-12-16 02:06:14 +00:00
|
|
|
'bg-slate-900 rounded p-2 font-mono text-sm leading-relaxed overflow-x-scroll whitespace-pre-wrap'
|
2022-07-10 18:53:15 +00:00
|
|
|
}
|
|
|
|
>
|
2022-06-12 19:16:48 +00:00
|
|
|
{JSON.stringify(meta, null, 2)}
|
|
|
|
</pre>
|
2022-07-02 21:24:12 +00:00
|
|
|
<Dialog.Footer>
|
2022-06-12 19:08:26 +00:00
|
|
|
<Button.Text onClick={() => setOpen(false)}>Close</Button.Text>
|
2022-07-02 21:24:12 +00:00
|
|
|
</Dialog.Footer>
|
2022-06-12 19:08:26 +00:00
|
|
|
</Dialog>
|
|
|
|
<button
|
2022-06-18 16:52:26 +00:00
|
|
|
aria-describedby={'View additional event metadata'}
|
2022-06-26 19:13:52 +00:00
|
|
|
className={
|
2022-12-16 02:06:14 +00:00
|
|
|
'p-2 transition-colors duration-100 text-slate-400 group-hover:text-slate-300 group-hover:hover:text-slate-50'
|
2022-06-26 19:13:52 +00:00
|
|
|
}
|
2022-06-12 19:08:26 +00:00
|
|
|
onClick={() => setOpen(true)}
|
|
|
|
>
|
2022-06-26 19:13:52 +00:00
|
|
|
<ClipboardListIcon className={'w-5 h-5'} />
|
2022-06-12 19:08:26 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|