Skip to content

Commit

Permalink
feat: approver ux ui
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarkhanzadian committed Nov 14, 2024
1 parent 75da079 commit f9b9a33
Show file tree
Hide file tree
Showing 59 changed files with 1,490 additions and 141 deletions.
100 changes: 50 additions & 50 deletions apps/mobile/ios/Podfile.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions apps/mobile/ios/leatherwalletmobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
1B12FD95F6504898B7BE8160 /* FiraCode-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = B66C2888E3BB47F7A5A88DEB /* FiraCode-Medium.otf */; };
297A611EBADB4ED0B158576E /* ABCDiatype-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = F520EA8A657049D4A3392B8B /* ABCDiatype-Regular.otf */; };
322D7CDF54DE4002AED225F1 /* ABCDiatype-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 6B54D2785B5E48D281A8E3C8 /* ABCDiatype-Medium.otf */; };
3319885B547C452A9C635C5C /* ABCDiatype-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = A6CFA460F0F340ED95800EF2 /* ABCDiatype-Light.otf */; };
3735F5722A7145C19BC65634 /* noop-file.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17F703D94F4B4BAE9007DC30 /* noop-file.swift */; };
3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */; };
639E76F5C6DD4F95BB83688D /* FiraCode-Retina.otf in Resources */ = {isa = PBXBuildFile; fileRef = 76B2513BA2D94EB6BA0D6194 /* FiraCode-Retina.otf */; };
96905EF65AED1B983A6B3ABC /* libPods-leatherwalletmobile.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-leatherwalletmobile.a */; };
B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */; };
BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; };
EC07C78F575D4480A1321AFF /* SpaceMono-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3F6687E7CB2942B0929D7833 /* SpaceMono-Regular.ttf */; };
639E76F5C6DD4F95BB83688D /* FiraCode-Retina.otf in Resources */ = {isa = PBXBuildFile; fileRef = 76B2513BA2D94EB6BA0D6194 /* FiraCode-Retina.otf */; };
1B12FD95F6504898B7BE8160 /* FiraCode-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = B66C2888E3BB47F7A5A88DEB /* FiraCode-Medium.otf */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -37,16 +37,16 @@
6B54D2785B5E48D281A8E3C8 /* ABCDiatype-Medium.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "ABCDiatype-Medium.otf"; path = "../node_modules/@leather.io/ui/src/assets-native/fonts/ABCDiatype-Medium.otf"; sourceTree = "<group>"; };
6C2E3173556A471DD304B334 /* Pods-leatherwalletmobile.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-leatherwalletmobile.debug.xcconfig"; path = "Target Support Files/Pods-leatherwalletmobile/Pods-leatherwalletmobile.debug.xcconfig"; sourceTree = "<group>"; };
70C1354B3AEE44B3B957C23B /* leatherwalletmobile-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "leatherwalletmobile-Bridging-Header.h"; path = "leatherwalletmobile/leatherwalletmobile-Bridging-Header.h"; sourceTree = "<group>"; };
76B2513BA2D94EB6BA0D6194 /* FiraCode-Retina.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "FiraCode-Retina.otf"; path = "../node_modules/@leather.io/ui/dist-native/src/assets-native/fonts/FiraCode-Retina.otf"; sourceTree = "<group>"; };
7A4D352CD337FB3A3BF06240 /* Pods-leatherwalletmobile.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-leatherwalletmobile.release.xcconfig"; path = "Target Support Files/Pods-leatherwalletmobile/Pods-leatherwalletmobile.release.xcconfig"; sourceTree = "<group>"; };
A6CFA460F0F340ED95800EF2 /* ABCDiatype-Light.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "ABCDiatype-Light.otf"; path = "../node_modules/@leather.io/ui/src/assets-native/fonts/ABCDiatype-Light.otf"; sourceTree = "<group>"; };
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = leatherwalletmobile/SplashScreen.storyboard; sourceTree = "<group>"; };
B66C2888E3BB47F7A5A88DEB /* FiraCode-Medium.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "FiraCode-Medium.otf"; path = "../node_modules/@leather.io/ui/dist-native/src/assets-native/fonts/FiraCode-Medium.otf"; sourceTree = "<group>"; };
BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = "<group>"; };
CFE8092428C64AA0AFE1A346 /* MarchePro-Super.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "MarchePro-Super.otf"; path = "../node_modules/@leather.io/ui/src/assets-native/fonts/MarchePro-Super.otf"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
F520EA8A657049D4A3392B8B /* ABCDiatype-Regular.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "ABCDiatype-Regular.otf"; path = "../node_modules/@leather.io/ui/src/assets-native/fonts/ABCDiatype-Regular.otf"; sourceTree = "<group>"; };
FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-leatherwalletmobile/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
76B2513BA2D94EB6BA0D6194 /* FiraCode-Retina.otf */ = {isa = PBXFileReference; name = "FiraCode-Retina.otf"; path = "../node_modules/@leather.io/ui/dist-native/src/assets-native/fonts/FiraCode-Retina.otf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
B66C2888E3BB47F7A5A88DEB /* FiraCode-Medium.otf */ = {isa = PBXFileReference; name = "FiraCode-Medium.otf"; path = "../node_modules/@leather.io/ui/dist-native/src/assets-native/fonts/FiraCode-Medium.otf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"dependencies": {
"@crowdin/ota-client": "2.0.0",
"@expo/vector-icons": "14.0.0",
"@gorhom/bottom-sheet": "4.6.3",
"@leather.io/analytics": "workspace:*",
"@leather.io/bitcoin": "workspace:*",
"@leather.io/constants": "workspace:*",
Expand Down Expand Up @@ -102,6 +103,7 @@
"metro-cache": "0.80.5",
"metro-config": "0.80.5",
"metro-resolver": "0.80.5",
"prism-react-renderer": "2.4.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.74.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/(home)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { RefObject, createContext } from 'react';

import { ActionBarMethods } from '@/components/action-bar/action-bar';
import { NetworkBadge } from '@/components/badges/network-badge';
import { HomeHeader } from '@/components/headers/home-header';
import { NakedHeader } from '@/components/headers/naked-header';
import { TitleHeader } from '@/components/headers/title-header';
import { NetworkBadge } from '@/components/network-badge';
import { AppRoutes } from '@/routes';
import { t } from '@lingui/macro';
import { useLingui } from '@lingui/react';
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/(home)/settings/display/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRef } from 'react';

import { NetworkBadge } from '@/components/badges/network-badge';
import { AnimatedHeaderScreenLayout } from '@/components/headers/animated-header/animated-header-screen.layout';
import { NetworkBadge } from '@/components/network-badge';
import { AccountIdentifierSheet } from '@/features/settings/account-identifier-sheet';
import { BitcoinUnitSheet } from '@/features/settings/bitcoin-unit-sheet';
import { ConversionUnitSheet } from '@/features/settings/conversion-unit-sheet';
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/(home)/settings/help/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NetworkBadge } from '@/components/badges/network-badge';
import { AnimatedHeaderScreenLayout } from '@/components/headers/animated-header/animated-header-screen.layout';
import { NetworkBadge } from '@/components/network-badge';
import { t } from '@lingui/macro';

