mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-21 21:35:18 +01:00
pass linting
This commit is contained in:
parent
266cfe7a93
commit
b36147be72
@ -1,31 +1,27 @@
|
|||||||
import { useTranslation } from "next-i18next";
|
|
||||||
|
|
||||||
import Container from "components/services/widget/container";
|
import Container from "components/services/widget/container";
|
||||||
import Block from "components/services/widget/block";
|
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 { t } = useTranslation();
|
|
||||||
|
|
||||||
const { widget } = service;
|
const { widget } = service;
|
||||||
|
|
||||||
const { data: statistics, error: statisticsStatsError } = useWidgetAPI(widget, "statistics");
|
const { data: response, error: responseError } = useWidgetAPI(widget, "statistics");
|
||||||
|
|
||||||
if (statisticsStatsError) {
|
if (responseError) {
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<Block label="Error" value={statisticsStatsError.message} />
|
<Block label="Error" value={responseError.message} />
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statisticsStatsError) {
|
if (responseError) {
|
||||||
return <Container service={service} error={statisticsStatsError} />;
|
return <Container service={service} error={responseError} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statistics) {
|
if (response) {
|
||||||
const platforms = statistics.filter(x => x.n_roms!=0).length
|
const platforms = response.filter(x => x.n_roms!==0).length
|
||||||
const totalRoms = statistics.reduce((total, stat) => total + stat.n_roms, 0);
|
const totalRoms = response.reduce((total, stat) => total + stat.n_roms, 0);
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<Block label="romm.platforms" value={platforms} />
|
<Block label="romm.platforms" value={platforms} />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user