3.3 KiB · text History 84bfe6e
{% extends "root.html" %}
{# Landing, Focus (src/handlers/landing.rs): categories on the left; on the
   right a Latest row of tiles and, under it, a Popular row, full width. A
   tile opens the reader, which steps through its own row (`list=popular`
   for the second). Each heading opens its full feed in Focus. #}
{% 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="grid min-h-[calc(100dvh-5.5rem)] grid-cols-1 gap-4 text-left lg:grid-cols-[18rem_minmax(0,1fr)]" id="landing">
  {% set all_href = "/c/?view=focus" %}
  {% include "forum/_landing_categories.html" %}

  <div class="min-w-0 space-y-4">
    <section id="landing-latest" aria-label="Latest topics" data-live="latest"
             class="space-y-4 rounded-box border border-primary/40 bg-base-200/40 p-4">
      <div class="flex flex-wrap items-center justify-between gap-2">
        <h1 class="text-2xl font-bold">
          <a href="/p/latest?view=focus" class="hover:text-primary" title="All latest topics"><i class="fas fa-clock mr-1 text-lg opacity-60" aria-hidden="true"></i>Latest</a>
        </h1>
        <div class="flex items-center gap-2">
          <a href="/p/latest?view=focus" class="link link-hover text-sm opacity-70">All latest <i class="fas fa-arrow-right text-xs"></i></a>
          {% set toggle_base = "/" %}{% set view_mode = "focus" %}
          {% include "forum/_view_toggle.html" %}
        </div>
      </div>
      {% if latest %}
      <div class="grid grid-cols-[repeat(auto-fill,minmax(17rem,1fr))] gap-3">
        {% set base = latest_base %}
        {% for t in latest %}{% include "forum/_topic_tile.html" %}{% endfor %}
      </div>
      {% else %}
      <p class="rounded-box border border-dashed border-base-300 p-6 text-center text-sm opacity-60">No topics yet.</p>
      {% endif %}
    </section>

    {# Refreshed every 5 minutes while the tab is visible and the reader
       closed (f/js/live.js has the condition). #}
    <section id="landing-popular" aria-label="Popular topics"
             hx-get="/?view=focus" hx-select="#landing-popular" hx-target="this" hx-swap="outerHTML" hx-disinherit="*"
             hx-trigger="every 300s [window.livePollOk()]" data-poll="popular"
             class="space-y-4 rounded-box border border-base-300 bg-base-200/40 p-4">
      <div class="flex flex-wrap items-center justify-between gap-2">
        <h2 class="text-2xl font-bold">
          <a href="/p/popular?view=focus" class="hover:text-primary" title="All popular topics"><i class="fas fa-fire mr-1 text-lg opacity-60" aria-hidden="true"></i>Popular</a>
        </h2>
        <a href="/p/popular?view=focus" class="link link-hover text-sm opacity-70">All popular <i class="fas fa-arrow-right text-xs"></i></a>
      </div>
      {% if popular %}
      <div class="grid grid-cols-[repeat(auto-fill,minmax(17rem,1fr))] gap-3">
        {% set base = popular_base %}
        {% for t in popular %}{% include "forum/_topic_tile.html" %}{% endfor %}
      </div>
      {% else %}
      <p class="rounded-box border border-dashed border-base-300 p-6 text-center text-sm opacity-60">Nothing popular in the last 30 days yet.</p>
      {% endif %}
    </section>
  </div>

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