import { Cell, GraduateCapIcon, MagicBookIcon, SupportIcon } from '@leather.io/ui/native';
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/(home)/settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useRef } from 'react';

import { NetworkBadge } from '@/components/badges/network-badge';
import { Divider } from '@/components/divider';
import { AnimatedHeaderScreenLayout } from '@/components/headers/animated-header/animated-header-screen.layout';
import { NetworkBadge } from '@/components/network-badge';
import { NotifyUserSheetLayout } from '@/components/sheets/notify-user-sheet.layout';
import { useAuthContext } from '@/components/splash-screen-guard/use-auth-context';
import { AppRoutes } from '@/routes';
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/(home)/settings/networks/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NetworkBadge } from '@/components/badges/network-badge';
import { AnimatedHeaderScreenLayout } from '@/components/headers/animated-header/animated-header-screen.layout';
import { NetworkBadge } from '@/components/network-badge';
import { useToastContext } from '@/components/toast/toast-context';
import { useSettings } from '@/store/settings/settings';
import { defaultNetworkPreferences } from '@/store/settings/utils';
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/(home)/settings/security/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRef } from 'react';

import { NetworkBadge } from '@/components/badges/network-badge';
import { AnimatedHeaderScreenLayout } from '@/components/headers/animated-header/animated-header-screen.layout';
import { NetworkBadge } from '@/components/network-badge';
import { AnalyticsSheet } from '@/features/settings/analytics-sheet';
import { AppAuthenticationSheet } from '@/features/settings/app-authentication-sheet';
import { useSettings } from '@/store/settings/settings';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useRef } from 'react';

