mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
confused on the pre-commit changes
This commit is contained in:
parent
06dffef6a1
commit
7056bc9e99
@ -3,30 +3,30 @@ import Block from "components/services/widget/block";
|
|||||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||||
|
|
||||||
export default function Component({ service }) {
|
export default function Component({ service }) {
|
||||||
const { widget } = service;
|
const { widget } = service;
|
||||||
|
|
||||||
const { data: response, error: responseError } = useWidgetAPI(widget, "statistics");
|
const { data: response, error: responseError } = useWidgetAPI(widget, "statistics");
|
||||||
|
|
||||||
if (responseError) {
|
if (responseError) {
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<Block label="Error" value={responseError.message} />
|
<Block label="Error" value={responseError.message} />
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseError) {
|
||||||
|
return <Container service={service} error={responseError} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
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={platforms} />
|
||||||
|
<Block label="romm.totalRoms" value={totalRoms} />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseError) {
|
|
||||||
return <Container service={service} error={responseError} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
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={platforms} />
|
|
||||||
<Block label="romm.totalRoms" value={totalRoms} />
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user