diff --git a/docs/widgets/services/frigate.md b/docs/widgets/services/frigate.md index 53421ab43..46b180434 100644 --- a/docs/widgets/services/frigate.md +++ b/docs/widgets/services/frigate.md @@ -7,8 +7,11 @@ Allowed fields: `["cameras", "uptime", "version"]`. + A recent event listing is disabled by default, but can be enabled with the `enableRecentEvents` option. + ```yaml widget: type: frigate url: http://frigate.host.or.ip:port + enableRecentEvents: true ``` \ No newline at end of file diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index 75d31add0..03b4507ea 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -399,6 +399,9 @@ export function cleanServiceGroups(groups) { expandOneStreamToTwoRows, showEpisodeNumber, + // frigate + enableRecentEvents, + // glances, pihole, pfsense version, @@ -614,6 +617,9 @@ export function cleanServiceGroups(groups) { if (type === "wgeasy") { if (threshold !== undefined) cleanedService.widget.threshold = parseInt(threshold, 10); } + if (type === "frigate") { + if (enableRecentEvents !== undefined) cleanedService.widget.enableRecentEvents = enableRecentEvents; + } } return cleanedService; diff --git a/src/widgets/frigate/component.jsx b/src/widgets/frigate/component.jsx index f74b95a8e..27bcbeaf7 100644 --- a/src/widgets/frigate/component.jsx +++ b/src/widgets/frigate/component.jsx @@ -4,17 +4,47 @@ import Container from "components/services/widget/container"; import Block from "components/services/widget/block"; import useWidgetAPI from "utils/proxy/use-widget-api"; +function Event({ camera, label, startTime, score, type, thumbnail }) { + const { i18n } = useTranslation(); + + const dateFormatter = new Intl.DateTimeFormat(i18n.language, { timeStyle: "short", dateStyle: "medium" }); + const percentFormatter = new Intl.NumberFormat(i18n.language, { style: "percent" }); + + return ( +