import { AvatarIcon } from '@/components/avatar-icon';
import { NetworkBadge } from '@/components/badges/network-badge';
import { AnimatedHeaderScreenLayout } from '@/components/headers/animated-header/animated-header-screen.layout';
import { NetworkBadge } from '@/components/network-badge';
import { useToastContext } from '@/components/toast/toast-context';
import { AccountCard } from '@/features/settings/wallet-and-accounts/account-card';
import { AccountNameSheet } from '@/features/settings/wallet-and-accounts/account-name-sheet';
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/(home)/settings/wallet/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useRef } from 'react';

import { AddWalletSheet } from '@/components/add-wallet/';
import { NetworkBadge } from '@/components/badges/network-badge';
import { Divider } from '@/components/divider';
import { AnimatedHeaderScreenLayout } from '@/components/headers/animated-header/animated-header-screen.layout';
import { NetworkBadge } from '@/components/network-badge';
import { WalletsList } from '@/features/settings/wallet-and-accounts/wallets-list';
import { AppRoutes } from '@/routes';
import { useAccounts } from '@/store/accounts/accounts.read';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import { useWindowDimensions } from 'react-native';

import { ToastWrapper } from '@/components/toast/toast-context';
import { HasChildren } from '@/utils/types';
import { NavigationContainer } from '@react-navigation/native';

import { Box } from '@leather.io/ui/native';

export function SheetNavigationContainer({ children }: HasChildren) {
const { height } = useWindowDimensions();
return (
<ToastWrapper>
<Box flex={1} height={height}>
<NavigationContainer independent>{children}</NavigationContainer>
</Box>
<NavigationContainer independent>{children}</NavigationContainer>
</ToastWrapper>
);
}
56 changes: 56 additions & 0 deletions apps/mobile/src/components/badges/badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { ResponsiveValue } from '@shopify/restyle';

import { Box, Pressable, PressableProps, Text, Theme } from '@leather.io/ui/native';
import { match } from '@leather.io/utils';

export type BadgeVariant = 'success' | 'warning' | 'error' | 'default' | 'info';

interface BadgeProps extends PressableProps {
title: string;
variant: BadgeVariant;
}

export function Badge(props: BadgeProps) {
const matchBadgeVariant = match<BadgeVariant>();

const backgroundColor = matchBadgeVariant<
ResponsiveValue<keyof Theme['colors'], Theme['breakpoints']>
>(props.variant, {
success: 'green.background-primary',
warning: 'yellow.background-primary',
error: 'red.background-primary',
default: 'ink.background-secondary',
info: 'blue.background-primary',
});

const borderColor = matchBadgeVariant<
ResponsiveValue<keyof Theme['colors'], Theme['breakpoints']>
>(props.variant, {
success: 'green.border',
warning: 'yellow.border',
error: 'red.border',
default: 'ink.border-transparent',
info: 'blue.border',
});

const textColor = matchBadgeVariant<ResponsiveValue<keyof Theme['colors'], Theme['breakpoints']>>(
props.variant,
{
success: 'green.action-primary-default',
warning: 'yellow.action-primary-default',
error: 'red.action-primary-default',
default: 'ink.text-subdued',
info: 'blue.action-primary-default',
}
);

return (
<Pressable {...props}>
<Box bg={backgroundColor} borderColor={borderColor} borderRadius="xs" borderWidth={1} p="1">
<Text variant="label03" color={textColor}>
{props.title}
</Text>
</Box>
</Pressable>
);
}
44 changes: 44 additions & 0 deletions apps/mobile/src/components/badges/fee-badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { useLingui } from '@lingui/react';

