Skip to content

Commit

Permalink
feat: show active wallet name
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Dec 24, 2024
1 parent 5a40ba2 commit e73b71e
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
import { Link, useFocusEffect } from "expo-router";
import { Link, router, useFocusEffect } from "expo-router";
import { useBalance } from "hooks/useBalance";
import React, { useState } from "react";
import {
Expand All @@ -24,6 +24,8 @@ import Screen from "~/components/Screen";
import { Button } from "~/components/ui/button";
import { Skeleton } from "~/components/ui/skeleton";
import { useGetFiatAmount } from "~/hooks/useGetFiatAmount";
import { DEFAULT_WALLET_NAME } from "~/lib/constants";
import { useAppStore } from "~/lib/state/appStore";

dayjs.extend(relativeTime);

Expand All @@ -40,6 +42,8 @@ export function Home() {
const [balanceState, setBalanceState] = useState<BalanceState>(
BalanceState.SATS,
);
const wallets = useAppStore((store) => store.wallets);
const selectedWalletId = useAppStore((store) => store.selectedWalletId);

useFocusEffect(() => {
reloadBalance();
Expand Down Expand Up @@ -90,6 +94,21 @@ export function Home() {
onPress={switchBalanceState}
className="w-full flex flex-col items-center justify-center gap-4"
>
{wallets.length && (
<TouchableOpacity
onPress={() => {
router.push("/settings/wallets");
}}
>
<Text
numberOfLines={1}
ellipsizeMode="tail"
className="text-muted-foreground font-medium2 text-xl px-4 mb-2"
>
{wallets[selectedWalletId].name || DEFAULT_WALLET_NAME}
</Text>
</TouchableOpacity>
)}
<View className="w-full flex flex-row justify-center items-center gap-2">
{balance && !refreshingBalance ? (
<>
Expand Down

0 comments on commit e73b71e

Please sign in to comment.