Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 0b224f4

Browse files
Revert "warn about bad dns federations"
This reverts commit 625c0f6.
1 parent 06dbff8 commit 0b224f4

File tree

7 files changed

+58
-101
lines changed

7 files changed

+58
-101
lines changed

public/i18n/en.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@
4040
"just_me": "Just Me",
4141
"friends": "Friends",
4242
"requests": "Requests"
43-
},
44-
"federations_warn_generic": "Due to temporary issues with your current federation, we recommend you transfer your funds to a lightning channel or withdraw to another bitcoin wallet.",
45-
"transfer_lightning": "Transfer to lightning",
46-
"sent_to_another_wallet": "Send to another wallet"
43+
}
4744
},
4845
"profile": {
4946
"profile": "Profile",
@@ -52,7 +49,6 @@
5249
"edit_profile": "Edit Profile",
5350
"join_federation": "Join a federation",
5451
"manage_federation": "Manage Federations",
55-
"leave_federation": "Leave Federation",
5652
"federated_custody": "Federated Custody",
5753
"self_custody": "Self Custody",
5854
"social": "Social",

src/components/Activity.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TagItem } from "@mutinywallet/mutiny-wasm";
22
import { cache, createAsync, useNavigate } from "@solidjs/router";
3-
import { Plus, Save, Search, Shuffle } from "lucide-solid";
3+
import { Plus, Save, Search, Shuffle, Users } from "lucide-solid";
44
import {
55
createEffect,
66
createMemo,

src/components/FederationPopup.tsx

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import { useNavigate } from "@solidjs/router";
2-
import { ArrowLeftRight, ArrowUpRight, Users } from "lucide-solid";
3-
import { createSignal, Show } from "solid-js";
2+
import { Users } from "lucide-solid";
3+
import { createSignal } from "solid-js";
44

5-
import {
6-
ButtonCard,
7-
ExternalLink,
8-
NiceP,
9-
SimpleDialog
10-
} from "~/components/layout";
5+
import { ButtonCard, NiceP, SimpleDialog } from "~/components/layout";
116
import { useI18n } from "~/i18n/context";
127
import { useMegaStore } from "~/state/megaStore";
138

@@ -21,11 +16,9 @@ export function FederationPopup() {
2116
const i18n = useI18n();
2217
const navigate = useNavigate();
2318

24-
const name = state.expiration_warning?.federationName;
25-
2619
return (
2720
<SimpleDialog
28-
title={`${i18n.t("activity.federation_message")} ${name ? `: ${name}` : ""}`}
21+
title={`${i18n.t("activity.federation_message")}: ${state.expiration_warning?.federationName}`}
2922
open={showFederationExpirationWarning()}
3023
setOpen={(open: boolean) => {
3124
if (!open) {
@@ -34,41 +27,7 @@ export function FederationPopup() {
3427
}
3528
}}
3629
>
37-
<NiceP>
38-
{state.expiration_warning?.expiresMessage ||
39-
i18n.t("home.federations_warn_generic")}
40-
</NiceP>
41-
<Show when={!name}>
42-
<NiceP>
43-
<ExternalLink href="https://x.com/MutinyWallet/status/1805346636660429021">
44-
{i18n.t("settings.manage_federations.learn_more")}
45-
</ExternalLink>
46-
</NiceP>
47-
</Show>
48-
<ButtonCard
49-
onClick={() => {
50-
actions.clearExpirationWarning();
51-
setShowFederationExpirationWarning(false);
52-
navigate("/swaplightning");
53-
}}
54-
>
55-
<div class="flex items-center gap-2">
56-
<ArrowLeftRight class="inline-block text-m-red" />
57-
<NiceP>{i18n.t("home.transfer_lightning")}</NiceP>
58-
</div>
59-
</ButtonCard>
60-
<ButtonCard
61-
onClick={() => {
62-
actions.clearExpirationWarning();
63-
setShowFederationExpirationWarning(false);
64-
navigate("/send");
65-
}}
66-
>
67-
<div class="flex items-center gap-2">
68-
<ArrowUpRight class="inline-block text-m-red" />
69-
<NiceP>{i18n.t("home.sent_to_another_wallet")}</NiceP>
70-
</div>
71-
</ButtonCard>
30+
<NiceP>{state.expiration_warning?.expiresMessage}</NiceP>
7231
<ButtonCard
7332
onClick={() => {
7433
actions.clearExpirationWarning();
@@ -78,7 +37,7 @@ export function FederationPopup() {
7837
>
7938
<div class="flex items-center gap-2">
8039
<Users class="inline-block text-m-red" />
81-
<NiceP>{i18n.t("profile.leave_federation")}</NiceP>
40+
<NiceP>{i18n.t("profile.manage_federation")}</NiceP>
8241
</div>
8342
</ButtonCard>
8443
</SimpleDialog>

src/routes/settings/ManageFederations.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "@modular-forms/solid";
88
import { FederationBalance, TagItem } from "@mutinywallet/mutiny-wasm";
99
import { A, useNavigate, useSearchParams } from "@solidjs/router";
10-
import { BadgeCheck, LogOut, Scan, Trash } from "lucide-solid";
10+
import { ArrowLeftRight, BadgeCheck, LogOut, Scan, Trash } from "lucide-solid";
1111
import {
1212
createResource,
1313
createSignal,
@@ -152,8 +152,6 @@ export function AddFederationForm(props: {
152152
setSuccess(
153153
i18n.t("settings.manage_federations.federation_added_success")
154154
);
155-
// Reset the expiration warning seen state
156-
actions.resetExpirationWarning();
157155
await actions.refreshFederations();
158156
if (props.refetch) {
159157
await props.refetch();
@@ -305,7 +303,8 @@ function FederationListItem(props: {
305303
balance?: bigint;
306304
}) {
307305
const i18n = useI18n();
308-
const [_state, actions, sw] = useMegaStore();
306+
const [state, actions, sw] = useMegaStore();
307+
const navigate = useNavigate();
309308

310309
async function removeFederation() {
311310
setConfirmLoading(true);
@@ -324,6 +323,15 @@ function FederationListItem(props: {
324323

325324
const [transferDialogOpen, setTransferDialogOpen] = createSignal(false);
326325

326+
async function transferFunds() {
327+
// If there's only one federation we need to let them know to add another
328+
if (state.federations?.length && state.federations.length < 2) {
329+
setTransferDialogOpen(true);
330+
} else {
331+
navigate("/transfer?from=" + props.fed.federation_id);
332+
}
333+
}
334+
327335
const [confirmOpen, setConfirmOpen] = createSignal(false);
328336
const [confirmLoading, setConfirmLoading] = createSignal(false);
329337

@@ -385,6 +393,10 @@ function FederationListItem(props: {
385393
inviteCode={props.fed.invite_code}
386394
/>
387395
</KeyValue>
396+
<SubtleButton onClick={transferFunds}>
397+
<ArrowLeftRight class="h-4 w-4" />
398+
{i18n.t("settings.manage_federations.transfer_funds")}
399+
</SubtleButton>
388400
<Suspense>
389401
<RecommendButton fed={props.fed} />
390402
</Suspense>

src/state/megaStore.tsx

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
BTC_OPTION,
2929
Currency,
3030
eify,
31-
federationWarning,
3231
subscriptionValid,
3332
USD_OPTION
3433
} from "~/utils";
@@ -303,7 +302,23 @@ export const makeMegaStoreContext = () => {
303302
// Get federations
304303
const federations = await sw.list_federations();
305304

306-
const expiration_warning = federationWarning(federations);
305+
let expiration_warning:
306+
| {
307+
expiresTimestamp: number;
308+
expiresMessage: string;
309+
federationName: string;
310+
}
311+
| undefined = undefined;
312+
313+
federations.forEach((f) => {
314+
if (f.popup_countdown_message && f.popup_end_timestamp) {
315+
expiration_warning = {
316+
expiresTimestamp: f.popup_end_timestamp,
317+
expiresMessage: f.popup_countdown_message,
318+
federationName: f.federation_name
319+
};
320+
}
321+
});
307322

308323
setState({
309324
wallet_loading: false,
@@ -561,7 +576,23 @@ export const makeMegaStoreContext = () => {
561576
async refreshFederations() {
562577
const federations = await sw.list_federations();
563578

564-
const expiration_warning = federationWarning(federations);
579+
let expiration_warning:
580+
| {
581+
expiresTimestamp: number;
582+
expiresMessage: string;
583+
federationName: string;
584+
}
585+
| undefined = undefined;
586+
587+
federations.forEach((f) => {
588+
if (f.popup_countdown_message && f.popup_end_timestamp) {
589+
expiration_warning = {
590+
expiresTimestamp: f.popup_end_timestamp,
591+
expiresMessage: f.popup_countdown_message,
592+
federationName: f.federation_name
593+
};
594+
}
595+
});
565596

566597
setState({ federations, expiration_warning });
567598
},
@@ -607,9 +638,6 @@ export const makeMegaStoreContext = () => {
607638
// Only show the expiration warning once per session
608639
clearExpirationWarning() {
609640
setState({ expiration_warning_seen: true });
610-
},
611-
resetExpirationWarning() {
612-
setState({ expiration_warning_seen: false });
613641
}
614642
};
615643

src/utils/federationWarning.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/utils/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ export * from "./bech32";
2121
export * from "./keypad";
2222
export * from "./debounce";
2323
export * from "./blobToBase64";
24-
export * from "./federationWarning";

0 commit comments

Comments
 (0)