diff --git a/_cms.ts b/_cms.ts index 9b12d0a..9b5ae5d 100644 --- a/_cms.ts +++ b/_cms.ts @@ -54,6 +54,19 @@ cms.document( ] ) +cms.document( + "list-anime", + "src:list-anime.md", + [ + { + name: "content", + type: "markdown", + label: "Introduction", + description: "The text to display at the top of the page." + } + ] +) + cms.collection( "games", "src:games/*.md", diff --git a/_components/AnimeTable.tsx b/_components/AnimeTable.tsx index 8dddf1e..3c59650 100644 --- a/_components/AnimeTable.tsx +++ b/_components/AnimeTable.tsx @@ -35,28 +35,28 @@ export function AnimeTable({id, anime, columns = animeRowColumnKindDefault, prio switch(column) { case "rating": return ( - + ) case "progress": return ( - - + + ) case "name": return ( - + Title ) case "namesort": return ( - + Sort by diff --git a/_includes/index.tsx b/_includes/index.tsx index 92c5b96..0c45ac3 100644 --- a/_includes/index.tsx +++ b/_includes/index.tsx @@ -3,6 +3,8 @@ import { GameData } from "../_utils/game.ts"; import { GameTable } from "../_components/GameTable.tsx"; import { compareGameProgress } from "../_utils/game.ts"; import { GlobalData } from "../_utils/site.ts"; +import { AnimeTable } from "../_components/AnimeTable.tsx"; +import { AnimeData } from "../_utils/anime.ts"; export const layout = "base.tsx"; @@ -143,6 +145,93 @@ export default function (data: GlobalData, helpers: Lume.Helpers) { ) : null; + const anime: AnimeData[] = data.search.pages("anime"); + + const active_anime = anime + .filter((ani) => ani.active) + .sort(compareDate as any); + + const active_anime_section = ( +
+

+ Now playing +

+
+ +
+
+ ); + + const top_anime = anime + .sort((a, b) => ((b.rating ?? 0) - (a.rating ?? 0))) + .slice(0, 10); + + const top_anime_section = ( +
+

+ Top anime +

+
+ +
+
+ ); + + const latest_anime = anime + .sort((a, b) => -compareDate(a, b)) + .slice(0, 10); + + const latest_anime_section = ( +
+

+ Latest updates +

+
+ +
+
+ ); + + const anime_cols = ( + anime.length > 0 + ) + ? ( +
+

+ Anime + + + {" "} + View all + + +

+ {active_anime.length > 0 && ( +
+ {active_anime_section} +
+ )} +
+ {top_anime_section} + {latest_anime_section} +
+
+ ) + : null; + return (
{intro_section} diff --git a/anime/neon-genesis-evangelion.md b/anime/neon-genesis-evangelion.md new file mode 100644 index 0000000..7f65f1c --- /dev/null +++ b/anime/neon-genesis-evangelion.md @@ -0,0 +1,8 @@ +--- +name: Neon Genesis Evangelion +name_original: Shinseiki Evangelion +active: false +rating: 0 +progress: complete +--- + diff --git a/list-anime.md b/list-anime.md new file mode 100644 index 0000000..e69de29