$def with (entries)
$var title: Recent

<article class=h-feed>

<div id=recent>
$for entry in entries:
    $ e = entry["resource"]
    $ type = discover_post_type(e)
    <div class=h-entry>
    $if type == "note":
        <p><big class=p-content>$e["content"][0]</big></p>
        $ likes = []
        $for m in get_mentions(e["url"][0]):
            $ d = m["data"]
            $if d and d["comment_type"]:
                $likes.append(d["author"])
        $if likes:
            $len(likes) $emoji.emojize(":red_heart:")
    $elif type == "bookmark":
        $ bookmark = e["bookmark-of"][0]
        <p><big>Bookmarked <a class=u-bookmark-of
        href=$bookmark>$bookmark</a></big></p>
    $elif type == "like":
        $ like = e["like-of"][0]
        $ context = tx.cache[like].entry
        $ pt = discover_post_type(context.data)
        <p><big>Liked $context["author"]["name"]'s <a class=u-like-of
        href=$like>$pt</a></big></p>
        <blockquote>$:context["content"]</blockquote>
    $elif type == "rsvp":
        $ event = e["in-reply-to"][0]
        <p><big>RSVP'd <code>$e["rsvp"][0]</code> <a class=u-in-reply-to
        href=$event["url"][0]>$event["name"][0]</a></big></p>
    $ published = e["published"]
    <p><small><a class=u-url href=$e["url"][0]><time class=dt-published
    datetime=$published[0].isoformat()>\
    $published[0].format("dddd MMMM Do, YYYY [at] h:mm A")</time></a></small></p>
    </div>
</div>

$# $elif type == "identification":
$#     $ identification = e["identification-of"][0]
$#     <p><big>Identified <a class=u-identification-of
$#     href=$identification["url"]>$identification["name"]</a></big></p>
$# $elif type == "follow":
$#     $ follow = e["follow-of"][0]
$#     <p><big>Followed <a class=u-follow-of
$#     href=$follow["url"]>$follow["name"]</a></big></p>

</article>

$def head():
    <script>
    // TODO root('/', { entries: [] }, {}, (data) => {
    // TODO   // TODO iterate through entries, add
    // TODO   var recent = document.querySelector('#recent')
    // TODO   var entry = document.createElement('div')
    // TODO   entry.classList.add('h-entry')
    // TODO   entry.innerHTML = `<p><big class=p-name>$${body.name}</big></p>`
    // TODO   recent.insertBefore(entry, recent.firstChild)
    // TODO })
    document.addEventListener('DOMContentLoaded', function() {
      const setRecent = (el, op, path, body, data) => {
        if (op === 'add') {
          li = document.createElement('LI')
          li.appendChild(document.createTextNode(body))
          el.appendChild(li)
        }
      }
      root('/', {
        '/recent': ['recent', () => {}, setRecent]
      })
    })
    </script>
    
    <style>
    #mood {
      display: grid;
      float: right;
      grid-template-columns: auto auto;
      height: 15em;
      width: 30em; }
    #mood .display {
      height: 5em;
      width: 5em; }
    #mood input {
      width: 8em; }
    </style>
$var head = head
