Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mint discoverability #918

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions e2e/fedimint.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions public/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,12 @@
"remove": "Remove",
"expires": "Expires",
"federation_id": "Federation ID",
"description": "Mutiny has experimental support for the Fedimint protocol. You'll need a federation invite code to use this feature. Store funds in a federation at your own risk!",
"learn_more": "Learn more about Fedimint."
"description": "Mutiny has experimental support for the Fedimint protocol. Store funds in a federation at your own risk!",
"learn_more": "Learn more about Fedimint.",
"discover": "Discover Federations",
"manual": "Invite Code",
"created_at": "Created At",
"recommended_by": "Recommended By"
},
"gift": {
"give_sats_link": "Give sats as a gift",
Expand Down
6 changes: 4 additions & 2 deletions public/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,10 @@
"remove": "Eliminar",
"expires": "Expira",
"federation_id": "ID federación",
"description": "Mutiny tiene soporte experimental para el protocolo Fedimint. Necesitará un código de invitación a la federación para poder usar esta funcionalidad ¡Almacene fondos en una federación bajo su propio riesgo!",
"learn_more": "Aprenda más sobre Fedimint."
"description": "Mutiny tiene soporte experimental para el protocolo Fedimint. ¡Almacene fondos en una federación bajo su propio riesgo!",
"learn_more": "Aprenda más sobre Fedimint.",
"created_at": "Creado En",
"recommended_by": "Recomendado por"
},
"gift": {
"give_sats_link": "Dar sats de regalo",
Expand Down
203 changes: 96 additions & 107 deletions src/components/BalanceBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,55 +63,46 @@ export function BalanceBox(props: { loading?: boolean; small?: boolean }) {
<VStack>
<Switch>
<Match when={state.federations && state.federations.length}>
<div>
<MediumHeader>Fedimint</MediumHeader>
<FancyCard>
<Show
when={!props.loading}
fallback={<LoadingShimmer />}
>
<div class="flex justify-between">
<div class="flex flex-col gap-1">
<div class="text-2xl">
<AmountSats
amountSats={
state.balance?.federation ||
0n
}
icon="community"
denominationSize="lg"
isFederation
/>
</div>
<div class="text-lg text-white/70">
<AmountFiat
amountSats={
state.balance?.federation ||
0n
}
denominationSize="sm"
/>
</div>
<MediumHeader>Fedimint</MediumHeader>
<FancyCard>
<Show
when={!props.loading}
fallback={<LoadingShimmer />}
>
<div class="flex justify-between">
<div class="flex flex-col gap-1">
<div class="text-2xl">
<AmountSats
amountSats={
state.balance?.federation || 0n
}
icon="community"
denominationSize="lg"
isFederation
/>
</div>
<div class="text-lg text-white/70">
<AmountFiat
amountSats={
state.balance?.federation || 0n
}
denominationSize="sm"
/>
</div>

<Show
when={
state.balance?.federation || 0n > 0n
}
>
<div class="self-end justify-self-end">
<A
href="/swaplightning"
class={STYLE}
>
<Shuffle class="h-6 w-6" />
</A>
</div>
</Show>
</div>
</Show>
</FancyCard>
</div>

<Show
when={state.balance?.federation || 0n > 0n}
>
<div class="self-end justify-self-end">
<A href="/swaplightning" class={STYLE}>
<Shuffle class="h-6 w-6" />
</A>
</div>
</Show>
</div>
</Show>
</FancyCard>
<ButtonCard
onClick={() => navigate("/settings/federations")}
>
Expand All @@ -132,80 +123,78 @@ export function BalanceBox(props: { loading?: boolean; small?: boolean }) {
</ButtonCard>
</Match>
</Switch>
<div>
<MediumHeader>{i18n.t("profile.self_custody")}</MediumHeader>
<FancyCard>
<Show when={!props.loading} fallback={<LoadingShimmer />}>
<Switch>
<Match when={state.safe_mode}>
<div class="flex flex-col gap-1">
<InfoBox accent="red">
{i18n.t("common.error_safe_mode")}
</InfoBox>
</div>
</Match>
<Match when={true}>
<div class="flex flex-col gap-1">
<div class="text-2xl">
<AmountSats
amountSats={
state.balance?.lightning || 0
}
icon="lightning"
denominationSize="lg"
/>
</div>
<div class="text-lg text-white/70">
<AmountFiat
amountSats={
state.balance?.lightning || 0
}
denominationSize="sm"
/>
</div>
</div>
</Match>
</Switch>
</Show>
<hr class="my-2 border-m-grey-750" />
<Show when={!props.loading} fallback={<LoadingShimmer />}>
<div class="flex justify-between">
<MediumHeader>{i18n.t("profile.self_custody")}</MediumHeader>
<FancyCard>
<Show when={!props.loading} fallback={<LoadingShimmer />}>
<Switch>
<Match when={state.safe_mode}>
<div class="flex flex-col gap-1">
<InfoBox accent="red">
{i18n.t("common.error_safe_mode")}
</InfoBox>
</div>
</Match>
<Match when={true}>
<div class="flex flex-col gap-1">
<div class="text-2xl">
<AmountSats
amountSats={totalOnchain()}
icon="chain"
amountSats={
state.balance?.lightning || 0
}
icon="lightning"
denominationSize="lg"
/>
</div>
<div class="text-lg text-white/70">
<AmountFiat
amountSats={totalOnchain()}
amountSats={
state.balance?.lightning || 0
}
denominationSize="sm"
/>
</div>
</div>
<div class="flex flex-col items-end justify-between gap-1">
<Show when={state.balance?.unconfirmed != 0n}>
<Indicator>
{i18n.t("common.pending")}
</Indicator>
</Show>
<Show when={state.balance?.unconfirmed === 0n}>
<div />
</Show>
<Show when={usableOnchain() > 0n}>
<div class="self-end justify-self-end">
<A href="/swap" class={STYLE}>
<Shuffle class="h-6 w-6" />
</A>
</div>
</Show>
</Match>
</Switch>
</Show>
<hr class="my-2 border-m-grey-750" />
<Show when={!props.loading} fallback={<LoadingShimmer />}>
<div class="flex justify-between">
<div class="flex flex-col gap-1">
<div class="text-2xl">
<AmountSats
amountSats={totalOnchain()}
icon="chain"
denominationSize="lg"
/>
</div>
<div class="text-lg text-white/70">
<AmountFiat
amountSats={totalOnchain()}
denominationSize="sm"
/>
</div>
</div>
</Show>
</FancyCard>
</div>
<div class="flex flex-col items-end justify-between gap-1">
<Show when={state.balance?.unconfirmed != 0n}>
<Indicator>
{i18n.t("common.pending")}
</Indicator>
</Show>
<Show when={state.balance?.unconfirmed === 0n}>
<div />
</Show>
<Show when={usableOnchain() > 0n}>
<div class="self-end justify-self-end">
<A href="/swap" class={STYLE}>
<Shuffle class="h-6 w-6" />
</A>
</div>
</Show>
</div>
</div>
</Show>
</FancyCard>
</VStack>
);
}
8 changes: 5 additions & 3 deletions src/components/layout/Misc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ export const FancyCard: ParentComponent<{
}> = (props) => {
return (
<VStack smallgap>
<div class="mt-2 pl-4">
<SmallHeader>{props.title}</SmallHeader>
</div>
<Show when={props.title}>
<div class="mt-2 pl-4">
<SmallHeader>{props.title}</SmallHeader>
</div>
</Show>
<div class="flex flex-col gap-2 rounded-xl border border-b-4 border-black/50 bg-m-grey-900 p-4 shadow-fancy-card">
{props.children}
</div>
Expand Down
12 changes: 0 additions & 12 deletions src/routes/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,6 @@ export function Profile() {
</FancyCard>
</Show>
</div>
{/* <div>
<MediumHeader>{i18n.t("profile.social")}</MediumHeader>
<FancyCard>
<KeyValue key="LN Address">
<MiniStringShower text={profile().lud16 || ""} />
</KeyValue>
<KeyValue key="npub">
<MiniStringShower text={npub() || ""} />
</KeyValue>
</FancyCard>
</div> */}
<ButtonCard onClick={() => navigate("/editprofile")}>
<div class="flex items-center gap-2">
{/* <Users class="inline-block text-m-red" /> */}
Expand All @@ -122,7 +111,6 @@ export function Profile() {
</div>
</ButtonCard>
<BalanceBox loading={state.wallet_loading} />

<NavBar activeTab="profile" />
</DefaultMain>
</MutinyWalletGuard>
Expand Down
Loading
Loading