Skip to content

Commit 4e5fdcf

Browse files
committed
Fix claim condition loading state + UI tweaks (#5141)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on refactoring the `ClaimConditionsForm` component in the `claim-conditions` files to improve layout and loading state handling. ### Detailed summary - Updated `Flex` component properties in `claim-conditions.tsx` for layout consistency. - Added a loading spinner in `claim-conditions-form/index.tsx` to handle fetching state. - Removed the previous spinner implementation for a cleaner loading experience. - Adjusted `flexDir` property for better responsiveness. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent eaeb532 commit 4e5fdcf

File tree

2 files changed

+11
-19
lines changed
  • apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions

2 files changed

+11
-19
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/claim-conditions-form/index.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Spinner } from "@/components/ui/Spinner/Spinner";
34
import { ToolTipLabel } from "@/components/ui/tooltip";
45
import { AdminOnly } from "@3rdweb-sdk/react/components/roles/admin-only";
56
import { useIsAdmin } from "@3rdweb-sdk/react/hooks/useContractRoles";
@@ -13,7 +14,6 @@ import {
1314
Menu,
1415
MenuButton,
1516
MenuList,
16-
Spinner,
1717
} from "@chakra-ui/react";
1818
import { TransactionButton } from "components/buttons/TransactionButton";
1919
import { useTrack } from "hooks/analytics/useTrack";
@@ -445,19 +445,16 @@ export const ClaimConditionsForm: React.FC<ClaimConditionsFormProps> = ({
445445
};
446446
}, [claimConditionsQuery.data, controlledFields, isMultiPhase]);
447447

448+
if (isFetchingData) {
449+
return (
450+
<div className="flex h-[400px] w-full items-center justify-center rounded-lg border border-border">
451+
<Spinner className="size-10" />
452+
</div>
453+
);
454+
}
455+
448456
return (
449457
<>
450-
{/* spinner */}
451-
{isFetchingData && (
452-
<Spinner
453-
color="primary"
454-
size="xs"
455-
position="absolute"
456-
top={2}
457-
right={4}
458-
/>
459-
)}
460-
461458
<Flex onSubmit={handleFormSubmit} direction="column" as="form" gap={10}>
462459
<Flex direction="column" gap={6}>
463460
{/* Show the reason why the form is disabled */}
@@ -553,7 +550,7 @@ export const ClaimConditionsForm: React.FC<ClaimConditionsFormProps> = ({
553550

554551
<Flex
555552
justifyContent="space-between"
556-
flexDir={{ base: "column", md: isColumn ? "column" : "row" }}
553+
flexDir={{ base: "column", md: "row" }}
557554
gap={2}
558555
>
559556
<div className="flex flex-row gap-2">

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/claim-conditions.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ export const ClaimConditions: React.FC<ClaimConditionsProps> = ({
1919
return (
2020
<div className="flex w-full flex-col gap-8">
2121
<Flex p={0} position="relative">
22-
<Flex
23-
pt={{ base: isColumn ? 0 : 6, md: 6 }}
24-
direction="column"
25-
gap={8}
26-
w="full"
27-
>
22+
<Flex direction="column" gap={6} w="full">
2823
{/* Info */}
2924
<section>
3025
<h2 className="mb-1 font-semibold text-xl tracking-tight">

0 commit comments

Comments
 (0)