diff --git a/astro.config.ts b/astro.config.ts index e6a750d..56e204b 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -27,5 +27,5 @@ export default defineConfig({ integrations: [ mdx(), solid(), - ], + ] }); diff --git a/markdoc.config.mjs b/markdoc.config.mjs deleted file mode 100644 index 2391f8d..0000000 --- a/markdoc.config.mjs +++ /dev/null @@ -1,14 +0,0 @@ -import { defineMarkdocConfig } from '@astrojs/markdoc/config'; -import Lyrics from './src/components/markdown/lyrics/Lyrics.astro'; - - -export default defineMarkdocConfig({ - tags: { - lyrics: { - render: Lyrics, - attributes: { - type: { type: String }, - } - } - } -}) diff --git a/src/components/markdown/Album.astro b/src/components/markdown/Album.astro new file mode 100644 index 0000000..f2b5958 --- /dev/null +++ b/src/components/markdown/Album.astro @@ -0,0 +1,15 @@ +--- +interface Props { + album: { + title: string; + cover: string; + url: string; + } +} + +const { album } = Astro.props; +--- + + +
{album.title}
+
diff --git a/src/components/markdown/Song.astro b/src/components/markdown/Song.astro index 86f6903..3999246 100644 --- a/src/components/markdown/Song.astro +++ b/src/components/markdown/Song.astro @@ -5,7 +5,7 @@ interface Props { title: string; cat: string; track: number; - circle: string; + name: string; composer?: string; lyrics?: string; vocal?: string[]; @@ -33,7 +33,7 @@ const { metadata } = Astro.props; Circle - {metadata.circle} + {metadata.name} Composer diff --git a/src/content/_templates/_song.md b/src/content/_templates/_song.md new file mode 100644 index 0000000..f335e2e --- /dev/null +++ b/src/content/_templates/_song.md @@ -0,0 +1,12 @@ +--- +title: Title +composer: Composer +lyrics: Lirycist +origin: + - Original title +album: + ARCD0051: + track: 7 + vocal: + - Vocalist +--- diff --git a/src/content/songs/arcd0054/beautiful sky.md b/src/content/songs/arcd0054/beautiful sky.md new file mode 100644 index 0000000..0ff9fdc --- /dev/null +++ b/src/content/songs/arcd0054/beautiful sky.md @@ -0,0 +1,13 @@ +--- +slug: beautiful-sky +title: Beautiful Sky +composer: Masayoshi Minoshima +lyrics: Mei Ayakura +origin: + - U.N.オーエンは彼女なのか? +album: + ARCD0054: + track: 2 + vocal: + - nachi +--- diff --git a/src/content/songs/dont-lose.md b/src/content/songs/arcd0054/dont-lose.md similarity index 92% rename from src/content/songs/dont-lose.md rename to src/content/songs/arcd0054/dont-lose.md index 4ef1178..97a591f 100644 --- a/src/content/songs/dont-lose.md +++ b/src/content/songs/arcd0054/dont-lose.md @@ -1,10 +1,13 @@ --- +slug: dont-lose title: "Don't lose" origin: - 亡き王女の為のセプテット album: ARCD0054: track: 7 + vocal: + - nomico --- # Japanese diff --git a/src/content/songs/dream-again.md b/src/content/songs/arcd0054/dream-again.md similarity index 51% rename from src/content/songs/dream-again.md rename to src/content/songs/arcd0054/dream-again.md index 9b59ac9..6a628ee 100644 --- a/src/content/songs/dream-again.md +++ b/src/content/songs/arcd0054/dream-again.md @@ -1,12 +1,22 @@ --- +slug: dream-again title: "Dream Again" +composer: Camellia +lyrics: Camellia origin: - the Last Judgment album: ARCD0054: track: 5 + vocal: + - Mei Ayakura --- # Japanese +- 秒針の音が響空間 狭くて安心するほど +- 割り込んだ感覚に目を閉じる 光がまた眩かしすぎて + - どこまでも続いていく階段 [降]{くだ}った途方もないほど - 行きたい場所はもう決まっている 幻想の声のする所 + +- 夢溢れる海へ \ No newline at end of file diff --git a/src/content/songs/black-eyes.md b/src/content/songs/black-eyes.md index 5ac778f..ea1762a 100644 --- a/src/content/songs/black-eyes.md +++ b/src/content/songs/black-eyes.md @@ -1,4 +1,5 @@ --- +slug: black-eyes title: Black Eyes composer: Kirin (EastNewSound) lyrics: Mei Ayakura diff --git a/src/data/circles.json b/src/data/circles.json index dd3cd29..226f837 100644 --- a/src/data/circles.json +++ b/src/data/circles.json @@ -1,5 +1,6 @@ { - "Alstroemeria Records": { + "alstroemeria-records": { + "name": "Alstroemeria Records", "albums": { "ARCD0051": { "title": "Engaged Dancehall", diff --git a/src/pages/songs/[circle].astro b/src/pages/songs/[circle].astro new file mode 100644 index 0000000..1825c84 --- /dev/null +++ b/src/pages/songs/[circle].astro @@ -0,0 +1,39 @@ +--- +import Base from "@layouts/Base.astro"; +import Album from "@components/markdown/Album.astro"; +import Header from "@components/headers/Base.astro"; +import { CIRCLES } from "@utils/songs/data"; + + +export async function getStaticPaths() { + return Object.keys(CIRCLES) + .map(circle => ({ + params: { circle }, + props: { albums: CIRCLES[circle].albums } + })) +} + +interface Props { + albums: typeof CIRCLES[string]['albums']; +} + +const circle = Astro.params.circle!; +const albums = Astro.props.albums; +const items = Object.keys(albums) + .map(slug => ({ + title: albums[slug].title, + cover: albums[slug].cover, + url: `/songs/${circle}/${slug}/` + })) +--- + + +
+
+
+
+ {items.map(album => )} +
+
+
+ diff --git a/src/pages/songs/[cat].astro b/src/pages/songs/[circle]/[cat].astro similarity index 67% rename from src/pages/songs/[cat].astro rename to src/pages/songs/[circle]/[cat].astro index 7dae01c..a44b998 100644 --- a/src/pages/songs/[cat].astro +++ b/src/pages/songs/[circle]/[cat].astro @@ -1,8 +1,8 @@ --- -import Base from "../../layouts/Base.astro"; -import Header from '../../components/headers/Base.astro'; +import Base from "@layouts/Base.astro"; +import Header from '@components/headers/Base.astro'; import { CollectionEntry, getCollection } from 'astro:content'; -import { ALBUMS, getAllCats } from "../../utils/songs/data"; +import { ALBUMS, getAllCats, order } from "@utils/songs/data"; export async function getStaticPaths() { @@ -10,11 +10,15 @@ export async function getStaticPaths() { const cats = getAllCats(songs); return [...cats].map(cat => ({ - params: {cat}, + params: { circle: ALBUMS[cat].circle, cat }, props: { songs: songs .filter(entry => cat in entry.data.album) - .map(song => ({ frontmatter: song.data, slug: `/songs/${cat}/${song.slug}/` })) + .sort(order(cat)) + .map(song => ({ + frontmatter: song.data, + slug: `/songs/${ALBUMS[cat].circle}/${cat}/${song.slug}/` + })) } })) } @@ -34,7 +38,7 @@ const album = ALBUMS[cat!];
-
+
{songs.map(song => [ {song.frontmatter.album[cat!].track} diff --git a/src/pages/songs/[...slug].astro b/src/pages/songs/[circle]/[cat]/[song].astro similarity index 73% rename from src/pages/songs/[...slug].astro rename to src/pages/songs/[circle]/[cat]/[song].astro index bfccf6e..9eae3ca 100644 --- a/src/pages/songs/[...slug].astro +++ b/src/pages/songs/[circle]/[cat]/[song].astro @@ -1,15 +1,18 @@ --- -import Base from "../../layouts/Base.astro"; -import Song from "../../components/markdown/Song.astro"; -import Lyrics from "../../components/markdown/Lyrics.astro"; +import Base from "@layouts/Base.astro"; +import Song from "@components/markdown/Song.astro"; +import Lyrics from "@components/markdown/Lyrics.astro"; import { CollectionEntry, getCollection } from "astro:content"; -import { ALBUMS } from "../../utils/songs/data"; +import { ALBUMS } from "@utils/songs/data"; export async function getStaticPaths() { return (await getCollection('songs')) .map(song => Object.keys(song.data.album) - .map(cat => ({ params: {slug: `${cat}/${song.slug}`}, props: {song, cat} }))) + .map(cat => ({ + params: { circle: ALBUMS[cat].circle, cat, song: song.slug}, + props: { song, cat } + }))) .flat() } diff --git a/src/pages/songs/index.astro b/src/pages/songs/index.astro index 1d98428..6688e79 100644 --- a/src/pages/songs/index.astro +++ b/src/pages/songs/index.astro @@ -1,16 +1,11 @@ --- import List from "../../layouts/List.astro"; -import { getCollection } from 'astro:content'; -import { ALBUMS, getAllCats } from "../../utils/songs/data"; +import { CIRCLES } from "../../utils/songs/data"; -const pages = [...getAllCats(await getCollection('songs'))] - .sort((a, b) => a < b ? 1 : -1) - .map(catalog => ({ - title: `${catalog} - ${ALBUMS[catalog].title}`, - slug: `/songs/${catalog}/` - })); - +const pages = Object.keys(CIRCLES) + .map(slug => ({ title: CIRCLES[slug].name, slug: `/songs/${slug}/` })) + .sort((a, b) => a.title < b.title ? -1 : 1) --- - + diff --git a/src/schema.d.ts b/src/schema.d.ts index cdba219..e529499 100644 --- a/src/schema.d.ts +++ b/src/schema.d.ts @@ -1,9 +1,10 @@ /** @file src/data/circles.json */ interface CirclesSchema { - /** Circle name */ + /** slug */ [key: string]: { + name: string, albums: { - /** Catalog number */ + /** catalog number */ [key: string]: { title: string; cover: string; diff --git a/src/styles/components/_album.scss b/src/styles/components/_album.scss new file mode 100644 index 0000000..faf7283 --- /dev/null +++ b/src/styles/components/_album.scss @@ -0,0 +1,16 @@ +.c-album { + padding: 0.5em; + background-color: white; + border-radius: 0.5em; + box-shadow: var(--shadow-l); + transition: box-shadow ease-in-out 0.2s; + text-decoration: none; + + &:hover { + box-shadow: var(--shadow-m); + } + + &__image { + width: 16em; + } +} diff --git a/src/styles/layouts/_songs.scss b/src/styles/layouts/_songs.scss index e48eef9..487a81b 100644 --- a/src/styles/layouts/_songs.scss +++ b/src/styles/layouts/_songs.scss @@ -1,3 +1,14 @@ +.l-album-grid { + display: flex; + flex-wrap: wrap; + gap: 2em; + + &__item img { + width: 20em; + height: 20em; + } +} + .l-songs-cat { padding: 1.5em; diff --git a/src/styles/styles.scss b/src/styles/styles.scss index 4942729..411faa2 100644 --- a/src/styles/styles.scss +++ b/src/styles/styles.scss @@ -11,6 +11,7 @@ @use 'components/tab'; @use 'components/lyrics'; @use 'components/song'; +@use 'components/album'; // Partials @use 'partials/nav'; diff --git a/src/utils/songs/data.ts b/src/utils/songs/data.ts index d836f39..a547c79 100644 --- a/src/utils/songs/data.ts +++ b/src/utils/songs/data.ts @@ -6,8 +6,10 @@ type Song = CollectionEntry<'songs'>; interface Metadata { [key: string]: { + /** Circle slug */ + circle: string; /** Circle name */ - circle: string, + name: string, /** Album title */ title: string, /** Path to album cover image */ @@ -16,6 +18,10 @@ interface Metadata { } +export function order(cat: string) { + return (a: Song, b: Song) => a.data.album[cat].track < b.data.album[cat].track ? -1 : 1; +} + export function getAllCats(songs: Song[]): Set { return songs.reduce( (cats, next) => ( @@ -32,10 +38,10 @@ function createMetadata(circles: CirclesSchema): Metadata { for (const circle of Object.keys(circles)) { const data = circles[circle]; for (const cat of Object.keys(data.albums)) - metadata[cat] = { circle, ...data.albums[cat] } + metadata[cat] = { circle, name: data.name, ...data.albums[cat] } } return metadata; } - +export const CIRCLES: CirclesSchema = circles; export const ALBUMS: Metadata = createMetadata(circles); diff --git a/src/utils/songs/parse.ts b/src/utils/songs/parse.ts index 060484c..722be22 100644 --- a/src/utils/songs/parse.ts +++ b/src/utils/songs/parse.ts @@ -15,6 +15,7 @@ function increaseStack(data: Stack, lang: string) { function fromMarkdown(markdown: string): Stack { const stack: Stack = {}; + if (!markdown) return stack; let space = true; let lang = ''; diff --git a/tsconfig.json b/tsconfig.json index 274a65c..2380170 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,12 @@ "compilerOptions": { "allowJs": true, "jsx": "preserve", - "jsxImportSource": "solid-js" - } + "jsxImportSource": "solid-js", + "baseUrl": "src", + "paths": { + "@layouts/*": ["layouts/*"], + "@components/*": ["components/*"], + "@utils/*": ["utils/*"], + } + }, } \ No newline at end of file