diff --git a/src/components/Activity.tsx b/src/components/Activity.tsx
index 8b46be55..de62355f 100644
--- a/src/components/Activity.tsx
+++ b/src/components/Activity.tsx
@@ -1,5 +1,5 @@
import { TagItem } from "@mutinywallet/mutiny-wasm";
-import { A, cache, createAsync, revalidate } from "@solidjs/router";
+import { cache, createAsync, revalidate } from "@solidjs/router";
import { createEffect, createSignal, For, Match, Show, Switch } from "solid-js";
import shuffle from "~/assets/icons/shuffle.svg";
@@ -9,7 +9,6 @@ import {
HackActivityType,
NiceP
} from "~/components";
-import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";
import { timeAgo } from "~/utils";
@@ -143,25 +142,12 @@ export function UnifiedActivityItem(props: {
}
/>
- {/*
{JSON.stringify(props.item, null, 2)}
*/}
>
- //
);
}
export function CombinedActivity() {
const [state, _actions] = useMegaStore();
- const i18n = useI18n();
const [detailsOpen, setDetailsOpen] = createSignal(false);
const [detailsKind, setDetailsKind] = createSignal();
diff --git a/src/logic/mutinyWalletSetup.ts b/src/logic/mutinyWalletSetup.ts
index f7cdc237..b72d3289 100644
--- a/src/logic/mutinyWalletSetup.ts
+++ b/src/logic/mutinyWalletSetup.ts
@@ -1,6 +1,5 @@
/* @refresh reload */
-import { Capacitor } from "@capacitor/core";
import initMutinyWallet, { MutinyWallet } from "@mutinywallet/mutiny-wasm";
import { SecureStoragePlugin } from "capacitor-secure-storage-plugin";
@@ -260,13 +259,12 @@ export async function setupMutinyWallet(
let nsec;
// get nsec from secure storage
- if (Capacitor.isNativePlatform()) {
- try {
- const value = await SecureStoragePlugin.get({ key: "nsec" });
- nsec = value.value;
- } catch (e) {
- console.log("No nsec stored");
- }
+ // TODO: might have to check Capacitor.isNativePlatform but I think it's fine
+ try {
+ const value = await SecureStoragePlugin.get({ key: "nsec" });
+ nsec = value.value;
+ } catch (e) {
+ console.log("No nsec stored");
}
// if we didn't get an nsec from storage, try to use extension
diff --git a/src/router.tsx b/src/router.tsx
index 64bf214c..aa76c78b 100644
--- a/src/router.tsx
+++ b/src/router.tsx
@@ -23,10 +23,10 @@ import {
Chat,
Feedback,
Gift as GiftReceive,
+ ImportProfile,
Main,
NewProfile,
NotFound,
- OldMain,
Profile,
Receive,
RequestRoute,
@@ -160,10 +160,10 @@ export function Router() {
+
-
diff --git a/src/routes/ImportProfile.tsx b/src/routes/ImportProfile.tsx
new file mode 100644
index 00000000..1ffe8730
--- /dev/null
+++ b/src/routes/ImportProfile.tsx
@@ -0,0 +1,79 @@
+import { MutinyWallet } from "@mutinywallet/mutiny-wasm";
+import { useNavigate } from "@solidjs/router";
+import { SecureStoragePlugin } from "capacitor-secure-storage-plugin";
+import { createSignal, Show } from "solid-js";
+
+import {
+ Button,
+ ButtonLink,
+ DefaultMain,
+ InfoBox,
+ SimpleInput
+} from "~/components";
+
+export function ImportProfile() {
+ const [nsec, setNsec] = createSignal("");
+ const [saving, setSaving] = createSignal(false);
+ const [error, setError] = createSignal();
+
+ const navigate = useNavigate();
+
+ function handleSkip() {
+ localStorage.setItem("profile_setup_stage", "skipped");
+ navigate("/");
+ }
+
+ async function saveNsec() {
+ setSaving(true);
+ setError(undefined);
+ const trimmedNsec = nsec().trim();
+ try {
+ const npub = await MutinyWallet.nsec_to_npub(trimmedNsec);
+ if (!npub) {
+ throw new Error("Invalid nsec");
+ }
+ await SecureStoragePlugin.set({ key: "nsec", value: trimmedNsec });
+ // TODO: right now we need a reload to set the nsec
+ window.location.href = "/";
+ } catch (e) {
+ console.error(e);
+ setError("Invalid nsec");
+ }
+ setSaving(false);
+ }
+
+ return (
+
+
+
+
Import nostr profile
+
+ Login with an existing nostr account.
+
+
+
+
setNsec(e.currentTarget.value)}
+ placeholder={`Nostr private key (starts with "nsec")`}
+ />
+
+
+ {error()}
+
+
+
+
+ Create new nostr profile
+
+
+
+
+
+
+ );
+}
diff --git a/src/routes/NewProfile.tsx b/src/routes/NewProfile.tsx
index 6fb79975..97592566 100644
--- a/src/routes/NewProfile.tsx
+++ b/src/routes/NewProfile.tsx
@@ -115,8 +115,8 @@ export function NewProfile() {
-
- Import existing
+
+ Import existing nostr profile