From a68cdeeb200bd78d9f8ff2f03ef449c3d2a18702 Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Tue, 9 Jan 2024 10:32:14 +0200 Subject: [PATCH] navbar wallet layout --- packages/app/src/Pages/Layout/NavSidebar.tsx | 60 ++++--------------- .../app/src/Pages/Layout/WalletBalance.tsx | 41 +++++++++++++ 2 files changed, 52 insertions(+), 49 deletions(-) create mode 100644 packages/app/src/Pages/Layout/WalletBalance.tsx diff --git a/packages/app/src/Pages/Layout/NavSidebar.tsx b/packages/app/src/Pages/Layout/NavSidebar.tsx index 3c1a5b1b..aae58fd1 100644 --- a/packages/app/src/Pages/Layout/NavSidebar.tsx +++ b/packages/app/src/Pages/Layout/NavSidebar.tsx @@ -1,23 +1,21 @@ -import { useUserProfile } from "@snort/system-react"; +import {useUserProfile} from "@snort/system-react"; import classNames from "classnames"; -import { useEffect, useMemo, useState } from "react"; -import { FormattedMessage, FormattedNumber, useIntl } from "react-intl"; -import { Link, useNavigate } from "react-router-dom"; +import {FormattedMessage, useIntl} from "react-intl"; +import {useNavigate} from "react-router-dom"; import NavLink from "@/Components/Button/NavLink"; -import { NoteCreatorButton } from "@/Components/Event/Create/NoteCreatorButton"; +import {NoteCreatorButton} from "@/Components/Event/Create/NoteCreatorButton"; import Icon from "@/Components/Icons/Icon"; import Avatar from "@/Components/User/Avatar"; -import { ProfileLink } from "@/Components/User/ProfileLink"; +import {ProfileLink} from "@/Components/User/ProfileLink"; import useEventPublisher from "@/Hooks/useEventPublisher"; -import { useRates } from "@/Hooks/useRates"; -import { HasNotificationsMarker } from "@/Pages/Layout/HasNotificationsMarker"; -import { subscribeToNotifications } from "@/Utils/Notifications"; -import { getCurrentSubscription } from "@/Utils/Subscription"; -import { Sats, useWallet } from "@/Wallet"; +import {HasNotificationsMarker} from "@/Pages/Layout/HasNotificationsMarker"; +import {subscribeToNotifications} from "@/Utils/Notifications"; +import {getCurrentSubscription} from "@/Utils/Subscription"; import useLogin from "../../Hooks/useLogin"; -import { LogoHeader } from "./LogoHeader"; +import {LogoHeader} from "./LogoHeader"; +import {WalletBalance} from "@/Pages/Layout/WalletBalance"; const MENU_ITEMS = [ { @@ -77,42 +75,6 @@ const getNavLinkClass = (isActive: boolean, narrow: boolean) => { }); }; -const WalletBalance = () => { - const [balance, setBalance] = useState(); - const wallet = useWallet(); - const rates = useRates("BTCUSD"); - - useEffect(() => { - setBalance(undefined); - if (wallet.wallet && wallet.wallet.canGetBalance()) { - wallet.wallet.getBalance().then(setBalance); - } - }, [wallet]); - - const msgValues = useMemo(() => { - return { - amount: , - }; - }, [balance, rates]); - - return ( -
-
-
- - -
- - - -
-
- -
-
- ); -}; - export default function NavSidebar({ narrow = false }: { narrow: boolean }) { const { publicKey, subscriptions, readonly } = useLogin(s => ({ publicKey: s.publicKey, @@ -141,7 +103,7 @@ export default function NavSidebar({ narrow = false }: { narrow: boolean }) { return (
-
+
{ + const [balance, setBalance] = useState(null); + const wallet = useWallet(); + const rates = useRates("BTCUSD"); + const navigate = useNavigate(); + + useEffect(() => { + setBalance(null); + if (wallet.wallet && wallet.wallet.canGetBalance()) { + wallet.wallet.getBalance().then(setBalance); + } + }, [wallet]); + + const msgValues = useMemo(() => { + return { + amount: , + }; + }, [balance, rates]); + + return ( +
navigate('/wallet')}> +
+
+ + +
+ +
+
+ +
+
+ ); +}; \ No newline at end of file