revamp the way page:treehouse/new works

- treehouse/new is now a regular page, not a special template
- most of the code related to the `new` badge in page:index has been removed
- you're meant to discern between pages you've read vs ones you haven't by looking at the colors of the links (blue vs purple)
This commit is contained in:
りき萌 2024-11-12 19:49:57 +01:00
parent 8d1deee626
commit e201ea7058
6 changed files with 128 additions and 362 deletions

View file

@ -1,72 +0,0 @@
<!DOCTYPE html>
<html lang="en-US" prefix="og: https://ogp.me/ns#">
<head>
{{> components/_head.hbs }}
</head>
<body>
{{#> components/_nav.hbs }}
{{!-- For /index, include a "new" link that goes to the curated news feed page. --}}
{{#if (eq page.tree_path "index")}}
<a href="{{ config.site }}/treehouse/new" data-cast="new">new</a>
{{/if}}
{{/ components/_nav.hbs }}
{{> components/_noscript.hbs }}
<section>
<p>welcome!</p>
<p>since you clicked here, you must be curious as to what's been going on since your last visit to the house. so
here's a recap just for you - enjoy!</p>
</section>
{{> components/_tree.hbs }}
<section>
<p>note that this page does not include any updates that were made to the website itself - for that, you can
visit <a href="{{ config.site }}/treehouse/changelog">the changelog</a>.
</p>
</section>
<section class="settings" data-cast="js">
<details>
<summary>
settings
</summary>
<section>
<p>if you find the newsfeed annoying, you can customize some aspects of it.</p>
<p>
<input type="checkbox" data-cast="setting-checkbox" id="showNewPostIndicator">
<label for="showNewPostIndicator">show the <span class="badge red">1</span> badge on the homepage
for
new posts you haven't read yet</label>
</p>
<p>
<button id="mark-all-as-unread"
title="Mostly useful for debugging purposes, but it's there if you really wanna do it.">
mark all as unread</button>
</p>
</section>
</details>
</section>
{{!-- For all pages except the one linked from the footer, include the footer icon. --}}
{{#if (ne page.tree_path "treehouse")}}
{{> components/_footer.hbs }}
{{/if}}
<script type="module" defer>
import { initNewsPage, markAllAsUnread } from "{{ config.site }}/static/js/news.js";
initNewsPage();
document.getElementById("mark-all-as-unread").addEventListener("click", () => {
markAllAsUnread();
alert("congration! you done it");
});
</script>
</body>
</html>

View file

@ -18,7 +18,6 @@ clever to do while browser vendors figure that out, we'll just have to do a cach
<script>
const TREEHOUSE_SITE = `{{ config.site }}`;
const TREEHOUSE_NEWS_COUNT = {{ len feeds.news.branches }};
{{!-- Yeah, this should probably be solved in a better way somehow.
For now this is used to allow literate-programming.js to refer to syntax files with the ?cache attribute,
@ -35,7 +34,6 @@ clever to do while browser vendors figure that out, we'll just have to do a cach
import "treehouse/settings.js";
import "treehouse/tree.js";
import "treehouse/emoji.js";
import "treehouse/news.js";
</script>
<meta property="og:site_name" content="{{ config.user.title }}">

View file

@ -3,17 +3,3 @@
{{{ include_static 'svg/object/logo.svg' }}}
</a>
</nav>
{{!--
I don't have any idea where to put this right now.
There's no obvious place, and even when it is there, I hate the hideous red badge on new entries.
No time to figure it out. Will do later.
{{#if (eq page.tree_path 'index')}}
<nav id="nav-links">
<a href="{{ config.site }}/treehouse/new" data-cast="new">new</a>
</nav>
{{/if}}
--}}