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} + +
+ ) +}