diff --git a/apps/desktop/src/routes/activty/components/singleText.tsx b/apps/desktop/src/routes/activty/components/singleText.tsx index 328f7670..52c53cb7 100644 --- a/apps/desktop/src/routes/activty/components/singleText.tsx +++ b/apps/desktop/src/routes/activty/components/singleText.tsx @@ -23,8 +23,12 @@ export function ActivitySingleText({ event }: { event: NDKEvent }) {
{thread ? (
- - + {thread.rootEventId ? ( + + ) : null} + {thread.replyEventId ? ( + + ) : null}
) : null}
diff --git a/apps/desktop/src/routes/settings/backup.tsx b/apps/desktop/src/routes/settings/backup.tsx index 036c69f7..67ba9763 100644 --- a/apps/desktop/src/routes/settings/backup.tsx +++ b/apps/desktop/src/routes/settings/backup.tsx @@ -1,9 +1,11 @@ +import { useArk } from "@lume/ark"; import { EyeOffIcon } from "@lume/icons"; import { useStorage } from "@lume/storage"; import { nip19 } from "nostr-tools"; import { useEffect, useState } from "react"; export function BackupSettingScreen() { + const ark = useArk(); const storage = useStorage(); const [privkey, setPrivkey] = useState(null); @@ -24,14 +26,10 @@ export function BackupSettingScreen() { return (
-
Private key
- {!privkey ? ( -
- You've stored private key on Lume -
- ) : ( - <> + {privkey ? ( +
+
Private key
removePrivkey()} - className="mt-2 inline-flex h-9 w-full items-center justify-center gap-2 rounded-lg bg-red-200 px-6 font-medium text-red-500 hover:bg-red-500 hover:text-white focus:outline-none dark:hover:text-white" + className="mt-2 inline-flex h-11 w-full items-center justify-center gap-2 rounded-lg bg-red-200 px-6 font-medium text-red-500 hover:bg-red-500 hover:text-white focus:outline-none dark:hover:text-white" > Remove private key - - )} +
+ ) : null}
); diff --git a/apps/desktop/src/routes/settings/general.tsx b/apps/desktop/src/routes/settings/general.tsx index e4b33fbd..1109bbf1 100644 --- a/apps/desktop/src/routes/settings/general.tsx +++ b/apps/desktop/src/routes/settings/general.tsx @@ -151,7 +151,7 @@ export function GeneralSettingScreen() {
-
+
Update
Automatically download new update
@@ -166,7 +166,7 @@ export function GeneralSettingScreen() {
-
+
Low Power
@@ -183,7 +183,7 @@ export function GeneralSettingScreen() {
-
+
Startup
Launch Lume at Login
@@ -198,7 +198,7 @@ export function GeneralSettingScreen() {
-
+
Media
Automatically load media
@@ -213,7 +213,7 @@ export function GeneralSettingScreen() {
-
+
Hashtag
Show all hashtags in content
@@ -228,7 +228,7 @@ export function GeneralSettingScreen() {
-
+
Notification
Automatically send notification
@@ -244,7 +244,7 @@ export function GeneralSettingScreen() {
-
+
Translation
Translate text to your language
@@ -259,7 +259,7 @@ export function GeneralSettingScreen() {
{settings.translation ? (
-
+
API Key
@@ -283,7 +283,7 @@ export function GeneralSettingScreen() {
) : null}
-
+
Appearance
diff --git a/apps/desktop/src/routes/settings/nwc.tsx b/apps/desktop/src/routes/settings/nwc.tsx index 96e51be0..73d41647 100644 --- a/apps/desktop/src/routes/settings/nwc.tsx +++ b/apps/desktop/src/routes/settings/nwc.tsx @@ -1,16 +1,55 @@ import { webln } from "@getalby/sdk"; import { useArk } from "@lume/ark"; -import { CheckCircleIcon } from "@lume/icons"; import { useStorage } from "@lume/storage"; +import * as Switch from "@radix-ui/react-switch"; import { useEffect, useState } from "react"; -import { NWCForm } from "./components/walletConnectForm"; +import { toast } from "sonner"; export function NWCScreen() { const ark = useArk(); const storage = useStorage(); + const [settings, setSettings] = useState({ + nwc: false, + instantZap: storage.settings.instantZap, + }); const [walletConnectURL, setWalletConnectURL] = useState(null); - const [balance, setBalance] = useState(0); + const [amount, setAmount] = useState("21"); + + const saveNWC = async () => { + try { + if (!walletConnectURL.startsWith("nostr+walletconnect:")) { + return toast.error( + "Connect URI is required and must start with format nostr+walletconnect:, please check again", + ); + } + + const uriObj = new URL(walletConnectURL); + const params = new URLSearchParams(uriObj.search); + + if (params.has("relay") && params.has("secret")) { + await storage.createPrivkey("Nostr Wallet Connect", walletConnectURL); + + storage.nwc = walletConnectURL; + + setWalletConnectURL(walletConnectURL); + setSettings((state) => ({ ...state, nwc: true })); + } else { + return toast.error("Connect URI is not valid, please check again"); + } + } catch (e) { + toast.error(String(e)); + } + }; + + const toggleInstantZap = async () => { + await storage.createSetting("instantZap", String(+!settings.instantZap)); + setSettings((state) => ({ ...state, instantZap: !settings.instantZap })); + }; + + const saveAmount = async () => { + await storage.createSetting("zapAmount", amount); + }; const remove = async () => { await storage.removePrivkey(`${ark.account.pubkey}-nwc`); @@ -24,130 +63,101 @@ export function NWCScreen() { await nwc.enable(); const balanceResponse = await nwc.getBalance(); - setBalance(balanceResponse.balance); nwc.close(); }; useEffect(() => { - if (walletConnectURL) loadBalance(); - }, [walletConnectURL]); - - useEffect(() => { - async function getNWC() { - const nwc = await storage.loadPrivkey(`${ark.account.pubkey}-nwc`); - if (nwc) setWalletConnectURL(nwc); + if (storage.nwc) { + setSettings((state) => ({ ...state, nwc: true })); + setWalletConnectURL(storage.nwc); } - getNWC(); }, []); return ( -
-
-
-

- Nostr Wallet Connect -

-

- Sending zap easily via Bitcoin Lightning. -

+
+
+
+
+
+ Connection String +
+
+ setWalletConnectURL(e.target.value)} + className="w-full border-transparent outline-none focus:outline-none focus:ring-0 focus:border-none h-9 rounded-lg ring-0 placeholder:text-neutral-600 bg-neutral-100 dark:bg-neutral-900" + /> +
+ {!settings.nwc ? ( + + ) : ( + + )} +
+
+
-
- {!walletConnectURL ? ( - - ) : ( -
-
- -
You're using nostr wallet connect
+ {settings.nwc ? ( + <> +
+
+
+ Instant Zap +
+
+ Zap with default amount, no confirmation +
-
-