diff --git a/e2e/fedimint.spec.ts b/e2e/fedimint.spec.ts index c5b509d8..6a56db6f 100644 --- a/e2e/fedimint.spec.ts +++ b/e2e/fedimint.spec.ts @@ -18,13 +18,15 @@ test("fedmint join, receive, send", async ({ page }) => { // Fill the input with the federation code await page.fill("input[name='federation_code']", SIGNET_INVITE_CODE); - const addButton = await page.getByRole("button", { name: "Add" }); + await page.getByText("Mutinynet Signet Federation").waitFor(); + + const addButton = await page.getByRole("button", { name: "Add" }).first(); // Click the "Add" button await addButton.click(); // Wait for a header to appear with the text "MutinySignetFederation" - await page.waitForSelector("text=MutinySignetFederation"); + await page.getByText("MutinySignetFederation").waitFor(); // Navigate back home await page.goBack(); diff --git a/src/routes/settings/ManageFederations.tsx b/src/routes/settings/ManageFederations.tsx index cb912328..d34a2565 100644 --- a/src/routes/settings/ManageFederations.tsx +++ b/src/routes/settings/ManageFederations.tsx @@ -7,7 +7,7 @@ import { } from "@modular-forms/solid"; import { FederationBalance, TagItem } from "@mutinywallet/mutiny-wasm"; import { A, useSearchParams } from "@solidjs/router"; -import { Scan } from "lucide-solid"; +import { BadgeCheck, Scan } from "lucide-solid"; import { createResource, createSignal, @@ -26,7 +26,6 @@ import { Button, ConfirmDialog, DefaultMain, - ExternalLink, FancyCard, InfoBox, KeyValue, @@ -257,7 +256,7 @@ function AddFederationForm(props: { refetch?: RefetchType }) { > {/* todo i18n */} -
+
{ + try { + const hasRecommended = + await state.mutiny_wallet?.has_recommended_federation( + props.fed.federation_id + ); + return hasRecommended; + } catch (e) { + console.error(e); + return false; + } + }); + + async function recommendFederation() { + setRecommendLoading(true); + try { + const event_id = await state.mutiny_wallet?.recommend_federation( + props.fed.invite_code + ); + console.log("Recommended federation: ", event_id); + setRecommended(true); + refetch(); + } catch (e) { + console.error("Error recommending federation: ", e); + } + setRecommendLoading(false); + } + + return ( + + +

+ + Recommended by you +

+
+ + + +
+ ); +} + function FederationListItem(props: { fed: MutinyFederationIdentity; balance?: bigint; @@ -324,26 +379,12 @@ function FederationListItem(props: { setConfirmLoading(false); } - async function recommendFederation() { - setRecommendLoading(true); - try { - const event_id = await state.mutiny_wallet?.recommend_federation( - props.fed.invite_code - ); - console.log("Recommended federation: ", event_id); - } catch (e) { - console.error("Error recommending federation: ", e); - } - setRecommendLoading(false); - } - async function confirmRemove() { setConfirmOpen(true); } const [confirmOpen, setConfirmOpen] = createSignal(false); const [confirmLoading, setConfirmLoading] = createSignal(false); - const [recommendLoading, setRecommendLoading] = createSignal(false); return ( <> @@ -384,13 +425,9 @@ function FederationListItem(props: { > - + + +