import {formatDateIso} from "../_utils/date.ts"
import {AnimeData, AnimeIdentifier, 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 nameOriginalRow = data.name_original ? (
{data.name_original}
) : null
const nameSeparator = (data.name_original) ?
: 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
const milestonesSeparator = ((data.identifiers?.length ?? 0) > 0) ?
: null
const identifiersRows = data.identifiers?.map((identifier: AnimeIdentifier, index: number) => {
switch(identifier.type) {
case "wikidata":
return (
Wikidata}
>
Q{identifier.q}
)
case "anidb":
return (
AniDB}
>
{identifier.aid}
)
case "mal":
return (
MAL}
>
{identifier.id}
)
case "ann":
return (
ANN}
>
{identifier.id}
)
case "anilist":
return (
Anilist}
>
{identifier.id}
)
}
})
return (
{dateRow}
{dateSeparator}
{nameOriginalRow}
{nameSeparator}
{progressRow}
{playedSeparator}
{purchasedOnRow}
{startedOnRow}
{completedOnRow}
{masteredOnRow}
{milestonesSeparator}
{identifiersRows}
>}
>
{data.children}
)
}