commit a22fe38f7d06943838b9b6bc86fd88e2ba5e868e Author: codey Date: Wed Jan 22 10:53:58 2025 -0500 Initial commit diff --git a/src/widgets/lyrics/component.jsx b/src/widgets/lyrics/component.jsx new file mode 100644 index 0000000..0bc25cd --- /dev/null +++ b/src/widgets/lyrics/component.jsx @@ -0,0 +1,36 @@ +import { useTranslation } from "next-i18next"; + +import Container from "components/services/widget/container"; +import Block from "components/services/widget/block"; +import useWidgetAPI from "utils/proxy/use-widget-api"; + +export default function Component({ service }) { + const { t } = useTranslation(); + const { widget } = service; + const { data, error } = useWidgetAPI(widget, "widget", { + refreshInterval: 5000, + }); + + if (error) { + return ; + } + + if (!data) { + return ( + + + + + + ); + } + + return ( + + + + + + ); +} + diff --git a/src/widgets/lyrics/widget.js b/src/widgets/lyrics/widget.js new file mode 100644 index 0000000..b6dcf0b --- /dev/null +++ b/src/widgets/lyrics/widget.js @@ -0,0 +1,19 @@ +import genericProxyHandler from "utils/proxy/handlers/generic"; + +const widget = { + api: "{url}/{endpoint}" , + proxyHandler: genericProxyHandler , + + mappings: { + "widget": { + endpoint: "widget/lyrics/", + method: "GET", + headers: { + "Accept": "application/json", + "Accept-Content": "application/json", + }, + }, + }, +}; + +export default widget; diff --git a/src/widgets/radio/component.jsx b/src/widgets/radio/component.jsx new file mode 100644 index 0000000..cf5346c --- /dev/null +++ b/src/widgets/radio/component.jsx @@ -0,0 +1,33 @@ +import { useTranslation } from "next-i18next"; + +import Container from "components/services/widget/container"; +import Block from "components/services/widget/block"; +import useWidgetAPI from "utils/proxy/use-widget-api"; + +export default function Component({ service }) { + const { t } = useTranslation(); + const { widget } = service; + const { data, error } = useWidgetAPI(widget, "widget", { + refreshInterval: 5000, + }); + + if (error) { + return ; + } + + if (!data) { + return ( + + + + ); + } + + return ( + + + + + ); +} + diff --git a/src/widgets/radio/widget.js b/src/widgets/radio/widget.js new file mode 100644 index 0000000..70973f6 --- /dev/null +++ b/src/widgets/radio/widget.js @@ -0,0 +1,19 @@ +import genericProxyHandler from "utils/proxy/handlers/generic"; + +const widget = { + api: "{url}/{endpoint}" , + proxyHandler: genericProxyHandler , + + mappings: { + "widget": { + endpoint: "widget/radio/", + method: "GET", + headers: { + "Accept": "application/json", + "Accept-Content": "application/json", + }, + }, + }, +}; + +export default widget; diff --git a/src/widgets/redis/component.jsx b/src/widgets/redis/component.jsx new file mode 100644 index 0000000..f592cc6 --- /dev/null +++ b/src/widgets/redis/component.jsx @@ -0,0 +1,38 @@ +import { useTranslation } from "next-i18next"; + +import Container from "components/services/widget/container"; +import Block from "components/services/widget/block"; +import useWidgetAPI from "utils/proxy/use-widget-api"; + +export default function Component({ service }) { + const { t } = useTranslation(); + const { widget } = service; + const { data, error } = useWidgetAPI(widget, "widget", { + refreshInterval: 5000, + }); + + if (error) { + return ; + } + + if (!data) { + return ( + + + + + + + ); + } + + return ( + + + + + + + ); +} + diff --git a/src/widgets/redis/widget.js b/src/widgets/redis/widget.js new file mode 100644 index 0000000..db1a229 --- /dev/null +++ b/src/widgets/redis/widget.js @@ -0,0 +1,19 @@ +import genericProxyHandler from "utils/proxy/handlers/generic"; + +const widget = { + api: "{url}/{endpoint}" , + proxyHandler: genericProxyHandler , + + mappings: { + "widget": { + endpoint: "widget/redis/", + method: "GET", + headers: { + "Accept": "application/json", + "Accept-Content": "application/json", + }, + }, + }, +}; + +export default widget; diff --git a/src/widgets/sqlite/component.jsx b/src/widgets/sqlite/component.jsx new file mode 100644 index 0000000..47a7edc --- /dev/null +++ b/src/widgets/sqlite/component.jsx @@ -0,0 +1,36 @@ +import { useTranslation } from "next-i18next"; + +import Container from "components/services/widget/container"; +import Block from "components/services/widget/block"; +import useWidgetAPI from "utils/proxy/use-widget-api"; + +export default function Component({ service }) { + const { t } = useTranslation(); + const { widget } = service; + const { data, error } = useWidgetAPI(widget, "widget", { + refreshInterval: 5000, + } + ); + + if (error) { + return ; + } + + if (!data) { + return ( + + + + + + ); + } + + return ( + + + + + + ); +} diff --git a/src/widgets/sqlite/widget.js b/src/widgets/sqlite/widget.js new file mode 100644 index 0000000..e76c077 --- /dev/null +++ b/src/widgets/sqlite/widget.js @@ -0,0 +1,19 @@ +import genericProxyHandler from "utils/proxy/handlers/generic"; + +const widget = { + api: "{url}/{endpoint}" , + proxyHandler: genericProxyHandler , + + mappings: { + "widget": { + endpoint: "widget/sqlite/", + method: "GET", + headers: { + "Accept": "application/json", + "Accept-Content": "application/json", + }, + }, + }, +}; + +export default widget;