diff --git a/README.md b/README.md index 5167f9bc..ae2ecf0f 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ * Service Integration - Currently supports Sonarr, Radarr, Ombi, Emby, Jellyfin, Tautulli (Plex), Overseerr, Jellyseerr ([ilusi0n](https://github.com/benphelps/homepage/pull/34)), NZBGet, ruTorrent - Portainer, Traefik, Speedtest Tracker, PiHole, Nginx Proxy Manager ([aidenpwnz](https://github.com/benphelps/homepage/pull/45)) + - Readarr, SABnzbd ([JazzFisch]()) * Information & Utility Widgets - System Stats (Disk, CPU, Memory) - Weather via WeatherAPI.com or OpenWeatherMap ([AlexFullmoon](https://github.com/benphelps/homepage/pull/25)) diff --git a/package.json b/package.json index 5846f48f..0e0a428b 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@headlessui/react": "^1.6.6", "@tailwindcss/forms": "^0.5.3", "classnames": "^2.3.1", + "currency-symbol-map": "^5.1.0", "dockerode": "^3.3.4", "i18next": "^21.9.1", "i18next-browser-languagedetector": "^6.1.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 55ce7d76..b0c3bc1e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,7 @@ specifiers: '@tailwindcss/forms': ^0.5.3 autoprefixer: ^10.4.8 classnames: ^2.3.1 + currency-symbol-map: ^5.1.0 dockerode: ^3.3.4 eslint: 8.22.0 eslint-config-airbnb: ^19.0.4 @@ -41,6 +42,7 @@ dependencies: '@headlessui/react': 1.6.6_biqbaboplfbrettd7655fr4n2y '@tailwindcss/forms': 0.5.3_tailwindcss@3.1.8 classnames: 2.3.1 + currency-symbol-map: 5.1.0 dockerode: 3.3.4 i18next: 21.9.1 i18next-browser-languagedetector: 6.1.5 @@ -699,6 +701,10 @@ packages: engines: {node: '>=4'} hasBin: true + /currency-symbol-map/5.1.0: + resolution: {integrity: sha512-LO/lzYRw134LMDVnLyAf1dHE5tyO6axEFkR3TXjQIOmMkAM9YL6QsiUwuXzZAmFnuDJcs4hayOgyIYtViXFrLw==} + dev: false + /damerau-levenshtein/1.0.8: resolution: {integrity: sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==} dev: true diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 0083a337..260a9537 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -31,11 +31,6 @@ "bitrate": "Bitrate", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Rate", - "remaining": "Verblieben", - "downloaded": "Heruntergeladen" - }, "rutorrent": { "active": "Aktiv", "upload": "Hochladen", @@ -51,6 +46,11 @@ "queued": "In Warteschlange", "movies": "Filme" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Ausstehend", "approved": "Genehmigt", @@ -97,15 +97,22 @@ "approved": "Approved", "available": "Available" }, - "gotify": { - "apps": "Anwendungen", - "clients": "Kunden", - "messages": "Mitteilungen" - }, "sabnzbd": { - "status": "Status", - "speed": "Speed", + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", "remaining": "Remaining", - "timeleft": "Time left" - } + "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" + }, } diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 155aae4a..11a90f60 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -53,6 +53,11 @@ "remaining": "Remaining", "downloaded": "Downloaded" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Active", "upload": "Upload", @@ -68,6 +73,11 @@ "queued": "Queued", "movies": "Movies" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Pending", "approved": "Approved", @@ -108,15 +118,12 @@ "disabled": "Disabled", "total": "Total" }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + }, "gotify": { "apps": "Applications", "clients": "Clients", "messages": "Messages" }, - "sabnzbd": { - "status": "Status", - "speed": "Speed", - "remaining": "Remaining", - "timeleft": "Time left" - } } diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 5889917b..3423a407 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -23,18 +23,13 @@ "playing": "En ejecución", "transcoding": "Transcodificando", "bitrate": "Tasa de Bits", - "no_active": "No Active Streams" + "no_active": "No hay streams activos" }, "tautulli": { "playing": "En ejecución", "transcoding": "Transcodificación", "bitrate": "Tasa de bits", - "no_active": "No Active Streams" - }, - "nzbget": { - "rate": "Velocidad", - "remaining": "Restante", - "downloaded": "Descargado" + "no_active": "No hay streams activos" }, "rutorrent": { "active": "Activo", @@ -51,6 +46,11 @@ "queued": "Puesto en cola", "movies": "Películas" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Pendiente", "approved": "Aprobado", @@ -93,19 +93,26 @@ "wait": "Espere, por favor" }, "overseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" - }, - "gotify": { - "apps": "Aplicaciones", - "clients": "Clientela", - "messages": "Mensajes" + "pending": "Pendiente", + "approved": "Aprobado", + "available": "Disponible" }, "sabnzbd": { - "status": "Status", - "speed": "Speed", + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", "remaining": "Remaining", - "timeleft": "Time left" - } + "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" + }, } diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index fe980f4b..0e79661e 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -8,33 +8,28 @@ "placeholder": "Recherche…" }, "resources": { - "total": "Totale", + "total": "Total", "free": "Libre", "used": "Utilisée" }, "docker": { "rx": "Rx", - "tx": "TX", - "mem": "Mem", - "cpu": "CPU", + "tx": "Tx", + "mem": "Mém", + "cpu": "Cpu", "offline": "Hors ligne" }, "emby": { - "playing": "En jouant", - "transcoding": "Transcoding", - "bitrate": "Débiter", - "no_active": "No Active Streams" + "playing": "En lecture", + "transcoding": "Transcodage", + "bitrate": "Débit", + "no_active": "Aucun flux actif" }, "tautulli": { - "playing": "En jouant", - "transcoding": "Transcoding", - "bitrate": "Débiter", - "no_active": "No Active Streams" - }, - "nzbget": { - "rate": "Évaluer", - "remaining": "Restante", - "downloaded": "Téléchargé" + "playing": "En lecture", + "transcoding": "Transcodage", + "bitrate": "Débit", + "no_active": "Aucun flux actif" }, "rutorrent": { "active": "Active", @@ -44,13 +39,18 @@ "sonarr": { "wanted": "Recherchée", "queued": "En queue", - "series": "Série" + "series": "Séries" }, "radarr": { "wanted": "Recherchée", "queued": "En queue", "movies": "Films" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "En attente", "approved": "Approuvée", @@ -74,7 +74,7 @@ "portainer": { "running": "Fonctionnement", "stopped": "Arrêté", - "total": "Totale" + "total": "Total" }, "traefik": { "routers": "Routeurs", @@ -83,8 +83,8 @@ }, "npm": { "enabled": "Activé", - "disabled": "Handicapée", - "total": "Totale" + "disabled": "Désactivé", + "total": "Total" }, "common": { "bbytes": "{{value, bytes(binary: true)}}", @@ -104,19 +104,26 @@ "wait": "Veuillez patienter" }, "overseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" + "pending": "En attente", + "approved": "Approuvée", + "available": "Disponible" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "remaining": "Remaining", + "downloaded": "Downloaded", + "rate": "Rate" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" }, "gotify": { "apps": "Applications", "clients": "Clients", "messages": "Messages" }, - "sabnzbd": { - "status": "Status", - "speed": "Speed", - "remaining": "Remaining", - "timeleft": "Time left" - } } diff --git a/public/locales/it/common.json b/public/locales/it/common.json index b9357ef0..9ede53a3 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -7,16 +7,16 @@ "rx": "RX" }, "emby": { - "playing": "Playing", + "playing": "In riproduzione", "transcoding": "Transcoding", "bitrate": "Bitrate", - "no_active": "No Active Streams" + "no_active": "Nessuno Stream Attivo" }, "tautulli": { - "playing": "Playing", + "playing": "In riproduzione", "transcoding": "Transcoding", "bitrate": "Bitrate", - "no_active": "No Active Streams" + "no_active": "Nessuno Stream Attivo" }, "speedtest": { "upload": "Upload", @@ -24,88 +24,95 @@ "ping": "Ping" }, "portainer": { - "running": "Running", - "stopped": "Stopped", - "total": "Total" + "running": "In esecuzione", + "stopped": "Fermati", + "total": "Totali" }, "traefik": { "routers": "Routers", - "services": "Services", + "services": "Servizi", "middleware": "Middleware" }, "widget": { "missing_type": "Missing Widget Type: {{type}}", - "api_error": "API Error", - "status": "Status" + "api_error": "Errore API", + "status": "Stato" }, "search": { - "placeholder": "Search…" + "placeholder": "Cerca…" }, "resources": { - "total": "Total", - "free": "Free", - "used": "Used" + "total": "Totale", + "free": "Libero", + "used": "In utilizzo" + }, + "rutorrent": { + "active": "Attivo", + "upload": "Upload", + "download": "Download" + }, + "sonarr": { + "series": "Serie", + "wanted": "Rchiesti", + "queued": "In coda" + }, + "radarr": { + "wanted": "Richiesti", + "queued": "In coda", + "movies": "Film" + }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, + "ombi": { + "pending": "In attesa", + "approved": "Approvati", + "available": "Disponibili" + }, + "jellyseerr": { + "pending": "In attesa", + "approved": "Approvati", + "available": "Disponibili" + }, + "pihole": { + "queries": "Richieste", + "blocked": "Bloccati", + "gravity": "Severità" + }, + "npm": { + "enabled": "Attivi", + "disabled": "Disabilitati", + "total": "Totali" + }, + "weather": { + "current": "Posizione Attuale", + "allow": "Clicca per consentire", + "updating": "Aggiornamento in corso", + "wait": "Attendi per favore" + }, + "overseerr": { + "pending": "In attesa", + "approved": "Approvati", + "available": "Disponibili" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" }, "nzbget": { "rate": "Rate", "remaining": "Remaining", "downloaded": "Downloaded" }, - "rutorrent": { - "active": "Active", - "upload": "Upload", - "download": "Download" - }, - "sonarr": { - "series": "Series", - "wanted": "Wanted", - "queued": "Queued" - }, - "radarr": { - "wanted": "Wanted", - "queued": "Queued", - "movies": "Movies" - }, - "ombi": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" - }, - "jellyseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" - }, - "pihole": { - "queries": "Queries", - "blocked": "Blocked", - "gravity": "Gravity" - }, - "npm": { - "enabled": "Enabled", - "disabled": "Disabled", - "total": "Total" - }, - "weather": { - "current": "Current Location", - "allow": "Click to allow", - "updating": "Updating", - "wait": "Please wait" - }, - "overseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" }, "gotify": { "apps": "Applications", "clients": "Clients", "messages": "Messages" }, - "sabnzbd": { - "status": "Status", - "speed": "Speed", - "remaining": "Remaining", - "timeleft": "Time left" - } } diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index d6af7820..40d9d35b 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -31,11 +31,6 @@ "bitrate": "Bitrate", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Takt", - "remaining": "Gjenstående", - "downloaded": "Nedlastet" - }, "rutorrent": { "active": "Aktiv", "upload": "Opplasting", @@ -51,6 +46,11 @@ "queued": "I kø", "movies": "Filmer" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Venter", "approved": "Godkjent", @@ -97,15 +97,22 @@ "approved": "Approved", "available": "Available" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "downloaded": "Downloaded", + "remaining": "Remaining" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + }, "gotify": { "apps": "Applications", "clients": "Clients", "messages": "Messages" }, - "sabnzbd": { - "status": "Status", - "speed": "Speed", - "remaining": "Remaining", - "timeleft": "Time left" - } } diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index d4d28a0b..dbb7b3de 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -16,11 +16,6 @@ "cpu": "CPU", "offline": "Offline" }, - "nzbget": { - "rate": "Rate", - "remaining": "Overgebleven", - "downloaded": "Gedownload" - }, "speedtest": { "upload": "Upload", "download": "Download", @@ -67,6 +62,11 @@ "wanted": "Gezocht", "queued": "In de wachtrij" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "In afwachting", "approved": "Goedgekeurd", @@ -97,15 +97,22 @@ "approved": "Approved", "available": "Available" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + }, "gotify": { "apps": "Applications", "clients": "Clients", "messages": "Messages" }, - "sabnzbd": { - "status": "Status", - "speed": "Speed", - "remaining": "Remaining", - "timeleft": "Time left" - } } diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index a5cabc23..acd5d31b 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -31,11 +31,6 @@ "bitrate": "Taxa de bits", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Avaliar", - "remaining": "Em falta", - "downloaded": "Baixada" - }, "rutorrent": { "active": "Ativa", "upload": "Envio", @@ -51,6 +46,11 @@ "queued": "Enfileiradas", "movies": "Filmes" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Pendente", "approved": "Aprovada", @@ -108,15 +108,22 @@ "approved": "Approved", "available": "Available" }, - "gotify": { - "apps": "Aplicações", - "clients": "Clientes", - "messages": "Mensagens" - }, "sabnzbd": { - "status": "Status", - "speed": "Speed", + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", "remaining": "Remaining", - "timeleft": "Time left" - } + "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" + }, } diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index 9b3984be..ecd00b10 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -31,11 +31,6 @@ "bitrate": "Битрейт", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Оценка", - "remaining": "Осталось", - "downloaded": "Загружено" - }, "rutorrent": { "active": "Активный", "upload": "Загрузить", @@ -51,6 +46,11 @@ "queued": "В очереди", "movies": "Фильмы" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Ожидание", "approved": "Одобрено", @@ -97,15 +97,22 @@ "approved": "Approved", "available": "Available" }, - "gotify": { - "apps": "Aplicações", - "clients": "Clientes", - "messages": "Mensagens" - }, "sabnzbd": { - "status": "Status", - "speed": "Speed", + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", "remaining": "Remaining", - "timeleft": "Time left" - } + "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" + }, } diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index 8396fed8..fb07ee71 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -31,11 +31,6 @@ "bitrate": "Bitrate", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Rate", - "remaining": "Còn lại", - "downloaded": "Đã tải" - }, "rutorrent": { "active": "Hoạt động", "upload": "Tải lên", @@ -51,6 +46,11 @@ "queued": "Queued", "movies": "Movies" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Pending", "approved": "Approved", @@ -97,15 +97,22 @@ "approved": "Approved", "available": "Available" }, - "gotify": { - "apps": "Aplicações", - "clients": "Clientes", - "messages": "Mensagens" - }, "sabnzbd": { - "status": "Status", - "speed": "Speed", + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", "remaining": "Remaining", - "timeleft": "Time left" + "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index a7f504f1..bb02bd82 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -31,11 +31,6 @@ "bitrate": "比特率", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "速度", - "remaining": "其余的", - "downloaded": "下载" - }, "rutorrent": { "active": "积极的", "upload": "上传", @@ -51,6 +46,11 @@ "queued": "排队", "movies": "电影" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "待办的", "approved": "得到正式认可的", @@ -97,15 +97,22 @@ "approved": "Approved", "available": "Available" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + }, "gotify": { "apps": "Aplicações", "clients": "Clientes", "messages": "Mensagens" }, - "sabnzbd": { - "status": "Status", - "speed": "Speed", - "remaining": "Remaining", - "timeleft": "Time left" - } } diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index 0712c7f3..43ea46c2 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -2,10 +2,12 @@ import { useTranslation } from "react-i18next"; import Sonarr from "./widgets/service/sonarr"; import Radarr from "./widgets/service/radarr"; +import Readarr from "./widgets/service/readarr"; import Ombi from "./widgets/service/ombi"; import Portainer from "./widgets/service/portainer"; import Emby from "./widgets/service/emby"; import Nzbget from "./widgets/service/nzbget"; +import SABnzbd from "./widgets/service/sabnzbd"; import Docker from "./widgets/service/docker"; import Pihole from "./widgets/service/pihole"; import Rutorrent from "./widgets/service/rutorrent"; @@ -16,24 +18,27 @@ import Jellyseerr from "./widgets/service/jellyseerr"; import Overseerr from "./widgets/service/overseerr"; import Npm from "./widgets/service/npm"; import Tautulli from "./widgets/service/tautulli"; +import CoinMarketCap from "./widgets/service/coinmarketcap"; import Gotify from "./widgets/service/gotify"; -import Sabnzbd from "./widgets/service/sabnzbd"; const widgetMappings = { docker: Docker, sonarr: Sonarr, radarr: Radarr, + readarr: Readarr, ombi: Ombi, portainer: Portainer, emby: Emby, jellyfin: Jellyfin, nzbget: Nzbget, + sabnzbd: SABnzbd, pihole: Pihole, rutorrent: Rutorrent, speedtest: Speedtest, traefik: Traefik, jellyseerr: Jellyseerr, overseerr: Overseerr, + coinmarketcap: CoinMarketCap, npm: Npm, tautulli: Tautulli, gotify: Gotify, diff --git a/src/components/services/widgets/service/coinmarketcap.jsx b/src/components/services/widgets/service/coinmarketcap.jsx new file mode 100644 index 00000000..a05edcf1 --- /dev/null +++ b/src/components/services/widgets/service/coinmarketcap.jsx @@ -0,0 +1,64 @@ +import useSWR from "swr"; +import { useTranslation } from "react-i18next"; +import getSymbolFromCurrency from "currency-symbol-map"; + +import Widget from "../widget"; +import Block from "../block"; + +import { formatApiUrl } from "utils/api-helpers"; + +export default function CoinMarketCap({ service }) { + const { t } = useTranslation(); + + const config = service.widget; + const symbols = [...service.symbols]; + const currencyCode = service.currency ?? "USD"; + + const { data: statsData, error: statsError } = useSWR( + formatApiUrl(config, `v1/cryptocurrency/quotes/latest?symbol=${symbols.join(",")}&convert=${currencyCode}`) + ); + + if (!symbols || symbols.length === 0) { + return ( + + + + ); + } + + if (statsError) { + return ; + } + + if (!statsData) { + return ( + + + + ); + } + + const { data } = statsData; + const currencySymbol = getSymbolFromCurrency(currencyCode); + + return symbols.map((key) => ( + +
+
{data[key].name}
+
+
+ {currencySymbol} + {data[key].quote[currencyCode].price.toFixed(2)} +
+
0 ? "text-emerald-300" : "text-rose-300" + }`} + > + {data[key].quote[currencyCode].percent_change_1h.toFixed(2)}% +
+
+
+
+ )); +} diff --git a/src/components/services/widgets/service/emby.jsx b/src/components/services/widgets/service/emby.jsx index fc9d3e50..35f31f18 100644 --- a/src/components/services/widgets/service/emby.jsx +++ b/src/components/services/widgets/service/emby.jsx @@ -27,6 +27,7 @@ function ticksToString(ticks) { } function SingleSessionEntry({ playCommand, session }) { + console.log(session); const { NowPlayingItem: { Name, SeriesName, RunTimeTicks }, PlayState: { PositionTicks, IsPaused, IsMuted }, @@ -175,7 +176,7 @@ export default function Emby({ service }) { if (playing.length === 0) { return ( -
+
{t("emby.no_active")}
@@ -189,7 +190,7 @@ export default function Emby({ service }) { if (playing.length === 1) { const session = playing[0]; return ( -
+
handlePlayCommand(currentSession, command)} session={session} @@ -199,7 +200,7 @@ export default function Emby({ service }) { } return ( -
+
{playing.map((session) => ( ; + } + + if (!booksData || !wantedData || !queueData) { + return ( + + + + + + ); + } + + const have = booksData.filter((book) => book.statistics.bookFileCount > 0); + + return ( + + + + + + ); +} diff --git a/src/components/services/widgets/service/sabnzbd.jsx b/src/components/services/widgets/service/sabnzbd.jsx index fbafc4b5..d1a08a27 100644 --- a/src/components/services/widgets/service/sabnzbd.jsx +++ b/src/components/services/widgets/service/sabnzbd.jsx @@ -6,22 +6,22 @@ import Block from "../block"; import { formatApiUrl } from "utils/api-helpers"; -export default function Sabnzbd({ service }) { - const { t } = useTranslation("common"); +export default function SABnzbd({ service }) { + const { t } = useTranslation(); const config = service.widget; - const { data: statusData, error: statusError } = useSWR(formatApiUrl(config, "mode=queue")); - if (statusError) { + const { data: queueData, error: queueError } = useSWR(formatApiUrl(config, "queue")); + + if (queueError) { return ; } - if (!statusData) { + if (!queueData) { return ( - - - + + ); @@ -29,13 +29,9 @@ export default function Sabnzbd({ service }) { return ( - - - - + + + ); } diff --git a/src/components/services/widgets/service/tautulli.jsx b/src/components/services/widgets/service/tautulli.jsx index c92ccbbe..3902d4fc 100644 --- a/src/components/services/widgets/service/tautulli.jsx +++ b/src/components/services/widgets/service/tautulli.jsx @@ -104,7 +104,7 @@ export default function Tautulli({ service }) { if (!activityData) { return ( -
+
-
@@ -127,7 +127,7 @@ export default function Tautulli({ service }) { if (playing.length === 0) { return ( -
+
{t("tautulli.no_active")}
@@ -141,14 +141,14 @@ export default function Tautulli({ service }) { if (playing.length === 1) { const session = playing[0]; return ( -
+
); } return ( -
+
{playing.map((session) => ( ))} diff --git a/src/components/widgets/openweathermap/weather.jsx b/src/components/widgets/openweathermap/weather.jsx index b01eb3c4..4173871d 100644 --- a/src/components/widgets/openweathermap/weather.jsx +++ b/src/components/widgets/openweathermap/weather.jsx @@ -16,7 +16,7 @@ function Widget({ options }) { if (error || data?.cod === 401 || data?.error) { return ( -
+
@@ -32,7 +32,7 @@ function Widget({ options }) { if (!data) { return ( -
+
@@ -49,7 +49,7 @@ function Widget({ options }) { const unit = options.units === "metric" ? "celsius" : "fahrenheit"; return ( -
+
requestLocation()} className="flex flex-col justify-center"> +