(wiki) cleanup
This commit is contained in:
parent
c3e732303c
commit
210b5ef8a5
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
interface MenuItem {
|
||||
identifier: string;
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
@ -8,42 +7,34 @@ interface MenuItem {
|
|||
/** Config for the menu displayed in site navbar. */
|
||||
const menu: MenuItem[] = [
|
||||
{
|
||||
identifier: 'posts',
|
||||
name: 'Posts',
|
||||
url: '/posts/',
|
||||
},
|
||||
{
|
||||
identifier: 'repos',
|
||||
name: 'Repos',
|
||||
url: '/repos/',
|
||||
},
|
||||
{
|
||||
identifier: 'slides',
|
||||
name: 'Slides',
|
||||
url: '/slides/',
|
||||
},
|
||||
{
|
||||
identifier: 'aoc',
|
||||
name: 'AoC',
|
||||
url: '/aoc/',
|
||||
name: 'Wiki',
|
||||
url: '/wiki/',
|
||||
},
|
||||
{
|
||||
identifier: 'songs',
|
||||
name: 'Songs',
|
||||
url: '/songs/',
|
||||
},
|
||||
{
|
||||
identifier: 'map',
|
||||
name: 'Map',
|
||||
url: '/map/',
|
||||
},
|
||||
{
|
||||
identifier: 'about',
|
||||
name: 'About',
|
||||
url: '/about/',
|
||||
},
|
||||
{
|
||||
identifier: 'search',
|
||||
name: 'Search',
|
||||
url: '/search/'
|
||||
}
|
||||
|
|
|
@ -5,19 +5,20 @@ import type { Maybe } from "purify-ts";
|
|||
|
||||
|
||||
interface Props {
|
||||
heading: string;
|
||||
tree: Tree;
|
||||
slug: string;
|
||||
prefix: Maybe<string>;
|
||||
}
|
||||
|
||||
const { tree, slug, prefix } = Astro.props;
|
||||
const { heading, tree, slug, prefix } = Astro.props;
|
||||
---
|
||||
|
||||
<aside class="link-tree">
|
||||
<h2 class="link-tree__heading">
|
||||
{prefix.map(pathify).mapOrDefault(href =>
|
||||
<a class="link-tree__heading-text" href={href}>Personal wiki</a>,
|
||||
<span class="link-tree__heading-text">Personal Wiki</span>
|
||||
<a class="link-tree__heading-text" href={href}>{heading}</a>,
|
||||
<span class="link-tree__heading-text">{heading}</span>
|
||||
)}
|
||||
</h2>
|
||||
<nav class="link-tree__nav">
|
||||
|
|
|
@ -9,16 +9,6 @@ export const collections = {
|
|||
tags: z.array(z.string()).optional(),
|
||||
})
|
||||
}),
|
||||
aoc: defineCollection({
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
date: z.date(),
|
||||
day: z.number(),
|
||||
stars: z.number(),
|
||||
math: z.boolean().optional(),
|
||||
tags: z.array(z.string()).optional(),
|
||||
})
|
||||
}),
|
||||
slides: defineCollection({
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
title: Quotes
|
||||
date: 2023-05-01
|
||||
---
|
||||
|
||||
A collection of quotes I've found pretty memorable.
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
title: Recommended reading
|
||||
date: 2023-06-01T20:02:20.239Z
|
||||
title: Recommended Reading
|
||||
---
|
||||
|
||||
## Programming
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
title: "TypeScript"
|
||||
slug: "typescript"
|
||||
---
|
||||
Hello
|
|
@ -4,7 +4,7 @@ title: "Type Challenges"
|
|||
|
||||
## 4・Pick
|
||||
|
||||
> Implement the built-in `Pick<T, K>` generic without using it. Constructs a type by picking the set of properties `K` from `T`.
|
||||
Implement the built-in `Pick<T, K>` generic without using it. Constructs a type by picking the set of properties `K` from `T`.
|
||||
|
||||
```ts
|
||||
type MyPick<T, K extends keyof T> = {
|
||||
|
@ -15,7 +15,7 @@ type MyPick<T, K extends keyof T> = {
|
|||
|
||||
## 7・Readonly
|
||||
|
||||
> Implement the built-in `Readonly<T>` generic without using it. Constructs a type with all properties of T set to readonly, meaning the properties of the constructed type cannot be reassigned.
|
||||
Implement the built-in `Readonly<T>` generic without using it. Constructs a type with all properties of T set to readonly, meaning the properties of the constructed type cannot be reassigned.
|
||||
|
||||
```ts
|
||||
type MyReadonly<T> = {
|
||||
|
@ -26,7 +26,7 @@ type MyReadonly<T> = {
|
|||
|
||||
## 11・Tuple to Object
|
||||
|
||||
> Given an array, transform it into an object type and the key/value must be in the provided array.
|
||||
Given an array, transform it into an object type and the key/value must be in the provided array.
|
||||
|
||||
```ts
|
||||
type TupleToObject<T extends readonly (string | number)[]> = {
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
---
|
||||
import Article from '../../layouts/Article.astro';
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
return (await getCollection('aoc'))
|
||||
.map(entry => ({params: {slug: entry.slug}, props: {entry}}));
|
||||
}
|
||||
|
||||
const { entry } = Astro.props;
|
||||
const { Content, headings } = await entry.render();
|
||||
---
|
||||
<Article frontmatter={entry.data} headings={headings}>
|
||||
<Content />
|
||||
</Article>
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
import List from '../../layouts/List.astro';
|
||||
import { getCollection } from 'astro:content';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
|
||||
export async function getStaticPaths () {
|
||||
return [...new Set((await getCollection('aoc')).map(e => e.slug.slice(0, 4)))]
|
||||
.map(year => ({params: {year}, props: {year}}))
|
||||
}
|
||||
|
||||
const { year } = Astro.props;
|
||||
const content = await getCollection('aoc', (entry) => entry.id.startsWith(year));
|
||||
|
||||
const pages = content
|
||||
.map(doc => ({
|
||||
title: `Day ${doc.data.day}`,
|
||||
slug: `/aoc/${doc.slug}/`,
|
||||
date: dayjs(doc.data.date),
|
||||
}));
|
||||
|
||||
---
|
||||
|
||||
<List title={year} pages={pages} />
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
import List from '../../layouts/List.astro';
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
|
||||
const content = await getCollection('aoc');
|
||||
const occ: {[key: string]: number} = {}
|
||||
|
||||
for (const doc of content) {
|
||||
const year = doc.slug.slice(0, 4);
|
||||
(year in occ) ? occ[year] += 1 : occ[year] = 1;
|
||||
}
|
||||
|
||||
const pages = Object.entries(occ)
|
||||
.map(([year, occ]) => ({
|
||||
title: `${year} - ${occ} days`,
|
||||
slug: `/aoc/${year}/`,
|
||||
}));
|
||||
---
|
||||
|
||||
<List title="Advent of Code" pages={pages} />
|
|
@ -21,8 +21,9 @@ const { Content } = await entry.render();
|
|||
|
||||
<Base>
|
||||
<main class="main-wiki">
|
||||
<Tree tree={tree} slug={entry.slug} prefix={Maybe.of("/wiki/")}/>
|
||||
<article>
|
||||
<Tree heading="Personal Wiki" tree={tree} slug={entry.slug} prefix={Maybe.of("/wiki/")}/>
|
||||
<article class="markdown">
|
||||
<h1>{entry.data.title}</h1>
|
||||
<Content />
|
||||
</article>
|
||||
</main>
|
||||
|
|
|
@ -10,7 +10,7 @@ const tree = collapse(await getCollection('wiki'));
|
|||
|
||||
<Base>
|
||||
<main class="main-wiki">
|
||||
<Tree tree={tree} slug="wiki" prefix={Maybe.of("wiki")} />
|
||||
<Tree heading="Personal Wiki" tree={tree} slug="wiki" prefix={Maybe.of("wiki")} />
|
||||
<article>
|
||||
siema
|
||||
</article>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.main-wiki {
|
||||
display: grid;
|
||||
grid-template-columns: 16em 1fr;
|
||||
grid-template-columns: 16em 1fr 16em;
|
||||
}
|
||||
|
||||
.link-tree {
|
||||
|
@ -8,7 +8,8 @@
|
|||
overflow-y: auto;
|
||||
|
||||
&__heading {
|
||||
border-bottom: 1px solid black;
|
||||
border-bottom: 1px solid;
|
||||
border-image: linear-gradient(to right, transparent, var(--c-primary), transparent) 1;
|
||||
|
||||
&-text {
|
||||
display: block;
|
||||
|
|
Loading…
Reference in a new issue