xonecas.io
8356
Wx

www-xonecas-io / files

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

3.6 KB
1{{define "project.html"}}{{template "head" (list .P.Name (or .P.Description (printf "%s, a project by xonecas." .P.Name)))}}{{template "nav" (dict "Here" "Projects")}}
2<main class="px-4 sm:px-8 py-6 max-w-[1440px] mx-auto">
3  <header class="flex gap-5 items-start mb-6">
4    <div class="hidden sm:block">{{template "element" (dict "El" .Row.El "Size" "lg")}}</div>
5    <div class="min-w-0">
6      <h1 class="text-4xl font-bold break-words">{{.P.Name}}</h1>
7      <p class="mt-1 text-lg">{{or .P.Description "No description"}}</p>
8      <div class="pool flex flex-wrap gap-1 mt-3">{{range .P.Tags}}{{template "tag" .}}{{end}}
9        {{range $i, $t := .P.Topics}}<a href="/projects/?q={{$t}}" title="Projects about {{$t}}" style="--i:{{$i}}" class="flex no-underline">{{template "topic" $t}}</a>{{end}}</div>
10      <p class="mt-3 text-sm text-soft">
11        <a href="commits/" class="text-ink underline underline-offset-2"><b>{{.P.Commits}}</b> commits{{if ne .P.Commits .P.Total}} of {{.P.Total}}{{end}}</a> ·
12        {{.P.First}} to {{.P.Last}} · {{.P.Files}} files
13      </p>
14    </div>
15  </header>
16  <div class="grid grid-cols-1 gap-8 lg:grid-cols-[minmax(0,1fr)_20rem]">
17    <div class="min-w-0 space-y-6">
18      {{template "file-tree" (dict "Head" .Head "Entries" .Entries)}}
19      <article class="border-[1.5px] border-edge rounded-[2px] bg-card">
20        <h2 class="px-4 py-2 border-b-[1.5px] border-edge font-mono text-sm font-semibold">{{or .P.Readme "README"}}</h2>
21        {{if .Readme}}<div class="prose max-w-none px-4 sm:px-6 py-4 overflow-x-auto">{{.Readme}}</div>
22        {{else}}<p class="px-4 py-6 font-serif italic text-soft">No README. The files above are all there is.</p>{{end}}
23      </article>
24    </div>
25    <aside class="space-y-6 text-sm">
26      <section>
27        <h2 class="font-bold border-b-[3px] border-edge pb-1 mb-2">Languages</h2>
28        {{range .P.Languages}}<div class="grid grid-cols-[6rem_1fr_2.5rem] gap-2 items-center py-0.5"><span class="truncate">{{.Name}}</span>
29          <div class="h-2.5 bg-empty rounded-[2px]"><div class="h-full bg-h3 rounded-[2px]" style="width:{{.Percent}}%"></div></div><span class="text-right text-soft">{{.Percent}}%</span></div>
30        {{else}}<p class="text-soft">None detected</p>{{end}}
31      </section>
32      <section>
33        <h2 class="font-bold border-b-[3px] border-edge pb-1 mb-2">Sources</h2>
34        {{range .P.Sources}}<div class="py-1.5 border-b border-line">
35          {{with web .URL}}<a href="https://{{.}}" class="font-semibold break-all">{{.}}</a>{{else}}<b class="font-semibold">Hosted here</b>{{end}}
36          <div class="text-soft">{{.Branch}} · {{.Commits}} commits</div>
37        </div>{{end}}
38      </section>
39      <section>
40        <h2 class="flex items-baseline justify-between font-bold border-b-[3px] border-edge pb-1 mb-2">Clone <span id="copied" class="text-xs font-normal text-soft">click to copy</span></h2>
41        <pre id="clone" title="Click to copy" class="bg-pre text-pre-fg rounded-[2px] px-4 py-3 font-mono text-[12.5px] whitespace-nowrap overflow-x-auto [scrollbar-width:thin] select-all cursor-pointer">git clone https://xonecas.io/{{.P.Name}}.git</pre>
42        <script>/* The Clipboard API needs https or localhost; elsewhere, copy the selection. */
43        clone.addEventListener("click", async () => {
44          try { await navigator.clipboard.writeText(clone.textContent); } catch { getSelection().selectAllChildren(clone); document.execCommand("copy"); }
45          copied.textContent = "copied";
46          setTimeout(() => copied.textContent = "click to copy", 1500);
47        });
48        </script>
49      </section>
50    </aside>
51  </div>
52</main>
53{{template "foot"}}{{end}}