import React, { useEffect, useState, memo } from 'react' import { Button } from '@janhq/joi' import { CopyIcon, CheckIcon, FolderIcon } from 'lucide-react' import { twMerge } from 'tailwind-merge' import { useClipboard } from '@/hooks/useClipboard' import { useLogs } from '@/hooks/useLogs' import { usePath } from '@/hooks/usePath' const AppLogs = () => { const { getLogs } = useLogs() const [logs, setLogs] = useState([]) const { onRevealInFinder } = usePath() useEffect(() => { getLogs('app').then((log) => { if (typeof log?.split === 'function') { if (log.length > 0) { setLogs(log.split(/\r?\n|\r|\n/g)) } } }) // eslint-disable-next-line react-hooks/exhaustive-deps }, []) const clipboard = useClipboard({ timeout: 1000 }) return (
{logs.length > 0 ? ( {logs.slice(-100).map((log, i) => { return (

{log}

) })}
) : (

Empty logs

)}
) } export default memo(AppLogs)