mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Update component.jsx
Added the additional fields gained by switching the API endpoint.
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user