# Catch up

> Return-to-work AI digest scanning connected apps across 1d/3d/1w ranges, grouped by priority with mark-as-read toggles.

- Kind: block · Category: AI · Interactivity: script
- Install: `npx shadcn@latest add @haze/catch-up`
- File: `src/components/haze/blocks/catch-up.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/blocks/catch-up

## Use when
- Summarizing cross-app activity (GitHub, Linear, Slack, email) when a user returns to a workspace
- Letting users triage Needs-you items, decisions and shipped updates in one list

## Avoid when
- Displaying a raw chronological feed of every event; use timeline or inbox-list

## Alternatives
- [inbox-list](https://hazeui.com/ui/inbox-list.md)
- [notification-stack](https://hazeui.com/ui/notification-stack.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| id | `string` | "haze-catch-up" | no | Unique prefix for section heading IDs. |
| heading | `string` | "Catch up while you were away" | no | Digest card heading. |
| items | `DigestItem[]` | 4 prioritized items | no | Summarized items with priority group, app source and people. |
| class | `string` |  | no | Extra classes on the outer section. |

## Accessibility
- Time-range buttons and Mark read controls expose aria-pressed and announce state updates in a polite status region.
- Priority groups pair distinct badges with text labels rather than relying on color alone.
- Key Tab: Move across time-range buttons and per-item Mark read toggles
- Key Enter / Space: Switch the digest time window or mark an item read/unread

## Agent prompts

### Install and use

Install the Haze UI block "Catch up" with `npx shadcn@latest add @haze/catch-up`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import CatchUp from "@/components/haze/blocks/catch-up.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/blocks/catch-up.md

### Customize with real content

Adapt the Haze catch-up block for our product. Replace the demo values of these props with our real content: id, heading, items, class. Keep the layout, the heading level rules and these accessibility details: Time-range buttons and Mark read controls expose aria-pressed and announce state updates in a polite status region. Priority groups pair distinct badges with text labels rather than relying on color alone. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using catch-up, check it fits: use it when summarizing cross-app activity (github, linear, slack, email) when a user returns to a workspace; letting users triage needs-you items, decisions and shipped updates in one list. Avoid it when displaying a raw chronological feed of every event; use timeline or inbox-list. Alternatives: @haze/inbox-list, @haze/notification-stack.

## Example requests that should lead here
- Add an AI catch-up digest card with 1 day, 3 days and 1 week filters and mark-as-read buttons

## Source

```astro
---
import { Check, Clock, Inbox, Sparkles } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";

interface DigestItem {
  id: string;
  group: "Needs you" | "Decisions" | "Shipped" | "FYI";
  app: string;
  title: string;
  summary: string;
  people: string;
}

interface Props {
  id?: string;
  heading?: string;
  items?: DigestItem[];
  class?: string;
}

const {
  id = "haze-catch-up",
  heading = "Catch up while you were away",
  items = [
    { id: "cu-1", group: "Needs you", app: "GitHub", title: "Review PR 492: Token contrast audit", summary: "Nina requested your sign-off on the updated muted-foreground token before Thursday's release.", people: "Nina, Leo" },
    { id: "cu-2", group: "Decisions", app: "Linear", title: "Adopted Astro 5 static islands for docs", summary: "Team agreed to remove client-side router hydration from all guide pages.", people: "Marco, Sam" },
    { id: "cu-3", group: "Shipped", app: "Slack", title: "Command palette OS modifier detection", summary: "macOS users now see the Command glyph while Windows/Linux keeps Ctrl across shortcuts.", people: "Elena" },
    { id: "cu-4", group: "FYI", app: "Gmail", title: "Enterprise security questionnaire received", summary: "Tidewell asked for SOC 2 bridge letter by next Friday; Ops owns the draft.", people: "Ops team" },
  ],
  class: className,
} = Astro.props;
const ranges = ["1 day", "3 days", "1 week"] as const;
---

