Skip to content

Commit 243c497

Browse files
committed
[TOOL-2821] Improve performance of snapshot viewer component + fix date not shown in phases (#5824)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the `date-utils` and `claim-conditions` components, updating the handling of date types, and refactoring the `SnapshotUpload` component to improve data processing and user experience. It also introduces a new dependency, `p-limit`, for better concurrency control. ### Detailed summary - Updated `toDateTimeLocal` function to handle `Date` instances directly. - Replaced `SnapshotUpload` with `SnapshotViewerSheet` in `claim-conditions-form`. - Enhanced `AirdropUpload` to show a loading spinner when data is being normalized. - Refactored `useCsvUpload` to use `useQuery` instead of `useQueries`. - Improved error handling and data validation in `SnapshotUpload`. - Added new dependency `p-limit` for managing concurrent requests. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 5f8e570 commit 243c497

File tree

7 files changed

+269
-218
lines changed

7 files changed

+269
-218
lines changed

apps/dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"next-themes": "^0.4.4",
7575
"nextjs-toploader": "^1.6.12",
7676
"openapi-types": "^12.1.3",
77+
"p-limit": "^6.2.0",
7778
"papaparse": "^5.4.1",
7879
"pluralize": "^8.0.0",
7980
"posthog-js": "1.67.1",

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import {
5050
type SnapshotEntry,
5151
} from "../legacy-zod-schema";
5252
import { ResetClaimEligibility } from "../reset-claim-eligibility";
53-
import { SnapshotUpload } from "../snapshot-upload";
53+
import { SnapshotViewerSheet } from "../snapshot-upload";
5454
import { getClaimPhasesInLegacyFormat, setClaimPhasesTx } from "./hooks";
5555
import { ClaimConditionsPhase } from "./phase";
5656

@@ -511,11 +511,12 @@ export const ClaimConditionsForm: React.FC<ClaimConditionsFormProps> = ({
511511

512512
return (
513513
<Fragment key={`snapshot_${field.id}_${index}`}>
514-
<SnapshotUpload
514+
<SnapshotViewerSheet
515515
dropType={dropType}
516-
snapshotIndex={openSnapshotIndex}
517-
index={index}
518-
setOpenSnapshotIndex={setOpenSnapshotIndex}
516+
isOpen={openSnapshotIndex === index}
517+
onClose={() => {
518+
setOpenSnapshotIndex(-1);
519+
}}
519520
value={snapshotValue}
520521
setSnapshot={(snapshot) =>
521522
form.setValue(`phases.${index}.snapshot`, snapshot)

0 commit comments

Comments
 (0)