<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Digest — compact</title>
<link rel="stylesheet" href="digest-canvas-sdk/glow.css">
<style>
  /*
   * Compact view: sized for a Home Assistant Lovelace iframe card, so single
   * column, no fixed height, and no globe-sized artwork. Give the iframe card
   * about 420px of width and let it scroll.
   */
  html, body {
    margin: 0;
    padding: 0;
    background: var(--digest-bg);
  }

  #canvas {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.7rem;
    min-height: 100vh;
  }

  #canvas .digest-window {
    width: 100%;
  }

  #canvas .digest-window-body {
    max-height: 22rem;
  }

  #canvas .digest-globe {
    max-width: 260px;
  }
</style>
</head>
<body>
<div id="canvas" class="digest-canvas"></div>

<script src="digest-canvas-sdk/window-chrome.js"></script>
<script src="digest-canvas-sdk/globe.js"></script>
<script src="digest-canvas-sdk/render.js"></script>
<script>
  // digest-web serves the shared output volume under /output/; run.py rewrites
  // output/latest.json at the end of every run, so this URL is always current
  // and no coordination with the scheduler is needed. Change it if you mount
  // the output volume at the server root instead.
  var DIGEST_URL = 'output/latest.json';
  var REFRESH_MS = 5 * 60 * 1000;

  var canvas = document.getElementById('canvas');

  // Optional ?person=<name|nickname|id> — put it in the Lovelace card's URL to get
  // that person's own digest sections (chosen in identity's admin panel). Unlike
  // full.html this defaults to showing everything that was generated, personal
  // section included: this card is embedded in somebody's own HA dashboard, which is
  // already a per-account surface, not a kiosk in a hallway that anyone walks past.
  var person = new URLSearchParams(location.search).get('person') || '';

  function load() {
    DigestRender.load(canvas, DIGEST_URL, { detailLevel: 'compact', person: person });
  }

  load();
  setInterval(load, REFRESH_MS);
</script>
</body>
</html>
