{% extends "root.html" %}
{# Visual mode for one category (src/handlers/focus.rs): a rail of the
categories beside it, its topics as tiles, each subcategory as a column of
compact squares, and the reader over it all when ?topic= is set. #}
{% 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="{{ category.slug }}">
<nav class="text-sm opacity-70" aria-label="Breadcrumb">
<a href="/c/?view=focus" class="link link-hover">Categories</a>
{% for a in ancestors %} / <a href="{{ a.href }}" class="link link-hover">{{ a.name }}</a>{% endfor %}
/ {{ category.name }}
</nav>
<div class="flex flex-wrap items-center justify-between gap-3">
<h1 class="text-3xl font-bold flex items-center gap-2">
<span class="size-6 rounded-full border border-base-content/20" style="background: {{ category_widget_bg }}" aria-hidden="true"></span>
{{ category.name }}
{% for r in rules %}<span class="badge badge-outline badge-sm font-normal" title="Posting rule">{{ r }}</span>{% endfor %}
</h1>
<div class="flex flex-wrap items-center gap-2">
{% set toggle_base = "/c/" ~ category.slug ~ "?sort=" ~ current_sort %}{% set view_mode = "focus" %}
{% include "forum/_view_toggle.html" %}
{% if user %}
{% include "forum/_watch_button.html" %}
{% if can_create_topic %}
<a href="/c/{{ category.slug }}/new" class="btn btn-primary btn-sm"><i class="fas fa-plus mr-1"></i> New Topic</a>
{% elif create_block %}
<span class="badge badge-ghost gap-1 py-3 text-xs" data-create-block="{{ create_block.code }}"><i class="fas fa-ban opacity-60"></i>{{ create_block.message }}</span>
{% endif %}
{% endif %}
</div>
</div>
<div class="flex flex-1 flex-col gap-4 md:flex-row md:items-stretch">
{% include "forum/_rail.html" %}
<section id="focus-{{ category.slug }}" aria-label="{{ category.name }}"
data-live="category" data-live-category="{{ category.id }}"
class="min-w-0 flex-1 space-y-5 rounded-box border border-primary/40 bg-base-200/40 p-4">
<div class="flex flex-wrap items-center justify-between gap-2">
{% if category.description %}<p class="opacity-70 text-sm">{{ category.description }}</p>{% else %}<span></span>{% endif %}
<div role="tablist" class="tabs tabs-bordered w-fit" aria-label="Sort">
{% for opt in ["latest", "top", "hot", "bottom"] %}
<a role="tab" class="tab {% if current_sort == opt %}tab-active{% endif %}" aria-selected="{{ 'true' if current_sort == opt else 'false' }}"
href="/c/{{ category.slug }}?view=focus&sort={{ opt }}">{{ opt | capitalize }}</a>
{% endfor %}
</div>
</div>
{% 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 not columns %}
<p class="rounded-box border border-dashed border-base-300 p-6 text-center text-sm opacity-60">
No topics yet.{% if can_create_topic %} Be the first to post one.{% endif %}
</p>
{% endif %}
{% if columns %}
{# In focus, subcategories sit side by side as columns (pin_flip). #}
<div class="flex items-start gap-4 overflow-x-auto pb-2">
{% for col in columns %}
<section id="focus-sub-{{ col.slug }}" class="min-w-56 flex-1 basis-56 space-y-2 rounded-box border border-base-300 bg-base-100 p-3" aria-label="{{ col.name }}">
<a id="focus-link-{{ col.slug }}" href="{{ col.href }}" title="Focus on {{ col.name }}" aria-label="Focus on {{ col.name }}"
class="group flex items-center gap-1.5 text-sm font-semibold hover:text-primary focus-visible:outline-2 focus-visible:outline-primary rounded">
<span class="size-4 shrink-0 rounded-full border border-base-content/20" style="background: {{ col.widget_bg }}" aria-hidden="true"></span>
<span class="truncate">{{ col.name }}</span>
<span class="font-mono text-xs font-normal opacity-50">{{ col.count }}</span>
<i class="fas fa-up-right-and-down-left-from-center ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-60 group-focus-visible:opacity-60" aria-hidden="true"></i>
</a>
{% if col.topics %}
<div class="grid grid-cols-[repeat(auto-fill,minmax(4.5rem,1fr))] gap-1.5">
{% for t in col.topics %}{% set href = base ~ "&topic=" ~ t.id %}{% set reader_swap = true %}{% include "forum/_topic_square.html" %}{% endfor %}
</div>
{% if col.more %}<a href="{{ col.href }}" class="link link-hover text-xs opacity-70">+{{ col.more }} more</a>{% endif %}
{% else %}
<p class="text-xs opacity-50">No topics yet.</p>
{% endif %}
</section>
{% endfor %}
</div>
{% endif %}
</section>
</div>
{% include "forum/_reader.html" %}
</div>
{% endblock %}
neiam
/recourse
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
5.1 KiB · text
History
263b40b