version history MVP

implement basic version history support; there's now an icon in the footer that lets you see the previous versions and their sources
I'm a bit worried about spoilers but honestly it's yet another way to hint yourself at the cool secrets so I don't mind
This commit is contained in:
りき萌 2024-09-28 23:43:05 +02:00
parent 46dee56331
commit c58c07d846
28 changed files with 1066 additions and 330 deletions

42
template/_history.hbs Normal file
View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en-US" prefix="og: https://ogp.me/ns#">
<head>
{{> components/_head.hbs }}
<link rel="stylesheet" href="{{ asset 'css/history.css' }}">
</head>
<body>
{{#> components/_nav.hbs }}
{{/ components/_nav.hbs }}
{{> components/_noscript.hbs }}
<main class="version-history">
<p>{{ len page.commits }} commits</p>
<ul class="commits">
{{#each page.commits}}
<li>
<a class="revision-number" href="{{ ../config.site }}/{{ ../page.tree_path }}@{{ revision_number }}">#{{ revision_number }}</a>
<a href="{{ ../config.commit_base_url }}/{{ hash }}/content/{{ ../page.tree_path }}.tree"><code>{{ hash_short }}</code></a>
{{#if body}}
<details>
<summary class="summary">{{ summary }}</summary>
{{ body }}
</details>
{{else}}
<span class="summary">{{ summary }}</span>
{{/if}}
</li>
{{/each}}
</ul>
</main>
{{> components/_footer.hbs }}
</body>
</html>

View file

@ -1,49 +1,65 @@
<footer>
<a href="{{ config.site }}/treehouse">
<svg id="footer-icon" width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="all">
<mask id="mask">
<rect width="32" height="32" fill="black" />
<section id="version-info">
{{#if page.revision}}
<ul>
<li><a class="revision" href="{{ page.revision_url }}" title="permalink to this revision of the page">
revision {{ page.revision.number }}
{{#if page.revision.is_latest}}(latest){{/if}}
</a></li>
<li><a class="git" href="{{ page.source_url }}" title="source code">git <code>{{ page.revision.commit_short }}</code></a></li>
<li><a class="history" href="{{ page.history_url }}">history</a></li>
</ul>
<a class="icon-history" href="{{ page.history_url }}" title="version history"></a>
{{/if}}
</section>
<section>
<a href="{{ config.site }}/treehouse">
<svg id="footer-icon" width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="all">
<mask id="mask">
<rect width="32" height="32" fill="black" />
<clipPath id="treehouse">
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" transform="translate(0.5 12)"
d="M2.95266 3.95816C2.74074 1.83892 4.40494 0 6.53475 0C8.68036 0 10.3496 1.86501 10.1127 3.9975L10.0568 4.5L10.352 4.37352C11.7717 3.76506 13.316 4.92718 13.1244 6.45988L13.0568 7C14.1537 6.56127 15.3084 7.4907 15.1142 8.65595L15.0449 9.07153C14.7633 10.7614 13.3012 12 11.588 12H4.05892C2.0541 12 0.358966 10.5159 0.0940032 8.52866L0.0241185 8.00452C-0.210422 6.24546 1.30006 4.74903 3.05685 5L2.95266 3.95816ZM4.55685 7H2.55685V8H4.55685V7ZM4.55685 9H2.55685V10H4.55685V9ZM5.55685 7H7.55685V8H5.55685V7ZM7.55685 9H5.55685V10H7.55685V9ZM5.55685 13H7.55685L8.05685 16L9.55685 13H10.5569L9.49201 16.5495C9.21835 17.4617 9.39407 18.4496 9.96549 19.2115L10.5569 20H7.55685V18H6.55685V20H4.55685L5.35542 18.9352C5.80652 18.3338 6.01534 17.5848 5.94053 16.8367L5.55685 13Z" />
</clipPath>
<clipPath id="treehouse">
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" transform="translate(0.5 12)"
d="M2.95266 3.95816C2.74074 1.83892 4.40494 0 6.53475 0C8.68036 0 10.3496 1.86501 10.1127 3.9975L10.0568 4.5L10.352 4.37352C11.7717 3.76506 13.316 4.92718 13.1244 6.45988L13.0568 7C14.1537 6.56127 15.3084 7.4907 15.1142 8.65595L15.0449 9.07153C14.7633 10.7614 13.3012 12 11.588 12H4.05892C2.0541 12 0.358966 10.5159 0.0940032 8.52866L0.0241185 8.00452C-0.210422 6.24546 1.30006 4.74903 3.05685 5L2.95266 3.95816ZM4.55685 7H2.55685V8H4.55685V7ZM4.55685 9H2.55685V10H4.55685V9ZM5.55685 7H7.55685V8H5.55685V7ZM7.55685 9H5.55685V10H7.55685V9ZM5.55685 13H7.55685L8.05685 16L9.55685 13H10.5569L9.49201 16.5495C9.21835 17.4617 9.39407 18.4496 9.96549 19.2115L10.5569 20H7.55685V18H6.55685V20H4.55685L5.35542 18.9352C5.80652 18.3338 6.01534 17.5848 5.94053 16.8367L5.55685 13Z" />
</clipPath>
<clipPath id="rectangleClip">
<rect id="rectangle1" width="16" height="16" />
</clipPath>
<clipPath id="rectangleClip">
<rect id="rectangle1" width="16" height="16" />
</clipPath>
<clipPath id="rectangleTreehouseClip" clip-path="url(#treehouse)">
<rect id="rectangle2" width="16" height="16" />
</clipPath>
<clipPath id="rectangleTreehouseClip" clip-path="url(#treehouse)">
<rect id="rectangle2" width="16" height="16" />
</clipPath>
<g transform="translate(3 0)">
<rect width="32" height="32" fill="white" clip-path="url(#treehouse)" />
<rect width="32" height="32" fill="white" clip-path="url(#rectangleClip)" />
<rect width="32" height="32" fill="black" clip-path="url(#rectangleTreehouseClip)" />
</g>
</mask>
<g transform="translate(3 0)">
<rect width="32" height="32" fill="white" clip-path="url(#treehouse)" />
<rect width="32" height="32" fill="white" clip-path="url(#rectangleClip)" />
<rect width="32" height="32" fill="black" clip-path="url(#rectangleTreehouseClip)" />
</g>
</mask>
<rect width="32" height="32" fill="currentColor" mask="url(#mask)" />
</g>
<rect width="32" height="32" fill="currentColor" mask="url(#mask)" />
</g>
<style>
#rectangle1,
#rectangle2 {
transform: translate(16px, 12px) rotate(15deg) translate(-8px, -8px);
rx: 0px;
transition: all 1s;
}
<style>
#rectangle1,
#rectangle2 {
transform: translate(16px, 12px) rotate(15deg) translate(-8px, -8px);
rx: 0px;
transition: all 1s;
}
#all:hover #rectangle1,
#all:hover #rectangle2 {
transform: translate(22px, 24px) rotate(360deg) translate(-2px, -2px);
width: 4px;
height: 4px;
rx: 4px;
}
</style>
</svg>
</a>
#all:hover #rectangle1,
#all:hover #rectangle2 {
transform: translate(22px, 24px) rotate(360deg) translate(-2px, -2px);
width: 4px;
height: 4px;
rx: 4px;
}
</style>
</svg>
</a>
</section>
</footer>

View file

@ -7,6 +7,7 @@
<link rel="preload" href="{{ asset 'font/Recursive_VF_1.085.woff2' }}" as="font" type="font/woff2"
crossorigin="anonymous">
<link rel="stylesheet" href="{{ asset 'css/main.css' }}">
<link rel="stylesheet" href="{{ asset 'css/icons.css' }}">
<link rel="stylesheet" href="{{ asset 'css/tree.css' }}">
{{!-- Import maps currently don't support the src="" attribute. Unless we come up with something