generate subpage listings automatically

right now very barebones!

- doesn't sort pages quite correctly
- no search function
- still not sure about the UI design aspects

includes refactor of tree generation code
This commit is contained in:
りき萌 2025-01-15 20:27:00 +01:00
parent 9a86b5f98e
commit fbb9f39353
8 changed files with 508 additions and 187 deletions

View file

@ -326,7 +326,7 @@ th-bd {
/* Hide branch dates on very small displays. No clue how to fix this just yet. */
@media (max-width: 600px) {
th-bb .branch-date {
th-bd {
display: none;
}
}
@ -397,6 +397,23 @@ th-bd {
opacity: 80%;
}
/* Children containers */
.tree li.child-pages {
margin-top: 0.8rem;
padding-top: 0.8rem;
padding-bottom: 0.8rem;
border-top: 0.1rem solid var(--border-1);
& > ul {
/* Show child page lists without an indent.
Visually they belong to the root of the page. */
margin-left: 0;
padding-left: 0;
border-left: none;
}
}
/* branch-quote class for "air quote branches"; used to separate a subtree from a parent tree
stylistically such that it's interpretable as a form of block quote. */
ul.branch-quote {

View file

@ -73,9 +73,14 @@ export class Branch {
});
}
if (ulid.isCanonicalUlid(this.namedID)) {
// Adjust dates to fit the user's time zone.
let timestamp = ulid.getTimestamp(this.namedID);
// Adjust dates to fit the user's time zone.
let timestamp = null;
if (element.hasAttribute("th-ts")) {
timestamp = new Date(parseInt(element.getAttribute("th-ts")));
} else if (ulid.isCanonicalUlid(this.namedID)) {
timestamp = ulid.getTimestamp(this.namedID);
}
if (timestamp != null) {
let branchDate = this.buttonBar.getElementsByTagName("th-bd")[0];
branchDate.textContent = dateToString(timestamp);
}