xonecas.io
8356
Wx

www-xonecas-io / files

www-xonecas-io / internal / site / templates / projects.html

2.7 KB
1{{define "projects.html"}}{{template "head" (list "Projects" (printf "All %d public projects by xonecas, by tag, topic, activity and name." .Total))}}{{template "nav" (dict "Here" "Projects" "Q" .Q "Filter" true)}}
2<main class="px-4 sm:px-8 py-6 max-w-[1440px] mx-auto">
3  <h1 class="text-3xl font-bold mb-4"><span id="shown">{{.Matches}}</span> projects</h1>
4  {{/* Each change asks the server for this page again, and swaps in the matches, the count and the range. */}}
5  <form id="filters" action="/projects/" hx-get="/projects/" hx-trigger="input delay:150ms, input delay:150ms from:#q, submit"
6    hx-target="#results" hx-select="#results" hx-select-oob="#shown,#span,#bars" hx-swap="outerHTML" class="flex flex-wrap items-center gap-x-6 gap-y-2 mb-4 text-sm">
7    <p class="w-full -mt-3 font-serif italic text-soft text-[15.5px]">Pick tags to narrow the list. Both tags of a pair keep both.</p>
8    {{range .Pairs}}<fieldset class="flex gap-1">{{range .}}
9      <label class="cursor-pointer rounded-[2px] has-checked:bg-accent has-checked:text-paper"><input type="checkbox" name="tag" value="{{.Name}}" class="sr-only peer"{{if .On}} checked{{end}}>
10        <span class="flex items-center peer-focus-visible:outline-2 outline-accent rounded-[2px]">{{template "tag" .Name}}<span class="px-1.5 font-mono text-xs">{{.Count}}</span></span></label>{{end}}
11    </fieldset>{{end}}
12    <fieldset class="flex items-center gap-3 sm:ml-auto"><span class="text-soft">Sort</span>
13      {{range list "recent" "oldest" "commits"}}<label class="cursor-pointer font-semibold has-checked:underline underline-offset-4 decoration-2"><input type="radio" name="sort" value="{{.}}" class="sr-only"{{if eq . $.Sort}} checked{{end}}>{{.}}</label>{{end}}
14    </fieldset>
15    {{with .Bars}}<div class="w-full"><div class="flex items-baseline justify-between mb-1"><span class="text-soft">Active projects by month</span><output id="span" class="font-mono text-xs font-semibold">{{$.Span}}</output></div>
16      <div class="range"><div id="bars">{{range .}}<i title="{{.Month}}: {{.Count}} active" style="height:{{.Height}}%"{{if .On}} class="on"{{end}}></i>{{end}}</div>
17        <input type="range" name="from" min="0" max="{{dec (len .)}}" value="{{$.From}}" aria-label="From month"><input type="range" name="to" min="0" max="{{dec (len .)}}" value="{{$.To}}" aria-label="To month"></div>
18    </div>{{end}}
19    <noscript><button class="px-3 py-1 border-[1.5px] border-edge rounded-[2px] font-semibold cursor-pointer">Filter</button></noscript>
20  </form>
21  <div id="results">
22    <ol>{{range .Rows}}<li>{{template "project-row" .}}</li>{{end}}</ol>
23    {{if not .Rows}}<p class="py-6 text-soft">No project matches.</p>{{end}}
24    {{template "pager" .Pager}}
25  </div>
26</main>
27{{template "foot"}}{{end}}