Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(finance): add loading state to quick transfer #544

Merged
merged 3 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/sections/finance/components/finance-quick-transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from "@src/sections/finance/components/finance-no-followings-quick-transfer";
import FinanceDisplayProfileInfo from "@src/sections/finance/components/finance-display-profile-info";
import {handleAmountConstraints} from "@src/utils/format-number.ts";
import {LoadingScreen} from "@src/components/loading-screen";

// ----------------------------------------------------------------------

Expand All @@ -41,10 +42,11 @@
// A thousand millions allowed in the pool
export const MAX_POOL: number = 1000000000;

interface Props extends CardProps {
export interface FinanceQuickTransferProps extends CardProps {
title?: string;
subheader?: string;
list: Profile[] | null | undefined;
loading: boolean;
}

export const isValidAddress = (address: string): boolean => {
Expand All @@ -58,8 +60,9 @@
subheader,
sx,
list: initialList,
loading,

Check warning on line 63 in src/sections/finance/components/finance-quick-transfer.tsx

View check run for this annotation

Codecov / codecov/patch

src/sections/finance/components/finance-quick-transfer.tsx#L63

Added line #L63 was not covered by tests
...other
}: Props) {
}: FinanceQuickTransferProps) {

Check warning on line 65 in src/sections/finance/components/finance-quick-transfer.tsx

View check run for this annotation

Codecov / codecov/patch

src/sections/finance/components/finance-quick-transfer.tsx#L65

Added line #L65 was not covered by tests
const theme = useTheme();
const dispatch = useDispatch();

Expand Down Expand Up @@ -396,12 +399,12 @@
/>

{/* Content */}
<Stack sx={{ p: 3 }}>
{ loading ? <LoadingScreen sx={{marginBottom: 5}} /> : (<Stack sx={{ p: 3 }}>

Check warning on line 402 in src/sections/finance/components/finance-quick-transfer.tsx

View check run for this annotation

Codecov / codecov/patch

src/sections/finance/components/finance-quick-transfer.tsx#L402

Added line #L402 was not covered by tests
<FinanceDisplayProfileInfo mode={'profile'} initialList={list} carousel={carousel} />
{list?.length > 0 ? renderCarousel : <FinanceNoFollowingsQuickTransfer />}
<FinanceDisplayProfileInfo mode={'wallet'} initialList={list} carousel={carousel} />
{renderInput}
</Stack>
</Stack>) }

Check warning on line 407 in src/sections/finance/components/finance-quick-transfer.tsx

View check run for this annotation

Codecov / codecov/patch

src/sections/finance/components/finance-quick-transfer.tsx#L407

Added line #L407 was not covered by tests
</Stack>
</Wrapper>

Expand Down
5 changes: 3 additions & 2 deletions src/sections/finance/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
const { transactions, loading } = useGetSmartWalletTransactions();
const [widgetSeriesData, setWidgetSeriesData] = useState<{ x: string; y: number }[]>([]);
const [percent, setPercent] = useState(0);
const { data: results } = useProfileFollowing({
const { data: results, loading: loadingProfiles } = useProfileFollowing({

Check warning on line 32 in src/sections/finance/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/sections/finance/index.tsx#L32

Added line #L32 was not covered by tests
// @ts-ignore
for: sessionData?.profile?.id,
});
Expand Down Expand Up @@ -80,7 +80,7 @@
}}
/>

{!mdUp ? <FinanceQuickTransfer list={following} /> : null}
{!mdUp ? <FinanceQuickTransfer list={following} loading={loadingProfiles} /> : null}

Check warning on line 83 in src/sections/finance/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/sections/finance/index.tsx#L83

Added line #L83 was not covered by tests
{lgUp ? <FinanceEarnTokens lgUp={lgUp} /> : null}
</Stack>

Expand Down Expand Up @@ -114,6 +114,7 @@
<Grid xs={12} md={4}>
<Stack spacing={2}>
<FinanceQuickTransfer
loading={loadingProfiles}

Check warning on line 117 in src/sections/finance/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/sections/finance/index.tsx#L117

Added line #L117 was not covered by tests
list={following}
sx={{
display: { xs: 'none', md: 'flex' },
Expand Down