<script lang="ts">
  import type { ActivityItem } from '$lib/api'

  let { row }: { row: ActivityItem } = $props()

  function fmtDuration(ms: number | null): string {
    if (ms == null) return '—'
    if (ms < 1000) return `${ms}ms`
    const s = Math.round(ms / 1000)
    if (s < 60) return `${s}s`
    return `${Math.floor(s / 60)}m ${s % 60}s`
  }
</script>

<div>
  <div>{row.verb}</div>
  {#if row.summary}
    <div class="text-xs text-muted-foreground">{row.summary}</div>
  {/if}
  {#if row.error}
    <div class="text-xs text-destructive">{row.error}</div>
  {/if}
</div>
