Skip to content

Commit

Permalink
chore: change card in wallet settings
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Dec 19, 2024
1 parent b1593ab commit b1a19ec
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions pages/settings/wallets/EditWallet.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Link, router } from "expo-router";
import { Alert, Pressable, Text, View } from "react-native";
import { Alert, Pressable, View } from "react-native";
import Toast from "react-native-toast-message";

import { Nip47Capability } from "@getalby/sdk/dist/NWCClient";
import * as Clipboard from "expo-clipboard";
import {
ArchiveRestore,
Expand All @@ -18,7 +17,7 @@ import {
CardDescription,
CardTitle,
} from "~/components/ui/card";
import { DEFAULT_WALLET_NAME } from "~/lib/constants";
import { DEFAULT_WALLET_NAME, REQUIRED_CAPABILITIES } from "~/lib/constants";
import { useAppStore } from "~/lib/state/appStore";

export function EditWallet() {
Expand All @@ -27,21 +26,24 @@ export function EditWallet() {
return (
<View className="flex-1 flex flex-col p-3 gap-3">
<Screen title="Edit Wallet" />
{(["notifications", "list_transactions"] as Nip47Capability[]).map(
(capability) =>
(wallets[selectedWalletId].nwcCapabilities || []).indexOf(
capability,
) < 0 && (
<Card key={capability} className="border-destructive">
<CardContent className="flex flex-row items-center gap-4">
<TriangleAlert className="text-destructive" />
<Text className="text-foreground">
Your wallet does not support {capability}
</Text>
</CardContent>
</Card>
),
)}
{/* TODO: Do not allow notifications to be toggled without notifications capability */}
<Card>
<CardContent className="flex flex-row items-center gap-4">
<TriangleAlert className="text-muted-foreground" />
<View className="flex flex-1 flex-col">
<CardTitle>This wallet might not work as expected</CardTitle>
<CardDescription>
Missing capabilities:&nbsp;
{REQUIRED_CAPABILITIES.filter(
(capability) =>
!(wallets[selectedWalletId].nwcCapabilities || []).includes(
capability,
),
).join(", ")}
</CardDescription>
</View>
</CardContent>
</Card>
<Link href={`/settings/wallets/${selectedWalletId}/name`} asChild>
<Pressable>
<Card className="w-full">
Expand Down

0 comments on commit b1a19ec

Please sign in to comment.