mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-18 18:49:50 +00:00
homeassistant widget minor code cleanup / changes
- limit to 4 blocks - allow container to handle field filtering
This commit is contained in:
parent
59448b7277
commit
352b4146f7
3 changed files with 13 additions and 11 deletions
|
@ -5,12 +5,12 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
|
|||
export default function Component({ service }) {
|
||||
const { widget } = service;
|
||||
|
||||
const { data, error } = useWidgetAPI(widget, "", { refreshInterval: 60000 });
|
||||
const { data, error } = useWidgetAPI(widget, null, { refreshInterval: 60000 });
|
||||
if (error) {
|
||||
return <Container error={error} />;
|
||||
}
|
||||
const panels = [];
|
||||
data?.forEach(d => panels.push(<Block label={d.label} value={d.value} />));
|
||||
|
||||
return <Container service={service}>{panels}</Container>;
|
||||
|
||||
return <Container service={service}>
|
||||
{data?.map(d => <Block label={d.label} value={d.value} key={d.label} />)}
|
||||
</Container>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue