Update component.jsx

Added the additional fields gained by switching the API endpoint.
This commit is contained in:
InsertDisc
2024-08-23 09:49:25 -04:00
committed by GitHub
parent 12dff53b13
commit 5d962b4e37

View File

@@ -23,13 +23,22 @@ export default function Component({ service }) {
}
if (response) {
const platforms = response.filter((x) => x.rom_count !== 0).length;
const totalRoms = response.reduce((total, stat) => total + stat.rom_count, 0);
return (
<Container service={service}>
<Block label="romm.platforms" value={t("common.number", { value: platforms })} />
<Block label="romm.totalRoms" value={t("common.number", { value: totalRoms })} />
</Container>
);
}
const platforms = response.PLATFORMS;
const totalRoms = response.ROMS;
const totalSaves = response.SAVES;
const totalStates = response.STATES;
const totalScreenshots = response.SCREENSHOTS;
const totalFilesizeGB = (response.FILESIZE / (1024 ** 3)).toFixed(2);
return (
<Container service={service}>
<Block label="romm.platforms" value={t("common.number", { value: platforms })} />
<Block label="romm.totalRoms" value={t("common.number", { value: totalRoms })} />
<Block label="romm.totalSaves" value={t("common.number", { value: totalSaves })} />
<Block label="romm.totalStates" value={t("common.number", { value: totalStates })} />
<Block label="romm.totalScreenshots" value={t("common.number", { value: totalScreenshots })} />
<Block label="romm.totalFilesize" value={t("common.filesize", { value: totalFilesizeGB })} />
</Container>
);
}
}