import { match } from '@leather.io/utils';

import { Badge, BadgeVariant } from './badge';

type FeeType = 'low' | 'normal' | 'high' | 'extremely-high';

interface FeeBadgeProps {
type: FeeType;
}

export function FeeBadge(props: FeeBadgeProps) {
const { i18n } = useLingui();
const matchVariant = match<FeeType>();

const variant = matchVariant<BadgeVariant>(props.type, {
low: 'success',
normal: 'default',
high: 'error',
'extremely-high': 'error',
});

const title = matchVariant<string>(props.type, {
low: i18n._({
id: 'approval-ux.fees.low',
message: 'currently low',
}),
normal: i18n._({
id: 'approval-ux.fees.normal',
message: 'currently normal',
}),
high: i18n._({
id: 'approval-ux.fees.high',
message: 'currently high',
}),
'extremely-high': i18n._({
id: 'approval-ux.fees.extremely-high',
message: 'currently extremely high',
}),
});

return <Badge variant={variant} px="1" title={title} />;
}
25 changes: 25 additions & 0 deletions apps/mobile/src/components/badges/network-badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { AppRoutes } from '@/routes';
import { useSettings } from '@/store/settings/settings';
import { useLingui } from '@lingui/react';
import { useRouter } from 'expo-router';

import { Badge } from './badge';

export function NetworkBadge() {
const router = useRouter();
const { i18n } = useLingui();
const { networkPreference } = useSettings();

return (
<Badge
variant="default"
px="3"
onPress={() => router.navigate(AppRoutes.SettingsNetworks)}
title={i18n._({
id: 'settings.header_network',
message: '{network}',
values: { network: networkPreference.name },
})}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export function FullHeightSheet({ children, sheetRef }: FullHeightSheetProps) {
const { themeDerivedFromThemePreference } = useSettings();

return (
<Sheet isFullHeight isScrollView ref={sheetRef} themeVariant={themeDerivedFromThemePreference}>
<Sheet
isFullHeight
shouldHaveContainer={false}
ref={sheetRef}
themeVariant={themeDerivedFromThemePreference}
>
{children}
</Sheet>
);
Expand Down
32 changes: 0 additions & 32 deletions apps/mobile/src/components/network-badge.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { t } from '@lingui/macro';

import { ChevronDownIcon, ChevronUpIcon, Pressable, Text } from '@leather.io/ui/native';

export function AdvancedDetailsButton({
isAdvancedOpen,
setIsAdvancedOpen,
}: {
isAdvancedOpen: boolean;
setIsAdvancedOpen(value: boolean): void;
}) {
const buttonTitle = isAdvancedOpen ? t`Hide advanced details` : t`Show advanced details`;
const chevron = isAdvancedOpen ? <ChevronUpIcon /> : <ChevronDownIcon />;
return (
<Pressable
flexDirection="row"
py="3"
my="3"
px="5"
justifyContent="space-between"
bg="ink.background-secondary"
onPress={() => setIsAdvancedOpen(!isAdvancedOpen)}
>
<Text variant="label01">{buttonTitle}</Text>
{chevron}
</Pressable>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { AvatarIcon } from '@/components/avatar-icon';
import { AccountListItem } from '@/features/account-list/account-list-item';
import { useWallets } from '@/store/wallets/wallets.read';
import { t } from '@lingui/macro';
import { useTheme } from '@shopify/restyle';

import { Text, Theme } from '@leather.io/ui/native';

export function ApproverAccountCard() {
const theme = useTheme<Theme>();
const { list: walletsList } = useWallets();
const wallet = walletsList[0];
/* eslint-disable-next-line lingui/no-unlocalized-strings */
const testAccountName = 'testName';
return (
<>
<Text variant="label01">{t`With account`}</Text>
<AccountListItem
accountName={testAccountName}
address={t`Address`}
balance={t`$1234`}
icon={<AvatarIcon color={theme.colors['ink.background-primary']} icon="code" />}
walletName={wallet?.name}
/>
</>
);
}
Loading

0 comments on commit f9b9a33

Please sign in to comment.