import { useCallback, useEffect, useState } from 'react' import { Button, EmptyState } from '../ui' import { getCustomerViewLog } from '../../lib/teamApi' import { formatViewLogTime, viewLogLabel } from '../../lib/viewLog' // Reiter „Protokoll“: wer wann die Kundenansicht dieses Kunden geöffnet oder darin etwas geändert hat export default function CustomerViewLog({ customerId }) { const [entries, setEntries] = useState(null) const [error, setError] = useState(null) const load = useCallback(async () => { setError(null) setEntries(null) try { const { entries: list } = await getCustomerViewLog(customerId) setEntries(list || []) } catch (err) { setError(err.message || 'Protokoll konnte nicht geladen werden.') } }, [customerId]) useEffect(() => { load() }, [load]) if (error) { return (
| Zeit | Mitarbeiter | Aktion |
|---|---|---|
| {formatViewLogTime(e.at)} | {e.staffName || '–'} |
{viewLogLabel(e.action)}
{e.detail && {e.detail} }
|