From 9cde7910b1a327a51d46641fa8c3cf91c44f8a38 Mon Sep 17 00:00:00 2001 From: djschnei21 <32646250+djschnei21@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:09:35 -0400 Subject: [PATCH] update to check whether profiles already exist and update button text accordingly Tested working updated logic for connection button based on profiles existing cleanup --- src/components/PendingNwc.tsx | 40 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/components/PendingNwc.tsx b/src/components/PendingNwc.tsx index cc13421b..2c271a92 100644 --- a/src/components/PendingNwc.tsx +++ b/src/components/PendingNwc.tsx @@ -6,9 +6,7 @@ import { createResource, createSignal, For, - Match, - Show, - Switch + Show } from "solid-js"; import { ButtonCard, GenericItem, InfoBox, NiceP } from "~/components"; @@ -37,8 +35,11 @@ export function PendingNwc() { const navigate = useNavigate(); + const [hasPreConfiguredNWC, setHasPreConfiguredNWC] = createSignal(false); + async function fetchPendingRequests() { const profiles = await sw.get_nwc_profiles(); + setHasPreConfiguredNWC(!!profiles && profiles.length > 0); if (!profiles) return []; const contacts: TagItem[] | undefined = await sw.get_contacts_sorted(); @@ -159,18 +160,22 @@ export function PendingNwc() { }); return ( - - + navigate("/settings/connections")}> +
+ + + {hasPreConfiguredNWC() + ? i18n.t("home.connection_edit") + : i18n.t("home.connection")} + +
+
+ 0 } > - navigate("/settings/connections")}> -
- - {i18n.t("home.connection_edit")} -
-
-
- - navigate("/settings/connections")}> -
- - {i18n.t("home.connection")} -
-
-
-
+ + ); }