import {formatDateIso} from "../_utils/date.ts"
import {GameData, GameIdentifier} from "../_utils/game.ts"
import {GameProgress, gameProgressToClassName, gameProgressToIconDef, gameProgressToTitle} from "../_utils/game.ts"
import {ReviewInfo} from "../_components/ReviewInfo.tsx"
export const layout = "base.tsx"
export default function(data: GameData, helpers: Lume.Helpers) {
const dateRow = (
{formatDateIso(data.date)}
)
const dateSeparator = (data.progress || data.hours_played) ?
: null
const progressRow = data.progress ? (
}
>
{gameProgressToTitle(data.progress)}
{data.active &&
<>
,
now playing
>
}
) : null
const hoursPlayedRow = data.hours_played ? (
{data.hours_played}
h
) : null
const playedSeparator = (data.purchased_on || data.started_on || data.beaten_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 beatenOnValue = formatDateIso(data.beaten_on)
const beatenOnRow = beatenOnValue ? (
}
>
) : 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: GameIdentifier, index: number) => {
switch(identifier.type) {
case "steam":
return (
Steam}
>
{identifier.name ?? identifier.appid}
)
}
})
return (
{dateRow}
{dateSeparator}
{progressRow}
{hoursPlayedRow}
{playedSeparator}
{purchasedOnRow}
{startedOnRow}
{beatenOnRow}
{completedOnRow}
{masteredOnRow}
{milestonesSeparator}
{identifiersRows}
>}
>
{data.children}
)
}