import React from 'react'; import { UserIcon } from '@heroicons/react/outline'; import { Link } from 'react-router-dom'; import Tooltip from '@/components/elements/tooltip/Tooltip'; import Translate from '@/components/elements/Translate'; import { format, formatDistanceToNowStrict } from 'date-fns'; import { ActivityLog } from '@definitions/user'; import { useLocation } from 'react-router'; import ActivityLogMetaButton from '@/components/elements/activity/ActivityLogMetaButton'; interface Props { activity: ActivityLog; children?: React.ReactNode; } export default ({ activity, children }: Props) => { const location = useLocation(); const actor = activity.relationships.actor; const queryTo = (params: Record): string => { const current = new URLSearchParams(location.search); Object.keys(params).forEach(key => current.set(key, params[key])); return current.toString(); }; return (
{actor ? {'User : }
{actor?.username || 'System'}  —  {activity.event} {children}

{activity.event.replace(':', '.')}

{activity.ip}  |  {formatDistanceToNowStrict(activity.timestamp, { addSuffix: true })}
{activity.hasAdditionalMetadata && }
); };