From 110c7abec92b52ba48e5225e3ef3f59b7eb69b95 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 4 Jul 2024 06:10:54 +0200 Subject: [PATCH] Fix CMS not understanding identifier kinds --- _cms.ts | 8 +------- _includes/game.tsx | 2 +- _scripts/importSteam.ts | 6 +++--- _utils/game.ts | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/_cms.ts b/_cms.ts index 40b2747..d300668 100644 --- a/_cms.ts +++ b/_cms.ts @@ -184,14 +184,8 @@ cms.collection( name: "steam", type: "object", label: "Steam", - description: "", + description: "The game, as it is available on Steam.", fields: [ - { - name: "platform", - type: "hidden", - label: "Platform", - value: "steam", - }, { name: "appid", type: "text", diff --git a/_includes/game.tsx b/_includes/game.tsx index e97e4fa..62edb29 100644 --- a/_includes/game.tsx +++ b/_includes/game.tsx @@ -119,7 +119,7 @@ export default function(data: GameData, helpers: Lume.Helpers) { const milestonesSeparator = ((data.identifiers?.length ?? 0) > 0) ?
: null const identifiersRows = data.identifiers?.map((identifier: GameIdentifier, index: number) => { - switch(identifier.platform) { + switch(identifier.type) { case "steam": return ( i.platform === "steam") + const identifiers: GameIdentifier[] = page.data.identifiers.filter((i: GameIdentifier) => i.type === "steam") let nullify: boolean = false for(const identifier of identifiers) { @@ -103,9 +103,9 @@ for(const game of games) { completed_on: page?.completed_on, mastered_on: page?.mastered_on, identifiers: [ - ...(page?.identifiers?.filter(i => i.platform !== "steam") ?? []), + ...(page?.identifiers?.filter(i => i.type !== "steam") ?? []), { - platform: "steam", + type: "steam", appid: appId, name: game.name, synced_on: formatDateIso(new Date()) diff --git a/_utils/game.ts b/_utils/game.ts index 0453970..59d4ca9 100644 --- a/_utils/game.ts +++ b/_utils/game.ts @@ -3,12 +3,12 @@ import {ReviewData} from "./review.ts" export interface GameBaseIdentifier { - platform: string, + type: string, synced_on?: string, } export interface GameSteamIdentifier extends GameBaseIdentifier { - platform: "steam", + type: "steam", appid: string, name?: string, }