From dca878308ddb0ced154e166ba0ec34ac688ff727 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 5 Nov 2024 13:25:02 +0100 Subject: [PATCH] Create single anime page --- _includes/anime.tsx | 112 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 _includes/anime.tsx diff --git a/_includes/anime.tsx b/_includes/anime.tsx new file mode 100644 index 0000000..f51125e --- /dev/null +++ b/_includes/anime.tsx @@ -0,0 +1,112 @@ +import {formatDateIso} from "../_utils/date.ts" +import {AnimeData, AnimeProgress, animeProgressToClassName, animeProgressToIconDef, animeProgressToTitle} from "../_utils/anime.ts" +import {ReviewInfo} from "../_components/ReviewInfo.tsx" + + +export const layout = "base.tsx" + +export default function(data: AnimeData, helpers: Lume.Helpers) { + const dateRow = ( + + {formatDateIso(data.date)} + + ) + + const dateSeparator = (data.progress || data.hours_played) ?
: null + + const progressRow = data.progress ? ( + } + > + + {animeProgressToTitle(data.progress)} + + {data.active && + <> + ,  + now watching + + } + + ) : null + + const playedSeparator = (data.started_on || data.completed_on || data.mastered_on) ?
: null + + const purchasedOnValue = formatDateIso(data.purchased_on) + const purchasedOnRow = purchasedOnValue ? ( + } + > + + + ) : null + + const startedOnValue = formatDateIso(data.started_on) + const startedOnRow = startedOnValue ? ( + } + > + + + ) : null + + const completedOnValue = formatDateIso(data.completed_on) + const completedOnRow = completedOnValue ? ( + } + > + + + ) : null + + const masteredOnValue = formatDateIso(data.mastered_on) + const masteredOnRow = masteredOnValue ? ( + } + > + + + ) : null + + return ( +
+ + {dateRow} + {dateSeparator} + {progressRow} + {playedSeparator} + {purchasedOnRow} + {startedOnRow} + {completedOnRow} + {masteredOnRow} + } + > + {data.children} + +
+ ) +}