From 2114e5f91fa3c4a0f518699fcef03db1fcf706c4 Mon Sep 17 00:00:00 2001
From: pinkhoodie <36429880+pinkhoodie@users.noreply.github.com>
Date: Mon, 2 Jun 2025 20:57:20 +0000
Subject: [PATCH] Add text input option to airdrop setup (#7238)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Add manual text input alternative to CSV upload for airdrop addresses
- Support multiple input formats: space, comma, equals, and tab separated
- Parse text input and convert to CSV format for existing validation system
- Reuse all existing functionality: ENS resolution, address validation, duplicate removal
- Maintain same validation flow and error handling as CSV upload
- Change button text from 'Upload CSV' to 'Set up Airdrop' for clarity


---
## PR-Codex overview
This PR enhances the CSV upload functionality in the `TokenAirdropSection` component. It introduces a new method for processing CSV data, allows manual entry of addresses and amounts, and updates UI labels to reflect the new functionality.
### Detailed summary
- Added `processData` function in `useCsvUpload` for processing parsed CSV data.
- Updated `TokenAirdropSection` UI labels from "CSV File Uploaded" to "Airdrop List Set".
- Changed button text from "View CSV" to "View List".
- Introduced `parseTextInput` function for manual input parsing.
- Added text input for entering addresses and amounts.
- Implemented handling for text input submission.
- Updated the layout to separate CSV upload and manual entry sections.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
## Summary by CodeRabbit
- **New Features**
- Added the ability to manually enter airdrop addresses and amounts using a text area, supporting multiple input formats.
- Users can now choose between uploading a CSV file or entering addresses and amounts directly.
- **UI Updates**
- Updated labels and button texts to reflect support for both CSV and manual list input.
- Improved layout with a visual divider and clear instructions for manual entry.
- Enhanced reset and validation behaviors for both input methods.
---
.../create/distribution/token-airdrop.tsx | 258 ++++++++++++------
apps/dashboard/src/hooks/useCsvUpload.ts | 15 +
2 files changed, 196 insertions(+), 77 deletions(-)
diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/distribution/token-airdrop.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/distribution/token-airdrop.tsx
index 61b3a0b2239..0c485759c3b 100644
--- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/distribution/token-airdrop.tsx
+++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/distribution/token-airdrop.tsx
@@ -23,6 +23,7 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
+import { Textarea } from "@/components/ui/textarea";
import { cn } from "@/lib/utils";
import { useCsvUpload } from "hooks/useCsvUpload";
import {
@@ -92,7 +93,7 @@ export function TokenAirdropSection(props: {
{/* left */}
-
CSV File Uploaded
+
Airdrop List Set
{airdropAddresses.length}
@@ -109,14 +110,14 @@ export function TokenAirdropSection(props: {
- Airdrop CSV
+ Airdrop List
- Airdrop CSV File
+ Set up Airdrop
- Upload a CSV file to airdrop tokens to a list of
- addresses
+ Upload a CSV file or enter comma-separated addresses and
+ amounts to airdrop tokens
- Upload CSV
+ Set up Airdrop