<section aria-labelledby={`${id}-title`} data-haze-catch-up class={cn("bg-background px-4 py-10 sm:px-6 sm:py-14", className)}>
  <div class="mx-auto max-w-3xl rounded-2xl border border-border bg-card p-5 sm:p-6">
    <header class="flex flex-wrap items-center justify-between gap-3 border-b border-border pb-4">
      <div class="flex items-center gap-2.5">
        <span class="grid size-8 place-items-center rounded-lg border border-frame bg-muted text-muted-foreground" aria-hidden="true">
          <Sparkles class="size-4" />
        </span>
        <div>
          <h2 id={`${id}-title`} class="text-base/6 font-semibold tracking-tight text-foreground">{heading}</h2>
          <p class="text-xs/5 text-muted-foreground">Scanned Slack, Linear, GitHub and Gmail</p>
        </div>
      </div>

      <div role="group" aria-label="Digest time range" class="inline-flex rounded-lg border border-frame bg-muted p-0.5">
        {
          ranges.map((r, idx) => (
            <button
              type="button"
              data-cu-range={r}
              aria-pressed={idx === 1 ? "true" : "false"}
              class="relative inline-flex h-7 cursor-pointer items-center rounded-md px-2.5 text-xs font-medium text-muted-foreground transition-colors duration-150 hover:text-foreground aria-pressed:bg-background aria-pressed:text-foreground aria-pressed:shadow-key focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-ring active:scale-[0.97] active:duration-75"
            >
              {r}
            </button>
          ))
        }
      </div>
    </header>

    <ul role="list" class="mt-4 space-y-2.5">
      {
        items.map((item) => (
          <li data-cu-item class="rounded-xl border border-border bg-muted/40 p-3.5 transition-opacity duration-150 data-[read=true]:opacity-50">
            <div class="flex flex-wrap items-center justify-between gap-2">
              <div class="flex flex-wrap items-center gap-2">
                <span class={cn(
                  "rounded-md border px-2 py-0.5 text-[0.6875rem]/4 font-medium",
                  item.group === "Needs you" ? "border-frame-warning bg-warning/10 text-warning" :
                  item.group === "Shipped" ? "border-frame-success bg-success/10 text-success" :
                  "border-frame bg-card text-muted-foreground",
                )}>{item.group}</span>
                <span class="font-mono text-[0.6875rem] text-muted-foreground">{item.app}</span>
                <span class="text-[0.6875rem] text-muted-foreground">· {item.people}</span>
              </div>
              <button
                type="button"
                data-cu-done
                aria-pressed="false"
                class="inline-flex h-7 cursor-pointer items-center gap-1 rounded-md border border-frame bg-field px-2 text-xs font-medium text-muted-foreground transition-colors duration-150 hover:border-frame-strong hover:text-foreground aria-pressed:border-border-strong aria-pressed:bg-accent aria-pressed:text-foreground focus-visible:outline-2 focus-visible:outline-ring active:scale-[0.97] active:duration-75"
              >
                <Check class="size-3.5" aria-hidden="true" />
                <span>Mark read</span>
              </button>
            </div>
            <h3 class="mt-2 text-sm/5 font-medium text-foreground">{item.title}</h3>
            <p class="mt-1 text-xs/5 text-pretty text-muted-foreground">{item.summary}</p>
          </li>
        ))
      }
    </ul>

    <div class="mt-4 flex flex-wrap items-center justify-between gap-2 border-t border-border pt-3 text-xs text-muted-foreground">
      <span class="inline-flex items-center gap-1.5">
        <Clock class="size-3.5" aria-hidden="true" />
        <span data-cu-meta>Showing highlights from the last 3 days</span>
      </span>
      <span data-cu-status role="status" class="text-foreground"></span>
    </div>
  </div>
</section>

<script>
  function initCatchUps() {
    document.querySelectorAll<HTMLElement>("[data-haze-catch-up]").forEach((root) => {
      if (root.hasAttribute("data-enhanced")) return;
      root.setAttribute("data-enhanced", "");
      const meta = root.querySelector<HTMLElement>("[data-cu-meta]");
      const status = root.querySelector<HTMLElement>("[data-cu-status]");

      root.querySelectorAll<HTMLButtonElement>("[data-cu-range]").forEach((btn) => {
        btn.addEventListener("click", () => {
          const r = btn.dataset.cuRange ?? "3 days";
          root.querySelectorAll<HTMLButtonElement>("[data-cu-range]").forEach((b) => b.setAttribute("aria-pressed", String(b === btn)));
          if (meta) meta.textContent = `Showing highlights from the last ${r}`;
          if (status) status.textContent = `Updated digest to ${r}.`;
        });
      });

      root.querySelectorAll<HTMLButtonElement>("[data-cu-done]").forEach((btn) => {
        btn.addEventListener("click", () => {
          const read = btn.getAttribute("aria-pressed") !== "true";
          btn.setAttribute("aria-pressed", String(read));
          const span = btn.querySelector("span");
          if (span) span.textContent = read ? "Read" : "Mark read";
          btn.closest("[data-cu-item]")?.setAttribute("data-read", String(read));
          if (status) status.textContent = read ? "Item marked as read." : "Item marked unread.";
        });
      });
    });
  }
  initCatchUps();
  document.addEventListener("astro:page-load", initCatchUps);
</script>
```
