← back to Bubbesblock

public/index.html

46 lines

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BubbesBlock — Beekman Ave</title>
<meta name="description" content="BubbesBlock — your neighborhood block, the warm way. Cup-of-sugar favors, block events, Shabbat dinners, and the stories of who lived where." />
<link rel="stylesheet" href="/styles.css" />
</head>
<body>
<div id="hdr"></div>
<div class="wrap">
  <div id="left"></div>
  <main class="col-center" id="feed"></main>
  <div id="right"></div>
</div>

<script>window.__bbAutoInit = false;</script>
<script src="/chrome.js"></script>
<script src="/app.js"></script>
<script>
fetch('/api/posts', { credentials: 'same-origin' }).then(r=>r.json()).then(d=>{
  document.getElementById('hdr').innerHTML   = topbar(d.me);
  document.getElementById('left').innerHTML  = leftRail(d.me);
  document.getElementById('right').innerHTML = rightRail(d.me);

  const newpost = `<div class="newpost">
    <span class="ava ${d.me.color}" style="width:42px;height:42px;font-size:15px">${d.me.initials}</span>
    <div class="fake" data-composer>Share something with the block, ${d.me.name.split(' ')[0]}…</div>
  </div>`;

  const cards = d.posts.map(p=>`
    <article class="card feedcard" onclick="if(!event.target.closest('button,a,[data-react],[data-share],[data-reply],.actions,.more')) location.href='/p/${p.id}'">
      <div class="post">${postHead(p)}${postBody(p)}</div>
      ${photoBlock(p.photo)}
      ${statRow(p, p.commentCount)}
      ${actionBar(p.id, p.youThanked, p.thanks)}
    </article>`).join('');

  document.getElementById('feed').innerHTML = newpost + cards;
  BB.init();
}).catch(()=>{ document.getElementById('feed').innerHTML = '<div class="card"><div class="post">Could not load the block feed.</div></div>'; });
</script>
</body>
</html>