3.3 KiB · text History 84bfe6e
{% extends "root.html" %}
{# Focus layout for a list of topics (tag, search, bookmarks, reactions,
   notifications): tiles that open the reader over this page, whose filmstrip
   and ←/→ order are this page's list. Optional `rail` (tags), `search_q`
   (search box), and per-tile `notes`. src/handlers/focus.rs. #}
{% block width %}w-full max-w-none{% endblock %}
{% block main_class %}px-3 py-3 sm:px-4 lg:px-5{% endblock %}
{% block layout %}focus{% endblock %}
{% block content %}
<div class="flex min-h-[calc(100dvh-5.5rem)] flex-col gap-4 text-left" id="focus" data-focus="{{ page_id }}">
  {% if crumbs %}
  <nav class="text-sm opacity-70" aria-label="Breadcrumb">
    {% for c in crumbs %}<a href="{{ c.href }}" class="link link-hover">{{ c.name }}</a> / {% endfor %}{{ heading }}
  </nav>
  {% endif %}
  <div class="flex flex-wrap items-center justify-between gap-3">
    <div>
      <h1 class="text-3xl font-bold flex items-center gap-2">
        {% if heading_icon %}<i class="fas {{ heading_icon }} text-2xl opacity-70" aria-hidden="true"></i>{% endif %}{{ heading }}
      </h1>
      {% if subheading %}<p class="text-sm opacity-70">{{ subheading }}</p>{% endif %}
    </div>
    <div class="flex flex-wrap items-center gap-2">
      {% set view_mode = "focus" %}{% include "forum/_view_toggle.html" %}
      {% if mark_all_read %}
      <form method="post" action="/notifications/read-all" class="m-0" hx-boost="false">
        <button type="submit" class="btn btn-ghost btn-sm">Mark all read</button>
      </form>
      {% endif %}
    </div>
  </div>
  {% if search_q is defined %}
  <form method="get" action="/search" class="join w-full max-w-2xl" role="search">
    <input name="q" value="{{ search_q }}" placeholder="Search topics, posts, tags…" aria-label="Search" minlength="3" required title="Type at least 3 characters"
           class="input input-bordered join-item w-full" {% if not search_q %}autofocus{% endif %}/>
    <button class="btn btn-primary join-item" type="submit">Search</button>
  </form>
  {% endif %}

  <div class="flex flex-1 flex-col gap-4 md:flex-row md:items-stretch">
    {% if rail %}{% include "forum/_rail.html" %}{% endif %}
    {# The feeds: /p/latest follows live updates, /p/popular refreshes every
       5 minutes (f/js/live.js). #}
    <section id="focus-list" aria-label="{{ heading }}"
             {% if page_id == "latest" %}data-live="latest"{% elif page_id == "popular" %}hx-get="/p/popular?view=focus" hx-select="#focus-list" hx-target="this" hx-swap="outerHTML" hx-disinherit="*"
             hx-trigger="every 300s [window.livePollOk()]" data-poll="popular"{% endif %}
             class="min-w-0 flex-1 space-y-4 rounded-box border border-primary/40 bg-base-200/40 p-4">
      {% if topics %}
      <div class="grid grid-cols-[repeat(auto-fill,minmax(17rem,1fr))] gap-3">
        {% for t in topics %}{% include "forum/_topic_tile.html" %}{% endfor %}
      </div>
      {% elif empty %}
      <p class="rounded-box border border-dashed border-base-300 p-6 text-center text-sm opacity-60">{{ empty }}</p>
      {% endif %}
      {% if others %}
      {# Notifications without a topic to show as a tile. #}
      <ul class="space-y-2">{% for n in others %}{% include "_notif_item.html" %}{% endfor %}</ul>
      {% endif %}
    </section>
  </div>

  {% include "forum/_reader.html" %}
</div>
{% endblock %}