Skip to content

Commit

Permalink
✨ app: implement empty state for payments
Browse files Browse the repository at this point in the history
  • Loading branch information
dieguezguille committed Nov 27, 2024
1 parent a2b6173 commit 03e15d7
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .changeset/warm-pants-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@exactly/mobile": patch
---

✨ implement empty state for payments screen
33 changes: 33 additions & 0 deletions src/components/payments/Empty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react";
import { StyleSheet } from "react-native";
import { YStack } from "tamagui";

import Blob from "../../assets/images/exa-card-blob.svg";
import ExaCard from "../../assets/images/exa-card.svg";
import Text from "../shared/Text";
import View from "../shared/View";

export default function Empty() {
return (
<View fullScreen padding="$s5" alignItems="center" justifyContent="center" backgroundColor="$backgroundSoft">
<YStack gap="$s6" alignItems="center" justifyContent="center">
<View width="100%" aspectRatio={1} justifyContent="center" alignItems="center">
<View width="100%" height="100%">
<Blob width="100%" height="100%" />
</View>
<View width="100%" height="100%" style={StyleSheet.absoluteFillObject}>
<ExaCard width="100%" height="100%" />
</View>
</View>
<YStack alignItems="center" justifyContent="center" gap="$s6">
<Text emphasized title color="$interactiveTextBrandDefault" textAlign="center">
No payments pending
</Text>
<Text footnote secondary textAlign="center">
You&apos;re all caught up! Start using your card to see payments listed here.
</Text>
</YStack>
</YStack>
</View>
);
}
73 changes: 40 additions & 33 deletions src/components/payments/Payments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ms } from "react-native-size-matters";
import { ScrollView } from "tamagui";
import { zeroAddress } from "viem";

import Empty from "./Empty";
import NextPayment from "./NextPayment";
import UpcomingPayments from "./UpcomingPayments";
import { useReadPreviewerExactly } from "../../generated/contracts";
Expand Down Expand Up @@ -32,7 +33,7 @@ export default function Payments() {
<View fullScreen backgroundColor="$backgroundMild">
<ScrollView
flex={1}
backgroundColor="$backgroundMild"
backgroundColor={usdDue === 0n ? "$backgroundSoft" : "$backgroundMild"}
refreshControl={
<RefreshControl
backgroundColor="$backgroundSoft"
Expand All @@ -45,42 +46,48 @@ export default function Payments() {
/>
}
>
<View padded gap="$s5" backgroundColor="$backgroundSoft">
<View flexDirection="row" gap={ms(10)} justifyContent="space-between" alignItems="center">
<Text fontSize={ms(20)} fontWeight="bold">
Payments
</Text>
</View>
<View gap="$s8">
<View gap="$s6">
<View flexDirection="column" justifyContent="center" alignItems="center">
<Text
sensitive
textAlign="center"
fontFamily="$mono"
fontSize={ms(40)}
fontWeight="bold"
overflow="hidden"
>
{(Number(usdDue) / 1e18).toLocaleString(undefined, {
style: "currency",
currency: "USD",
currencyDisplay: "narrowSymbol",
})}
{usdDue === 0n ? (
<Empty />
) : (
<>
<View padded gap="$s5" backgroundColor="$backgroundSoft">
<View flexDirection="row" gap={ms(10)} justifyContent="space-between" alignItems="center">
<Text fontSize={ms(20)} fontWeight="bold">
Payments
</Text>
</View>
<View gap="$s3" alignItems="center">
<Text emphasized title3 color="$uiNeutralSecondary">
Total debt
</Text>
<View gap="$s8">
<View gap="$s6">
<View flexDirection="column" justifyContent="center" alignItems="center">
<Text
sensitive
textAlign="center"
fontFamily="$mono"
fontSize={ms(40)}
fontWeight="bold"
overflow="hidden"
>
{(Number(usdDue) / 1e18).toLocaleString(undefined, {
style: "currency",
currency: "USD",
currencyDisplay: "narrowSymbol",
})}
</Text>
</View>
<View gap="$s3" alignItems="center">
<Text emphasized title3 color="$uiNeutralSecondary">
Total debt
</Text>
</View>
</View>
</View>
</View>
</View>
</View>
<View padded gap="$s6">
<NextPayment />
<UpcomingPayments />
</View>
<View padded gap="$s6">
<NextPayment />
<UpcomingPayments />
</View>
</>
)}
</ScrollView>
</View>
</SafeView>
Expand Down

0 comments on commit 03e15d7

Please sign in to comment.