From f888b505ac953f530cf558133c99010877c491ff Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 19:03:14 +0100 Subject: [PATCH 01/16] add home assistant sword component --- .../homeassistant-sword.tsx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/components/homeassistant-sword/homeassistant-sword.tsx diff --git a/src/components/homeassistant-sword/homeassistant-sword.tsx b/src/components/homeassistant-sword/homeassistant-sword.tsx new file mode 100644 index 0000000..ceb85a3 --- /dev/null +++ b/src/components/homeassistant-sword/homeassistant-sword.tsx @@ -0,0 +1,22 @@ +import { FC, useEffect } from "react"; + +interface HomeAssistantSwordProps { + swordIsGlowing: boolean; +} + +export const HomeAssistantSword : FC = ({swordIsGlowing}) => { + const xhr = new XMLHttpRequest(); + + useEffect(() => { + if (swordIsGlowing) { + xhr.open('POST', '192.168.1.140:8123/api/webhook/sword_on'); + } + else{ + xhr.open('POST', '192.168.1.140:8123/api/webhook/sword_off'); + } + }, [swordIsGlowing]); + + return (
+ {swordIsGlowing} +
) +}; \ No newline at end of file From 571969704012f1ea5e4b96b74e6405738e9e8e86 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 19:05:02 +0100 Subject: [PATCH 02/16] use new component --- src/components/sting-component/sting-component.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/sting-component/sting-component.tsx b/src/components/sting-component/sting-component.tsx index f218fab..dbeb926 100644 --- a/src/components/sting-component/sting-component.tsx +++ b/src/components/sting-component/sting-component.tsx @@ -3,6 +3,7 @@ import styles from "./sting-component.module.css"; import { StingSword } from "../sting-sword/sting-sword"; import { EditionChapter, EditionDifferenceData } from "../../movies/movies.ts"; import dayjsUtc from "../../utils/dayjs-config.ts"; +import { HomeAssistantSword } from "../homeassistant-sword/homeassistant-sword.tsx"; interface StingComponentProps { differences: EditionDifferenceData[]; @@ -44,6 +45,7 @@ export const StingComponent = ({ {chapterInfo && {chapterInfo}} +
{dayjsUtc(timestamp).format("HH:mm:ss")}
From ec2cfb83235e7a38b06ab5dc385ff7b4bf3ef70c Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 19:16:13 +0100 Subject: [PATCH 03/16] fix post mumbo jumbo --- src/components/homeassistant-sword/homeassistant-sword.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/homeassistant-sword/homeassistant-sword.tsx b/src/components/homeassistant-sword/homeassistant-sword.tsx index ceb85a3..f5f6000 100644 --- a/src/components/homeassistant-sword/homeassistant-sword.tsx +++ b/src/components/homeassistant-sword/homeassistant-sword.tsx @@ -10,9 +10,13 @@ export const HomeAssistantSword : FC = ({swordIsGlowing useEffect(() => { if (swordIsGlowing) { xhr.open('POST', '192.168.1.140:8123/api/webhook/sword_on'); + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + xhr.send(); } else{ xhr.open('POST', '192.168.1.140:8123/api/webhook/sword_off'); + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + xhr.send(); } }, [swordIsGlowing]); From 07dd0dd8c23b4a2e9d1bc025f4cd8f6b1def4790 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 19:22:56 +0100 Subject: [PATCH 04/16] im an idiot --- src/components/homeassistant-sword/homeassistant-sword.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/homeassistant-sword/homeassistant-sword.tsx b/src/components/homeassistant-sword/homeassistant-sword.tsx index f5f6000..ea8b704 100644 --- a/src/components/homeassistant-sword/homeassistant-sword.tsx +++ b/src/components/homeassistant-sword/homeassistant-sword.tsx @@ -9,12 +9,12 @@ export const HomeAssistantSword : FC = ({swordIsGlowing useEffect(() => { if (swordIsGlowing) { - xhr.open('POST', '192.168.1.140:8123/api/webhook/sword_on'); + xhr.open('POST', 'https://192.168.1.140:8123/api/webhook/sword_on'); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(); } else{ - xhr.open('POST', '192.168.1.140:8123/api/webhook/sword_off'); + xhr.open('POST', 'https://192.168.1.140:8123/api/webhook/sword_off'); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(); } From a3a33b778d18410a8127d5d7364239c2cdfaaf8d Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 19:32:09 +0100 Subject: [PATCH 05/16] drop them s's --- src/components/homeassistant-sword/homeassistant-sword.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/homeassistant-sword/homeassistant-sword.tsx b/src/components/homeassistant-sword/homeassistant-sword.tsx index ea8b704..b4a04d5 100644 --- a/src/components/homeassistant-sword/homeassistant-sword.tsx +++ b/src/components/homeassistant-sword/homeassistant-sword.tsx @@ -9,12 +9,12 @@ export const HomeAssistantSword : FC = ({swordIsGlowing useEffect(() => { if (swordIsGlowing) { - xhr.open('POST', 'https://192.168.1.140:8123/api/webhook/sword_on'); + xhr.open('POST', 'http://192.168.1.140:8123/api/webhook/sword_on'); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(); } else{ - xhr.open('POST', 'https://192.168.1.140:8123/api/webhook/sword_off'); + xhr.open('POST', 'http://192.168.1.140:8123/api/webhook/sword_off'); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(); } From 143bfb5e4e6f236ddc353bb8c4f41e9937226b6f Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 20:03:27 +0100 Subject: [PATCH 06/16] change to fetchApi --- .../homeassistant-sword/homeassistant-sword.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/homeassistant-sword/homeassistant-sword.tsx b/src/components/homeassistant-sword/homeassistant-sword.tsx index b4a04d5..ca890a9 100644 --- a/src/components/homeassistant-sword/homeassistant-sword.tsx +++ b/src/components/homeassistant-sword/homeassistant-sword.tsx @@ -5,18 +5,16 @@ interface HomeAssistantSwordProps { } export const HomeAssistantSword : FC = ({swordIsGlowing}) => { - const xhr = new XMLHttpRequest(); - useEffect(() => { if (swordIsGlowing) { - xhr.open('POST', 'http://192.168.1.140:8123/api/webhook/sword_on'); - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send(); + fetch('http://192.168.1.140:8123/api/webhook/sword_on', + {method: 'POST'} + ); } else{ - xhr.open('POST', 'http://192.168.1.140:8123/api/webhook/sword_off'); - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send(); + fetch('http://192.168.1.140:8123/api/webhook/sword_on', + {method: 'POST'} + ); } }, [swordIsGlowing]); From ab1e8e69bff3dc9f59c30c0eeaf0a1579d0b6627 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 20:08:27 +0100 Subject: [PATCH 07/16] im an idiot v2 --- src/components/homeassistant-sword/homeassistant-sword.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/homeassistant-sword/homeassistant-sword.tsx b/src/components/homeassistant-sword/homeassistant-sword.tsx index ca890a9..39eea5d 100644 --- a/src/components/homeassistant-sword/homeassistant-sword.tsx +++ b/src/components/homeassistant-sword/homeassistant-sword.tsx @@ -12,7 +12,7 @@ export const HomeAssistantSword : FC = ({swordIsGlowing ); } else{ - fetch('http://192.168.1.140:8123/api/webhook/sword_on', + fetch('http://192.168.1.140:8123/api/webhook/sword_off', {method: 'POST'} ); } From fe3b87bfb05aced3c905fbbcf51bb5538244e6c2 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 20:56:40 +0100 Subject: [PATCH 08/16] make home assisstant ip customisable --- src/components/gamgee-app/gamgee-app.tsx | 13 +++++++++++++ .../homeassistant-sword/homeassistant-sword.tsx | 12 ++++++++---- src/components/sting-component/sting-component.tsx | 4 +++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/components/gamgee-app/gamgee-app.tsx b/src/components/gamgee-app/gamgee-app.tsx index 3425a99..af86823 100644 --- a/src/components/gamgee-app/gamgee-app.tsx +++ b/src/components/gamgee-app/gamgee-app.tsx @@ -8,6 +8,7 @@ import { MenuItem, Select, SelectChangeEvent, + TextField, } from "@mui/material"; import { ManualMetadataProvider } from "../manual-metadata-provider/manual-metadata-provider.tsx"; import { PlexMetadataProvider } from "../plex-metadata-provider/plex-metadata-provider.tsx"; @@ -27,6 +28,8 @@ export const GamgeeApp = () => { const [metadata, setMetadata] = useState(null); const { mediaTimerProperties, mediaTimerActions } = useMediaTimer(24); + const [homeAssistantIp, setHomeAssistantIp] = useState(undefined); + const providerLabelId = useId(); const providerLabel = "Metadata Provider"; @@ -55,6 +58,7 @@ export const GamgeeApp = () => { differences={metadata.edition.differences} chapters={metadata.edition.chapters} timestamp={mediaTimerProperties.timestamp} + homeAssistantIp={homeAssistantIp} /> )} {capitalize(mediaTimerProperties.state)} @@ -80,6 +84,15 @@ export const GamgeeApp = () => { {metadataProvider === "Plex" && ( )} +
+ + setHomeAssistantIp(newUrlEvent.target.value) + } + /> +
diff --git a/src/components/homeassistant-sword/homeassistant-sword.tsx b/src/components/homeassistant-sword/homeassistant-sword.tsx index 39eea5d..a08adf9 100644 --- a/src/components/homeassistant-sword/homeassistant-sword.tsx +++ b/src/components/homeassistant-sword/homeassistant-sword.tsx @@ -2,17 +2,21 @@ import { FC, useEffect } from "react"; interface HomeAssistantSwordProps { swordIsGlowing: boolean; + homeAssistantIp: string | undefined; } -export const HomeAssistantSword : FC = ({swordIsGlowing}) => { +export const HomeAssistantSword : FC = ({swordIsGlowing, homeAssistantIp}) => { + + const homeAssistantApiLink = `http://${homeAssistantIp}:8123/api/webhook`; + useEffect(() => { if (swordIsGlowing) { - fetch('http://192.168.1.140:8123/api/webhook/sword_on', + fetch(`${homeAssistantApiLink}/sword_on`, {method: 'POST'} ); } - else{ - fetch('http://192.168.1.140:8123/api/webhook/sword_off', + else { + fetch(`${homeAssistantApiLink}/sword_off`, {method: 'POST'} ); } diff --git a/src/components/sting-component/sting-component.tsx b/src/components/sting-component/sting-component.tsx index dbeb926..707d89a 100644 --- a/src/components/sting-component/sting-component.tsx +++ b/src/components/sting-component/sting-component.tsx @@ -9,12 +9,14 @@ interface StingComponentProps { differences: EditionDifferenceData[]; chapters: EditionChapter[]; timestamp: number; + homeAssistantIp: string | undefined; } export const StingComponent = ({ differences, chapters, timestamp, + homeAssistantIp, }: StingComponentProps) => { const [swordIsGlowing, setSwordIsGlowing] = useState(false); @@ -45,7 +47,7 @@ export const StingComponent = ({ {chapterInfo && {chapterInfo}} - +
{dayjsUtc(timestamp).format("HH:mm:ss")}
From 04d363a587d0f0e247f7ab89db580c743f89fcc9 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 22:07:46 +0100 Subject: [PATCH 09/16] webhook on and off with hooking fun --- src/components/gamgee-app/gamgee-app.tsx | 18 ++++++++--- .../sting-component/sting-component.tsx | 32 +++++-------------- .../sting-component/useCallWebhook.ts | 20 ++++++++++++ .../sting-component/useIsGlowing.ts | 25 +++++++++++++++ 4 files changed, 66 insertions(+), 29 deletions(-) create mode 100644 src/components/sting-component/useCallWebhook.ts create mode 100644 src/components/sting-component/useIsGlowing.ts diff --git a/src/components/gamgee-app/gamgee-app.tsx b/src/components/gamgee-app/gamgee-app.tsx index af86823..08cd358 100644 --- a/src/components/gamgee-app/gamgee-app.tsx +++ b/src/components/gamgee-app/gamgee-app.tsx @@ -28,7 +28,8 @@ export const GamgeeApp = () => { const [metadata, setMetadata] = useState(null); const { mediaTimerProperties, mediaTimerActions } = useMediaTimer(24); - const [homeAssistantIp, setHomeAssistantIp] = useState(undefined); + const [swordOnWebhookUrl, setSwordOnWebhookUrl] = useState(undefined); + const [swordOffWebhookUrl, setSwordOffWebhookUrl] = useState(undefined); const providerLabelId = useId(); const providerLabel = "Metadata Provider"; @@ -58,7 +59,8 @@ export const GamgeeApp = () => { differences={metadata.edition.differences} chapters={metadata.edition.chapters} timestamp={mediaTimerProperties.timestamp} - homeAssistantIp={homeAssistantIp} + swordOnWebhookUrl={swordOnWebhookUrl} + swordOffWebhookUrl={swordOffWebhookUrl} /> )} {capitalize(mediaTimerProperties.state)} @@ -86,12 +88,18 @@ export const GamgeeApp = () => { )}
- setHomeAssistantIp(newUrlEvent.target.value) + setSwordOnWebhookUrl(newUrlEvent.target.value) } /> + + setSwordOffWebhookUrl(newUrlEvent.target.value)} + />
diff --git a/src/components/sting-component/sting-component.tsx b/src/components/sting-component/sting-component.tsx index 707d89a..78f53a1 100644 --- a/src/components/sting-component/sting-component.tsx +++ b/src/components/sting-component/sting-component.tsx @@ -1,42 +1,27 @@ -import { useCallback, useEffect, useState } from "react"; import styles from "./sting-component.module.css"; import { StingSword } from "../sting-sword/sting-sword"; import { EditionChapter, EditionDifferenceData } from "../../movies/movies.ts"; import dayjsUtc from "../../utils/dayjs-config.ts"; -import { HomeAssistantSword } from "../homeassistant-sword/homeassistant-sword.tsx"; +import { useIsGlowing } from "./useIsGlowing.ts"; +import { useCallWebhook } from "./useCallWebhook.ts"; interface StingComponentProps { differences: EditionDifferenceData[]; chapters: EditionChapter[]; timestamp: number; - homeAssistantIp: string | undefined; + swordOnWebhookUrl: string | undefined; + swordOffWebhookUrl: string | undefined; } export const StingComponent = ({ differences, chapters, timestamp, - homeAssistantIp, + swordOnWebhookUrl, + swordOffWebhookUrl, }: StingComponentProps) => { - const [swordIsGlowing, setSwordIsGlowing] = useState(false); - - const getDifference = useCallback( - (time: number) => - differences.find( - (difference) => - difference.start_time_ms < time && difference.end_time_ms > time, - ), - [differences], - ); - - useEffect(() => { - const maybeDifference = getDifference(timestamp); - if (maybeDifference && !swordIsGlowing) { - setSwordIsGlowing(true); - } else if (!maybeDifference && swordIsGlowing) { - setSwordIsGlowing(false); - } - }, [getDifference, swordIsGlowing, timestamp]); + const swordIsGlowing = useIsGlowing(differences, timestamp); + useCallWebhook(swordIsGlowing, swordOnWebhookUrl, swordOffWebhookUrl); const chapter = chapters.findLast((c) => c.start_time_ms <= timestamp); const chapterInfo = chapter?.title ?? "Unknown Chapter"; @@ -47,7 +32,6 @@ export const StingComponent = ({ {chapterInfo && {chapterInfo}} -
{dayjsUtc(timestamp).format("HH:mm:ss")}
diff --git a/src/components/sting-component/useCallWebhook.ts b/src/components/sting-component/useCallWebhook.ts new file mode 100644 index 0000000..056e504 --- /dev/null +++ b/src/components/sting-component/useCallWebhook.ts @@ -0,0 +1,20 @@ +export const useCallWebhook = ( + swordIsGlowing: boolean, + webhookOnUrl: string | undefined, + webhookOffUrl: string | undefined, +) => { + const callWebhook = (webhookUrl: string | undefined) => { + if (!webhookUrl) { + return; + } + fetch(webhookUrl, { method: "POST" }); + }; + + useEffect(() => { + if (swordIsGlowing) { + callWebhook(swordOnWebhookUrl); + } else { + callWebhook(swordOffWebhookUrl); + } + }, [swordIsGlowing]); +}; diff --git a/src/components/sting-component/useIsGlowing.ts b/src/components/sting-component/useIsGlowing.ts new file mode 100644 index 0000000..25eca49 --- /dev/null +++ b/src/components/sting-component/useIsGlowing.ts @@ -0,0 +1,25 @@ +import { useCallback, useEffect, useState } from "react"; +import { EditionDifferenceData } from "../../movies/movies"; + +export const useIsGlowing = ( + differences: EditionDifferenceData[], + timestamp: number, +) => { + const [swordIsGlowing, setSwordIsGlowing] = useState(false); + + const getDifference = useCallback( + (time: number) => + differences.find( + (difference) => + difference.start_time_ms < time && difference.end_time_ms > time, + ), + [differences], + ); + + useEffect(() => { + const maybeDifference = getDifference(timestamp); + setSwordIsGlowing(!!maybeDifference); + }, [getDifference, swordIsGlowing, timestamp]); + + return swordIsGlowing; +}; From 4817ddcbef55f53a30c5b4bc3777d995904cb366 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 22:07:55 +0100 Subject: [PATCH 10/16] remove shit component --- .../homeassistant-sword.tsx | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 src/components/homeassistant-sword/homeassistant-sword.tsx diff --git a/src/components/homeassistant-sword/homeassistant-sword.tsx b/src/components/homeassistant-sword/homeassistant-sword.tsx deleted file mode 100644 index a08adf9..0000000 --- a/src/components/homeassistant-sword/homeassistant-sword.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { FC, useEffect } from "react"; - -interface HomeAssistantSwordProps { - swordIsGlowing: boolean; - homeAssistantIp: string | undefined; -} - -export const HomeAssistantSword : FC = ({swordIsGlowing, homeAssistantIp}) => { - - const homeAssistantApiLink = `http://${homeAssistantIp}:8123/api/webhook`; - - useEffect(() => { - if (swordIsGlowing) { - fetch(`${homeAssistantApiLink}/sword_on`, - {method: 'POST'} - ); - } - else { - fetch(`${homeAssistantApiLink}/sword_off`, - {method: 'POST'} - ); - } - }, [swordIsGlowing]); - - return (
- {swordIsGlowing} -
) -}; \ No newline at end of file From 94868f97f44e98c66008b776645519bd40097161 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 22:11:50 +0100 Subject: [PATCH 11/16] missed save --- src/components/sting-component/useCallWebhook.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/sting-component/useCallWebhook.ts b/src/components/sting-component/useCallWebhook.ts index 056e504..f32d08f 100644 --- a/src/components/sting-component/useCallWebhook.ts +++ b/src/components/sting-component/useCallWebhook.ts @@ -1,7 +1,9 @@ +import { useEffect } from "react"; + export const useCallWebhook = ( swordIsGlowing: boolean, - webhookOnUrl: string | undefined, - webhookOffUrl: string | undefined, + swordOnWebhookUrl: string | undefined, + swordOffWebhookUrl: string | undefined, ) => { const callWebhook = (webhookUrl: string | undefined) => { if (!webhookUrl) { From 26223255a0c1516a6d0cc3c3123a96f4e17048fb Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 22:13:51 +0100 Subject: [PATCH 12/16] format file --- src/components/gamgee-app/gamgee-app.tsx | 35 ++++++++++++++---------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/components/gamgee-app/gamgee-app.tsx b/src/components/gamgee-app/gamgee-app.tsx index 08cd358..21e5aac 100644 --- a/src/components/gamgee-app/gamgee-app.tsx +++ b/src/components/gamgee-app/gamgee-app.tsx @@ -28,8 +28,12 @@ export const GamgeeApp = () => { const [metadata, setMetadata] = useState(null); const { mediaTimerProperties, mediaTimerActions } = useMediaTimer(24); - const [swordOnWebhookUrl, setSwordOnWebhookUrl] = useState(undefined); - const [swordOffWebhookUrl, setSwordOffWebhookUrl] = useState(undefined); + const [swordOnWebhookUrl, setSwordOnWebhookUrl] = useState< + string | undefined + >(undefined); + const [swordOffWebhookUrl, setSwordOffWebhookUrl] = useState< + string | undefined + >(undefined); const providerLabelId = useId(); const providerLabel = "Metadata Provider"; @@ -87,19 +91,20 @@ export const GamgeeApp = () => { )}
- - setSwordOnWebhookUrl(newUrlEvent.target.value) - } - /> - - setSwordOffWebhookUrl(newUrlEvent.target.value)} - /> + + setSwordOnWebhookUrl(newUrlEvent.target.value) + } + /> + + setSwordOffWebhookUrl(newUrlEvent.target.value) + } + />
From c532b1ba26fd4d65bac3e789e8eee78650b4c4df Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Oct 2025 22:18:13 +0100 Subject: [PATCH 13/16] eslint --- src/components/sting-component/useCallWebhook.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/sting-component/useCallWebhook.ts b/src/components/sting-component/useCallWebhook.ts index f32d08f..5f800a3 100644 --- a/src/components/sting-component/useCallWebhook.ts +++ b/src/components/sting-component/useCallWebhook.ts @@ -18,5 +18,5 @@ export const useCallWebhook = ( } else { callWebhook(swordOffWebhookUrl); } - }, [swordIsGlowing]); + }, [swordIsGlowing, swordOffWebhookUrl, swordOnWebhookUrl]); }; From 9ac2cea9973aa5df91c482c80cb5b37988eca2fb Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 6 Oct 2025 17:49:53 +0100 Subject: [PATCH 14/16] use empty string instead of undefined more fun --- src/components/gamgee-app/gamgee-app.tsx | 8 ++------ src/components/sting-component/sting-component.tsx | 4 ++-- src/components/sting-component/useCallWebhook.ts | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/gamgee-app/gamgee-app.tsx b/src/components/gamgee-app/gamgee-app.tsx index 21e5aac..1e066a5 100644 --- a/src/components/gamgee-app/gamgee-app.tsx +++ b/src/components/gamgee-app/gamgee-app.tsx @@ -28,12 +28,8 @@ export const GamgeeApp = () => { const [metadata, setMetadata] = useState(null); const { mediaTimerProperties, mediaTimerActions } = useMediaTimer(24); - const [swordOnWebhookUrl, setSwordOnWebhookUrl] = useState< - string | undefined - >(undefined); - const [swordOffWebhookUrl, setSwordOffWebhookUrl] = useState< - string | undefined - >(undefined); + const [swordOnWebhookUrl, setSwordOnWebhookUrl] = useState(""); + const [swordOffWebhookUrl, setSwordOffWebhookUrl] = useState(""); const providerLabelId = useId(); const providerLabel = "Metadata Provider"; diff --git a/src/components/sting-component/sting-component.tsx b/src/components/sting-component/sting-component.tsx index 78f53a1..0fa7eef 100644 --- a/src/components/sting-component/sting-component.tsx +++ b/src/components/sting-component/sting-component.tsx @@ -9,8 +9,8 @@ interface StingComponentProps { differences: EditionDifferenceData[]; chapters: EditionChapter[]; timestamp: number; - swordOnWebhookUrl: string | undefined; - swordOffWebhookUrl: string | undefined; + swordOnWebhookUrl: string; + swordOffWebhookUrl: string; } export const StingComponent = ({ diff --git a/src/components/sting-component/useCallWebhook.ts b/src/components/sting-component/useCallWebhook.ts index 5f800a3..a266ed2 100644 --- a/src/components/sting-component/useCallWebhook.ts +++ b/src/components/sting-component/useCallWebhook.ts @@ -2,8 +2,8 @@ import { useEffect } from "react"; export const useCallWebhook = ( swordIsGlowing: boolean, - swordOnWebhookUrl: string | undefined, - swordOffWebhookUrl: string | undefined, + swordOnWebhookUrl: string, + swordOffWebhookUrl: string, ) => { const callWebhook = (webhookUrl: string | undefined) => { if (!webhookUrl) { From 0252a5f9c5e670b050dfa17da5ee60241388592c Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 6 Oct 2025 17:57:56 +0100 Subject: [PATCH 15/16] unnest div and move upwards --- src/components/gamgee-app/gamgee-app.tsx | 62 ++++++++++++------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/components/gamgee-app/gamgee-app.tsx b/src/components/gamgee-app/gamgee-app.tsx index 1e066a5..326437c 100644 --- a/src/components/gamgee-app/gamgee-app.tsx +++ b/src/components/gamgee-app/gamgee-app.tsx @@ -64,21 +64,37 @@ export const GamgeeApp = () => { /> )} {capitalize(mediaTimerProperties.state)} - - {providerLabel} - - +
+ + setSwordOnWebhookUrl(newUrlEvent.target.value) + } + /> + + setSwordOffWebhookUrl(newUrlEvent.target.value) + } + /> + + {providerLabel} + + +
{metadataProvider === "Manual" && ( @@ -86,22 +102,6 @@ export const GamgeeApp = () => { {metadataProvider === "Plex" && ( )} -
- - setSwordOnWebhookUrl(newUrlEvent.target.value) - } - /> - - setSwordOffWebhookUrl(newUrlEvent.target.value) - } - /> -
From a50a72ffc8cf65b13db320b2aa285b92d3e158a3 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 6 Oct 2025 18:01:10 +0100 Subject: [PATCH 16/16] generalise css class --- src/components/gamgee-app/gamgee-app.module.css | 2 +- src/components/gamgee-app/gamgee-app.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/gamgee-app/gamgee-app.module.css b/src/components/gamgee-app/gamgee-app.module.css index f842503..2ac6f05 100644 --- a/src/components/gamgee-app/gamgee-app.module.css +++ b/src/components/gamgee-app/gamgee-app.module.css @@ -11,7 +11,7 @@ gap: 16px; } -.providerContainer { +.stingConfigGroup { display: flex; flex-direction: column; gap: 12px; diff --git a/src/components/gamgee-app/gamgee-app.tsx b/src/components/gamgee-app/gamgee-app.tsx index 326437c..a7a4c2a 100644 --- a/src/components/gamgee-app/gamgee-app.tsx +++ b/src/components/gamgee-app/gamgee-app.tsx @@ -64,7 +64,7 @@ export const GamgeeApp = () => { /> )} {capitalize(mediaTimerProperties.state)} -
+
{
-
+
{metadataProvider === "Manual" && ( )}