From ca466ddc235a23fd8d97597b96cd54b44a3a2c46 Mon Sep 17 00:00:00 2001 From: Benjtalkshow Date: Sun, 17 Aug 2025 10:40:42 +0100 Subject: [PATCH 1/6] feat: initialize back project flow and project history demo page --- app/user/back-project/page.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/user/back-project/page.tsx diff --git a/app/user/back-project/page.tsx b/app/user/back-project/page.tsx new file mode 100644 index 000000000..3856f2a1f --- /dev/null +++ b/app/user/back-project/page.tsx @@ -0,0 +1,13 @@ +import { BoundlessButton } from '@/components/buttons'; +import React from 'react'; + +const page = () => { + return ( +
+ Back Project + View History +
+ ); +}; + +export default page; From 3b254b7bccba51c7df3b8b66e4ece418a00b6d29 Mon Sep 17 00:00:00 2001 From: Benjtalkshow Date: Sun, 17 Aug 2025 23:20:05 +0100 Subject: [PATCH 2/6] fix: implement back project form --- app/globals.css | 12 ++ app/user/back-project/page.tsx | 13 -- .../flows/back-project/back-project-form.tsx | 202 ++++++++++++++++++ components/flows/back-project/index.tsx | 111 ++++++++++ .../project-submission-loading.tsx | 15 ++ .../project/ProjectSubmissionSuccess.tsx | 42 +++- 6 files changed, 371 insertions(+), 24 deletions(-) delete mode 100644 app/user/back-project/page.tsx create mode 100644 components/flows/back-project/back-project-form.tsx create mode 100644 components/flows/back-project/index.tsx create mode 100644 components/flows/back-project/project-submission-loading.tsx diff --git a/app/globals.css b/app/globals.css index 532b272b2..e8921ec9c 100644 --- a/app/globals.css +++ b/app/globals.css @@ -134,3 +134,15 @@ button { cursor: pointer; } +/* Hide arrows in Chrome, Safari, Edge, Opera */ +input[type='number']::-webkit-inner-spin-button, +input[type='number']::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} + +/* Hide arrows in Firefox */ +input[type='number'] { + -moz-appearance: textfield; + appearance: textfield; +} diff --git a/app/user/back-project/page.tsx b/app/user/back-project/page.tsx deleted file mode 100644 index 3856f2a1f..000000000 --- a/app/user/back-project/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { BoundlessButton } from '@/components/buttons'; -import React from 'react'; - -const page = () => { - return ( -
- Back Project - View History -
- ); -}; - -export default page; diff --git a/components/flows/back-project/back-project-form.tsx b/components/flows/back-project/back-project-form.tsx new file mode 100644 index 000000000..99b54750d --- /dev/null +++ b/components/flows/back-project/back-project-form.tsx @@ -0,0 +1,202 @@ +'use client'; + +import type React from 'react'; +import { useState } from 'react'; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from '@/components/ui/select'; +import { Checkbox } from '@/components/ui/checkbox'; +import { ArrowLeft, Check, Copy } from 'lucide-react'; +import { BoundlessButton } from '@/components/buttons'; + +interface BackProjectFormProps { + onSubmit: (data: { + amount: string; + currency: string; + token: string; + network: string; + walletAddress: string; + keepAnonymous: boolean; + }) => void; + isLoading?: boolean; +} + +const QUICK_AMOUNTS = [10, 20, 30, 50, 100, 500, 1000]; + +export function BackProjectForm({ + onSubmit, + isLoading = false, +}: BackProjectFormProps) { + const [amount, setAmount] = useState(''); + const [currency] = useState('USDT'); + const [token, setToken] = useState(''); + const [network, setNetwork] = useState('Stella / Soroban'); + const [walletAddress] = useState('GDS3...GB7'); + const [keepAnonymous, setKeepAnonymous] = useState(false); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + onSubmit({ + amount, + currency, + token, + network, + walletAddress, + keepAnonymous, + }); + }; + + const handleQuickAmount = (quickAmount: number) => { + setAmount(quickAmount.toString()); + }; + + const handleCopyAddress = async (e: React.MouseEvent) => { + e.preventDefault(); + try { + await navigator.clipboard.writeText(walletAddress); + // Could add toast notification here instead of state + } catch (err) { + // Fallback for browsers that don't support clipboard API + const textArea = document.createElement('textarea'); + console.error(err); + + textArea.value = walletAddress; + document.body.appendChild(textArea); + textArea.select(); + try { + document.execCommand('copy'); + } catch (copyErr) { + console.error('Failed to copy address:', copyErr); + } + document.body.removeChild(textArea); + } + }; + + const isFormValid = amount && currency && token && walletAddress; + + return ( +
+
+ +

Back Project

+
+
+
+

+ Funds will be held in escrow and released only upon milestone + approvals. +

+
+ +
+ +
+ {currency} + setAmount(e.target.value)} + type='number' + className='w-full bg-transparent font-normal text-base text-placeholder focus:outline-none' + placeholder='1000' + disabled={isLoading} + /> +
+

min. amount: $10

+ +
+ {QUICK_AMOUNTS.map(quickAmount => ( + + ))} +
+
+ +
+ + +
+ +
+ +
+ setNetwork(e.target.value)} + type='text' + className='w-full bg-transparent font-normal text-base text-placeholder focus:outline-none' + disabled={isLoading} + /> +
+
+ +
+ + + + {walletAddress} + + +
+ +
+ setKeepAnonymous(checked as boolean)} + disabled={isLoading} + className='border-stepper-border data-[state=checked]:bg-primary data-[state=checked]:border-primary' + /> + +
+ + + Confirm Contribution + +
+
+ ); +} diff --git a/components/flows/back-project/index.tsx b/components/flows/back-project/index.tsx new file mode 100644 index 000000000..2f7d0d103 --- /dev/null +++ b/components/flows/back-project/index.tsx @@ -0,0 +1,111 @@ +'use client'; + +import { useState } from 'react'; +import { BoundlessButton } from '@/components/buttons'; +import { ProjectSubmissionSuccess } from '@/components/project'; +import BoundlessSheet from '@/components/sheet/boundless-sheet'; +import { ProjectSubmissionLoading } from '@/components/flows/back-project/project-submission-loading'; +import { BackProjectForm } from './back-project-form'; + +type BackProjectState = 'form' | 'loading' | 'success'; + +interface BackProjectData { + amount: string; + currency: string; + token: string; + network: string; + walletAddress: string; + keepAnonymous: boolean; +} + +const BackProject = () => { + const [isSheetOpen, setIsSheetOpen] = useState(false); + const [backProjectState, setBackProjectState] = + useState('form'); + + const handleBackProject = (data: BackProjectData) => { + setBackProjectState('loading'); + console.log(data); + + // Simulate API call + setTimeout(() => { + setBackProjectState('success'); + }, 2000); + }; + + // const handleContinue = () => { + // setIsSheetOpen(false) + // setBackProjectState("form") + // } + + // const handleViewHistory = () => { + // // Navigate to history page or open history modal + // setIsSheetOpen(false) + // // TODO: Implement backing history modal or navigation + // } + + // const handleBack = () => { + // if (backProjectState === "success") { + // setBackProjectState("form") + // } + // } + + const renderSheetContent = () => { + if (backProjectState === 'success') { + return ( +
+
+ {/* */} +
+ +
+ ); + } + + return ( +
+ + + {backProjectState === 'loading' && ( +
+ +
+ )} +
+ ); + }; + + return ( +
+ + {renderSheetContent()} + + + setIsSheetOpen(true)}> + Back Project + +
+ ); +}; + +export default BackProject; diff --git a/components/flows/back-project/project-submission-loading.tsx b/components/flows/back-project/project-submission-loading.tsx new file mode 100644 index 000000000..4dc27ea2d --- /dev/null +++ b/components/flows/back-project/project-submission-loading.tsx @@ -0,0 +1,15 @@ +export function ProjectSubmissionLoading() { + return ( +
+
+ {/* Outer spinning ring */} +
+ {/* Inner spinning arc */} +
+
+

+ Processing your contribution... +

+
+ ); +} diff --git a/components/project/ProjectSubmissionSuccess.tsx b/components/project/ProjectSubmissionSuccess.tsx index cc3683512..fa2e2e31c 100644 --- a/components/project/ProjectSubmissionSuccess.tsx +++ b/components/project/ProjectSubmissionSuccess.tsx @@ -1,26 +1,46 @@ import Image from 'next/image'; +import Link from 'next/link'; import React from 'react'; -function ProjectSubmissionSuccess() { +interface ProjectSubmissionSuccessProps { + title?: string; + description?: string; + linkSection?: string; + linkName?: string; + url?: string; + continueAction?: () => void; +} + +function ProjectSubmissionSuccess({ + title = 'Project Submitted!', + description = 'Your project has been submitted and is now under admin review. You’ll receive an update within 72 hours. Once approved, your project will proceed to public validation.', + linkSection = 'You can track the status of your submission anytime on the', + linkName = 'Projects page.', + url = '/projects', + continueAction, +}: ProjectSubmissionSuccessProps) { return (
-
Project Submitted!
-
+
{title}
+
done
-
+

- Your project has been submitted and is now under admin review. You’ll - receive an update within 72 hours. Once approved, your project will - proceed to public validation. + {description}

-

- You can track the status of your submission anytime on the{' '} - Projects page. +

+ {linkSection}{' '} + + {linkName} +

-
From 1312a12e65310e2760f579d9ab71edb1fe1cf27e Mon Sep 17 00:00:00 2001 From: Benjtalkshow Date: Tue, 19 Aug 2025 10:32:31 +0100 Subject: [PATCH 3/6] fix: fix back project flow --- components/flows/back-project/index.tsx | 2 +- lib/data/backing-history-mock.ts | 142 ++++++++++++++++++++++++ types/backing-history.ts | 32 ++++++ 3 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 lib/data/backing-history-mock.ts create mode 100644 types/backing-history.ts diff --git a/components/flows/back-project/index.tsx b/components/flows/back-project/index.tsx index 2f7d0d103..972d5a0e9 100644 --- a/components/flows/back-project/index.tsx +++ b/components/flows/back-project/index.tsx @@ -95,7 +95,7 @@ const BackProject = () => { setOpen={setIsSheetOpen} // title="Back Project" showCloseButton={true} - contentClassName={backProjectState === 'form' ? 'h-[60vh]' : 'h-[85vh]'} + contentClassName={`h-[100vh]`} className='mx-4' > {renderSheetContent()} diff --git a/lib/data/backing-history-mock.ts b/lib/data/backing-history-mock.ts new file mode 100644 index 000000000..3de9417e2 --- /dev/null +++ b/lib/data/backing-history-mock.ts @@ -0,0 +1,142 @@ +import type { BackingHistoryItem } from '@/types/backing-history'; + +export const mockBackingHistory: BackingHistoryItem[] = [ + { + id: '1', + backer: { + name: 'Collins Odumeje', + isAnonymous: false, + avatar: '/diverse-user-avatars.png', + walletAddress: 'GDS3...GB7', + }, + amount: 2300, + currency: 'USDT', + date: new Date('2025-08-17'), + timeAgo: '3s', + }, + { + id: '2', + backer: { + name: 'Sarah Chen', + isAnonymous: false, + avatar: '/diverse-user-avatars.png', + walletAddress: 'ABC1...XYZ', + }, + amount: 1500, + currency: 'USDT', + date: new Date('2025-08-16'), + timeAgo: '1d', + }, + { + id: '3', + backer: { + name: 'Anonymous', + isAnonymous: true, + avatar: '/anonymous-user-concept.png', + walletAddress: 'DEF4...789', + }, + amount: 5000, + currency: 'USDT', + date: new Date('2025-08-15'), + timeAgo: '2d', + }, + { + id: '4', + backer: { + name: 'Michael Rodriguez', + isAnonymous: false, + avatar: '/diverse-user-avatars.png', + walletAddress: 'HIJ7...456', + }, + amount: 750, + currency: 'USDT', + date: new Date('2025-08-14'), + timeAgo: '3d', + }, + { + id: '5', + backer: { + name: 'Anonymous', + isAnonymous: true, + avatar: '/anonymous-user-concept.png', + walletAddress: 'KLM0...123', + }, + amount: 3200, + currency: 'USDT', + date: new Date('2025-08-13'), + timeAgo: '4d', + }, + { + id: '6', + backer: { + name: 'Emma Thompson', + isAnonymous: false, + avatar: '/diverse-user-avatars.png', + walletAddress: 'NOP3...890', + }, + amount: 1800, + currency: 'USDT', + date: new Date('2025-08-12'), + timeAgo: '5d', + }, + { + id: '7', + backer: { + name: 'David Kim', + isAnonymous: false, + avatar: '/diverse-user-avatars.png', + walletAddress: 'QRS6...567', + }, + amount: 4500, + currency: 'USDT', + date: new Date('2025-08-11'), + timeAgo: '6d', + }, + { + id: '8', + backer: { + name: 'Anonymous', + isAnonymous: true, + avatar: '/anonymous-user-concept.png', + walletAddress: 'TUV9...234', + }, + amount: 950, + currency: 'USDT', + date: new Date('2025-08-10'), + timeAgo: '1w', + }, + { + id: '9', + backer: { + name: 'Lisa Wang', + isAnonymous: false, + avatar: '/diverse-user-avatars.png', + walletAddress: 'WXY2...901', + }, + amount: 2750, + currency: 'USDT', + date: new Date('2025-08-09'), + timeAgo: '1w', + }, + { + id: '10', + backer: { + name: 'Anonymous', + isAnonymous: true, + avatar: '/anonymous-user-concept.png', + walletAddress: 'ZAB5...678', + }, + amount: 6200, + currency: 'USDT', + date: new Date('2025-08-08'), + timeAgo: '1w', + }, +]; + +export const sortOptions = [ + { value: 'newest', label: 'Newest first' }, + { value: 'oldest', label: 'Oldest first' }, + { value: 'alphabetical', label: 'Alphabetical' }, + { value: 'amount-high', label: 'Highest first' }, + { value: 'amount-low', label: 'Lowest first' }, +]; diff --git a/types/backing-history.ts b/types/backing-history.ts new file mode 100644 index 000000000..054c4506b --- /dev/null +++ b/types/backing-history.ts @@ -0,0 +1,32 @@ +export interface BackingHistoryItem { + id: string; + backer: { + name: string; + isAnonymous: boolean; + avatar?: string; + walletAddress: string; + }; + amount: number; + currency: string; + date: Date; + timeAgo: string; +} + +export interface BackingHistoryFilters { + searchQuery: string; + sortBy: 'newest' | 'oldest' | 'alphabetical' | 'amount-high' | 'amount-low'; + dateRange: { + from: Date | null; + to: Date | null; + }; + amountRange: { + min: number; + max: number; + }; + identityType: 'all' | 'identified' | 'anonymous'; +} + +export interface BackingHistorySortOption { + value: string; + label: string; +} From 52f2d2617de64f1c008626eaf49df83ccb3f5825 Mon Sep 17 00:00:00 2001 From: Benjtalkshow Date: Wed, 20 Aug 2025 02:56:37 +0100 Subject: [PATCH 4/6] feat: backing history --- app/user/backing-history/page.tsx | 111 ++++ .../flows/backing-history/backing-history.tsx | 506 ++++++++++++++++++ lib/data/backing-history-mock.ts | 142 ----- types/backing-history.ts | 32 -- 4 files changed, 617 insertions(+), 174 deletions(-) create mode 100644 app/user/backing-history/page.tsx create mode 100644 components/flows/backing-history/backing-history.tsx delete mode 100644 lib/data/backing-history-mock.ts delete mode 100644 types/backing-history.ts diff --git a/app/user/backing-history/page.tsx b/app/user/backing-history/page.tsx new file mode 100644 index 000000000..58fdebd9d --- /dev/null +++ b/app/user/backing-history/page.tsx @@ -0,0 +1,111 @@ +'use client'; + +import { useState } from 'react'; +import { Button } from '@/components/ui/button'; +import BackingHistory from '@/components/flows/backing-history/backing-history'; + +// Sample data matching the images +const sampleBackers = [ + { + id: '1', + name: 'Collins Odumeje', + avatar: '/placeholder.svg?height=32&width=32', + amount: 2300, + date: new Date('2025-08-05'), + walletId: 'GDS3...GB7', + isAnonymous: false, + }, + { + id: '2', + name: 'Collins Odumeje', + avatar: '/placeholder.svg?height=32&width=32', + amount: 2300, + date: new Date('2025-08-05'), + walletId: 'GDS3...GB7', + isAnonymous: false, + }, + { + id: '3', + name: 'Collins Odumeje', + avatar: '/placeholder.svg?height=32&width=32', + amount: 2300, + date: new Date('2025-08-05'), + walletId: 'GDS3...GB7', + isAnonymous: false, + }, + { + id: '4', + name: 'Anonymous', + amount: 2300, + date: new Date('2025-08-05'), + walletId: 'GDS3...GB7', + isAnonymous: true, + }, + { + id: '5', + name: 'Collins Odumeje', + avatar: '/placeholder.svg?height=32&width=32', + amount: 2300, + date: new Date('2025-08-05'), + walletId: 'GDS3...GB7', + isAnonymous: false, + }, + { + id: '6', + name: 'Anonymous', + amount: 2300, + date: new Date('2025-08-05'), + walletId: 'GDS3...GB7', + isAnonymous: true, + }, + { + id: '7', + name: 'Anonymous', + amount: 2300, + date: new Date('2025-08-05'), + walletId: 'GDS3...GB7', + isAnonymous: true, + }, + { + id: '8', + name: 'Collins Odumeje', + avatar: '/placeholder.svg?height=32&width=32', + amount: 2300, + date: new Date('2025-08-05'), + walletId: 'GDS3...GB7', + isAnonymous: false, + }, + { + id: '9', + name: 'Anonymous', + amount: 2300, + date: new Date('2025-08-05'), + walletId: 'GDS3...GB7', + isAnonymous: true, + }, +]; + +export default function Home() { + const [showBackingHistory, setShowBackingHistory] = useState(false); + + return ( +
+
+

Crowdfunding Dashboard

+ + + + +
+
+ ); +} diff --git a/components/flows/backing-history/backing-history.tsx b/components/flows/backing-history/backing-history.tsx new file mode 100644 index 000000000..6f8e85275 --- /dev/null +++ b/components/flows/backing-history/backing-history.tsx @@ -0,0 +1,506 @@ +'use client'; + +import type React from 'react'; +import { useState, useMemo } from 'react'; +import { + Search, + Filter, + ArrowUpDown, + Calendar, + DollarSign, + User, + Wallet, + Check, + CheckIcon, +} from 'lucide-react'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { Slider } from '@/components/ui/slider'; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from '@/components/ui/select'; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover'; +import { format } from 'date-fns'; +import BoundlessSheet from '@/components/sheet/boundless-sheet'; + +interface Backer { + id: string; + name: string; + avatar?: string; + amount: number; + date: Date; + walletId: string; + isAnonymous: boolean; +} + +interface BackingHistoryProps { + open: boolean; + setOpen: (open: boolean) => void; + backers: Backer[]; +} + +type SortOption = 'newest' | 'oldest' | 'alphabetical' | 'highest' | 'lowest'; +type IdentityFilter = 'all' | 'identified' | 'anonymous'; + +const BackingHistory: React.FC = ({ + open, + setOpen, + backers, +}) => { + const [searchQuery, setSearchQuery] = useState(''); + const [sortBy, setSortBy] = useState('newest'); + const [amountRange, setAmountRange] = useState([0, 10000]); + const [dateRange, setDateRange] = useState<{ from?: Date; to?: Date }>({}); + const [identityFilter, setIdentityFilter] = useState('all'); + const [showFilters, setShowFilters] = useState(false); + const [showSortPopover, setShowSortPopover] = useState(false); + + const setQuickDateFilter = (days: number) => { + const today = new Date(); + const pastDate = new Date(today.getTime() - days * 24 * 60 * 60 * 1000); + setDateRange({ from: pastDate, to: today }); + }; + + const resetFilters = () => { + setSearchQuery(''); + setSortBy('newest'); + setAmountRange([0, 10000]); + setDateRange({}); + setIdentityFilter('all'); + }; + + const resetDateRange = () => { + setDateRange({}); + }; + + const resetAmountRange = () => { + setAmountRange([10, 1000]); + }; + + const resetIdentityFilter = () => { + setIdentityFilter('all'); + }; + + const applyFilters = () => { + setShowSortPopover(false); + }; + + const filteredAndSortedBackers = useMemo(() => { + const filtered = backers.filter(backer => { + const matchesSearch = + backer.name.toLowerCase().includes(searchQuery.toLowerCase()) || + backer.walletId.toLowerCase().includes(searchQuery.toLowerCase()); + + const matchesAmount = + backer.amount >= amountRange[0] && backer.amount <= amountRange[1]; + + const matchesDate = + !dateRange.from || + !dateRange.to || + (backer.date >= dateRange.from && backer.date <= dateRange.to); + + const matchesIdentity = + identityFilter === 'all' || + (identityFilter === 'anonymous' && backer.isAnonymous) || + (identityFilter === 'identified' && !backer.isAnonymous); + + return matchesSearch && matchesAmount && matchesDate && matchesIdentity; + }); + + filtered.sort((a, b) => { + switch (sortBy) { + case 'newest': + return b.date.getTime() - a.date.getTime(); + case 'oldest': + return a.date.getTime() - b.date.getTime(); + case 'alphabetical': + return a.name.localeCompare(b.name); + case 'highest': + return b.amount - a.amount; + case 'lowest': + return a.amount - b.amount; + default: + return 0; + } + }); + + return filtered; + }, [backers, searchQuery, sortBy, amountRange, dateRange, identityFilter]); + + const formatDate = (date: Date) => { + const now = new Date(); + const diffInDays = Math.floor( + (now.getTime() - date.getTime()) / (1000 * 60 * 60 * 24) + ); + + if (diffInDays === 0) return 'Today'; + if (diffInDays === 1) return '1d'; + if (diffInDays < 7) return `${diffInDays}d`; + if (diffInDays < 30) return `${Math.floor(diffInDays / 7)}w`; + return format(date, 'MMM dd, yyyy'); + }; + + return ( + +
+
+ {/* Search and Controls */} +
+
+ + setSearchQuery(e.target.value)} + className='pl-10 py-5 placeholder:font-medium bg-muted/20 border-muted-foreground/20 text-white placeholder:text-muted-foreground' + /> +
+ + + + + + +
+ {/* Date Range Section */} +
+
+

+ Date range +

+ +
+
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+
+ + + +
+
+
+ + {/* Amount Range Section */} +
+
+

+ Amount range +

+ +
+
+
+
+ +
+ + + setAmountRange([ + Number.parseInt(e.target.value) || 0, + amountRange[1], + ]) + } + className='bg-muted/20 border-muted-foreground/20 text-white pl-8' + /> +
+
+
+ +
+ + + setAmountRange([ + amountRange[0], + Number.parseInt(e.target.value) || 0, + ]) + } + className='bg-muted/20 border-muted-foreground/20 text-white pl-8' + /> +
+
+
+ +
+
+ + {/* Identity Type Section */} +
+
+

+ Identity Type +

+ +
+
+ + + +
+
+ + {/* Action Buttons */} +
+ + +
+
+
+
+
+ + {/* Filters Panel */} + {showFilters && ( +
+ {/* Sort Options */} +
+
+ + +
+ +
+
+ )} + + {/* Results Header */} +
+
Backer
+
Amount
+
Date
+
+ + {/* Backing List */} +
+ {filteredAndSortedBackers.map(backer => ( +
+
+
+ + + + {backer.isAnonymous ? ( + + ) : ( + backer.name.charAt(0) + )} + + +
+ +
+
+
+
{backer.name}
+
+ + {backer.walletId} +
+
+
+
+ ${backer.amount.toLocaleString()} +
+
+ {formatDate(backer.date)} +
+
+ ))} +
+ + {filteredAndSortedBackers.length === 0 && ( +
+ No backers found matching your criteria +
+ )} +
+
+
+ ); +}; + +export default BackingHistory; diff --git a/lib/data/backing-history-mock.ts b/lib/data/backing-history-mock.ts deleted file mode 100644 index 3de9417e2..000000000 --- a/lib/data/backing-history-mock.ts +++ /dev/null @@ -1,142 +0,0 @@ -import type { BackingHistoryItem } from '@/types/backing-history'; - -export const mockBackingHistory: BackingHistoryItem[] = [ - { - id: '1', - backer: { - name: 'Collins Odumeje', - isAnonymous: false, - avatar: '/diverse-user-avatars.png', - walletAddress: 'GDS3...GB7', - }, - amount: 2300, - currency: 'USDT', - date: new Date('2025-08-17'), - timeAgo: '3s', - }, - { - id: '2', - backer: { - name: 'Sarah Chen', - isAnonymous: false, - avatar: '/diverse-user-avatars.png', - walletAddress: 'ABC1...XYZ', - }, - amount: 1500, - currency: 'USDT', - date: new Date('2025-08-16'), - timeAgo: '1d', - }, - { - id: '3', - backer: { - name: 'Anonymous', - isAnonymous: true, - avatar: '/anonymous-user-concept.png', - walletAddress: 'DEF4...789', - }, - amount: 5000, - currency: 'USDT', - date: new Date('2025-08-15'), - timeAgo: '2d', - }, - { - id: '4', - backer: { - name: 'Michael Rodriguez', - isAnonymous: false, - avatar: '/diverse-user-avatars.png', - walletAddress: 'HIJ7...456', - }, - amount: 750, - currency: 'USDT', - date: new Date('2025-08-14'), - timeAgo: '3d', - }, - { - id: '5', - backer: { - name: 'Anonymous', - isAnonymous: true, - avatar: '/anonymous-user-concept.png', - walletAddress: 'KLM0...123', - }, - amount: 3200, - currency: 'USDT', - date: new Date('2025-08-13'), - timeAgo: '4d', - }, - { - id: '6', - backer: { - name: 'Emma Thompson', - isAnonymous: false, - avatar: '/diverse-user-avatars.png', - walletAddress: 'NOP3...890', - }, - amount: 1800, - currency: 'USDT', - date: new Date('2025-08-12'), - timeAgo: '5d', - }, - { - id: '7', - backer: { - name: 'David Kim', - isAnonymous: false, - avatar: '/diverse-user-avatars.png', - walletAddress: 'QRS6...567', - }, - amount: 4500, - currency: 'USDT', - date: new Date('2025-08-11'), - timeAgo: '6d', - }, - { - id: '8', - backer: { - name: 'Anonymous', - isAnonymous: true, - avatar: '/anonymous-user-concept.png', - walletAddress: 'TUV9...234', - }, - amount: 950, - currency: 'USDT', - date: new Date('2025-08-10'), - timeAgo: '1w', - }, - { - id: '9', - backer: { - name: 'Lisa Wang', - isAnonymous: false, - avatar: '/diverse-user-avatars.png', - walletAddress: 'WXY2...901', - }, - amount: 2750, - currency: 'USDT', - date: new Date('2025-08-09'), - timeAgo: '1w', - }, - { - id: '10', - backer: { - name: 'Anonymous', - isAnonymous: true, - avatar: '/anonymous-user-concept.png', - walletAddress: 'ZAB5...678', - }, - amount: 6200, - currency: 'USDT', - date: new Date('2025-08-08'), - timeAgo: '1w', - }, -]; - -export const sortOptions = [ - { value: 'newest', label: 'Newest first' }, - { value: 'oldest', label: 'Oldest first' }, - { value: 'alphabetical', label: 'Alphabetical' }, - { value: 'amount-high', label: 'Highest first' }, - { value: 'amount-low', label: 'Lowest first' }, -]; diff --git a/types/backing-history.ts b/types/backing-history.ts deleted file mode 100644 index 054c4506b..000000000 --- a/types/backing-history.ts +++ /dev/null @@ -1,32 +0,0 @@ -export interface BackingHistoryItem { - id: string; - backer: { - name: string; - isAnonymous: boolean; - avatar?: string; - walletAddress: string; - }; - amount: number; - currency: string; - date: Date; - timeAgo: string; -} - -export interface BackingHistoryFilters { - searchQuery: string; - sortBy: 'newest' | 'oldest' | 'alphabetical' | 'amount-high' | 'amount-low'; - dateRange: { - from: Date | null; - to: Date | null; - }; - amountRange: { - min: number; - max: number; - }; - identityType: 'all' | 'identified' | 'anonymous'; -} - -export interface BackingHistorySortOption { - value: string; - label: string; -} From 8b38312dd40ee11bc17b5db5fe369821bb4c1d01 Mon Sep 17 00:00:00 2001 From: Benjtalkshow Date: Wed, 20 Aug 2025 14:30:38 +0100 Subject: [PATCH 5/6] fix: finalize backing history --- app/user/backing-history/page.tsx | 4 +- .../backing-history/backing-history-table.tsx | 103 ++++ .../flows/backing-history/backing-history.tsx | 506 ------------------ .../flows/backing-history/filter-popover.tsx | 319 +++++++++++ components/flows/backing-history/index.tsx | 168 ++++++ .../backing-history/sort-filter-popover.tsx | 135 +++++ 6 files changed, 726 insertions(+), 509 deletions(-) create mode 100644 components/flows/backing-history/backing-history-table.tsx delete mode 100644 components/flows/backing-history/backing-history.tsx create mode 100644 components/flows/backing-history/filter-popover.tsx create mode 100644 components/flows/backing-history/index.tsx create mode 100644 components/flows/backing-history/sort-filter-popover.tsx diff --git a/app/user/backing-history/page.tsx b/app/user/backing-history/page.tsx index 58fdebd9d..bb21f5a66 100644 --- a/app/user/backing-history/page.tsx +++ b/app/user/backing-history/page.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; import { Button } from '@/components/ui/button'; -import BackingHistory from '@/components/flows/backing-history/backing-history'; +import BackingHistory from '@/components/flows/backing-history/Index'; // Sample data matching the images const sampleBackers = [ @@ -91,8 +91,6 @@ export default function Home() { return (
-

Crowdfunding Dashboard

- - - - - - -
- {/* Date Range Section */} -
-
-

- Date range -

- -
-
-
-
- -
- - -
-
-
- -
- - -
-
-
-
- - - -
-
-
- - {/* Amount Range Section */} -
-
-

- Amount range -

- -
-
-
-
- -
- - - setAmountRange([ - Number.parseInt(e.target.value) || 0, - amountRange[1], - ]) - } - className='bg-muted/20 border-muted-foreground/20 text-white pl-8' - /> -
-
-
- -
- - - setAmountRange([ - amountRange[0], - Number.parseInt(e.target.value) || 0, - ]) - } - className='bg-muted/20 border-muted-foreground/20 text-white pl-8' - /> -
-
-
- -
-
- - {/* Identity Type Section */} -
-
-

- Identity Type -

- -
-
- - - -
-
- - {/* Action Buttons */} -
- - -
-
-
-
-
- - {/* Filters Panel */} - {showFilters && ( -
- {/* Sort Options */} -
-
- - -
- -
-
- )} - - {/* Results Header */} -
-
Backer
-
Amount
-
Date
-
- - {/* Backing List */} -
- {filteredAndSortedBackers.map(backer => ( -
-
-
- - - - {backer.isAnonymous ? ( - - ) : ( - backer.name.charAt(0) - )} - - -
- -
-
-
-
{backer.name}
-
- - {backer.walletId} -
-
-
-
- ${backer.amount.toLocaleString()} -
-
- {formatDate(backer.date)} -
-
- ))} -
- - {filteredAndSortedBackers.length === 0 && ( -
- No backers found matching your criteria -
- )} -
- - - ); -}; - -export default BackingHistory; diff --git a/components/flows/backing-history/filter-popover.tsx b/components/flows/backing-history/filter-popover.tsx new file mode 100644 index 000000000..3cf7f3cfa --- /dev/null +++ b/components/flows/backing-history/filter-popover.tsx @@ -0,0 +1,319 @@ +'use client'; + +import type React from 'react'; +import { ArrowUpDown, Calendar, DollarSign, Check } from 'lucide-react'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Slider } from '@/components/ui/slider'; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover'; +import { Calendar as CalendarComponent } from '@/components/ui/calendar'; +import { format } from 'date-fns'; + +type IdentityFilter = 'all' | 'identified' | 'anonymous'; + +interface AdvancedFilterPopoverProps { + amountRange: number[]; + setAmountRange: (range: number[]) => void; + dateRange: { from?: Date; to?: Date }; + setDateRange: (range: { from?: Date; to?: Date }) => void; + identityFilter: IdentityFilter; + setIdentityFilter: (filter: IdentityFilter) => void; + showSortPopover: boolean; + setShowSortPopover: (show: boolean) => void; + showFromCalendar: boolean; + setShowFromCalendar: (show: boolean) => void; + showToCalendar: boolean; + setShowToCalendar: (show: boolean) => void; + setQuickDateFilter: (days: number) => void; + resetFilters: () => void; + resetDateRange: () => void; + resetAmountRange: () => void; + resetIdentityFilter: () => void; + applyFilters: () => void; +} + +const AdvancedFilterPopover: React.FC = ({ + amountRange, + setAmountRange, + dateRange, + setDateRange, + identityFilter, + setIdentityFilter, + showSortPopover, + setShowSortPopover, + showFromCalendar, + setShowFromCalendar, + showToCalendar, + setShowToCalendar, + setQuickDateFilter, + resetFilters, + resetDateRange, + resetAmountRange, + resetIdentityFilter, + applyFilters, +}) => { + return ( + + + + + +
+ {/* Date Range Section */} +
+
+

Date range

+ +
+
+
+
+ + + +
+ + +
+
+ + { + setDateRange({ ...dateRange, from: date }); + setShowFromCalendar(false); + }} + initialFocus + /> + +
+
+
+ + + +
+ + +
+
+ + { + setDateRange({ ...dateRange, to: date }); + setShowToCalendar(false); + }} + initialFocus + /> + +
+
+
+
+ + + +
+
+
+ + {/* Amount Range Section */} +
+
+

Amount range

+ +
+
+
+
+ +
+ + + setAmountRange([ + Number.parseInt(e.target.value) || 0, + amountRange[1], + ]) + } + className='bg-muted/20 border-muted-foreground/20 text-white pl-8 p-5' + /> +
+
+
+ +
+ + + setAmountRange([ + amountRange[0], + Number.parseInt(e.target.value) || 0, + ]) + } + className='bg-muted/20 border-muted-foreground/20 text-white pl-8 p-5' + /> +
+
+
+ +
+
+ + {/* Identity Type Section */} +
+
+

Identity Type

+ +
+
+ + + +
+
+ + {/* Action Buttons */} +
+ + +
+
+
+
+ ); +}; + +export default AdvancedFilterPopover; diff --git a/components/flows/backing-history/index.tsx b/components/flows/backing-history/index.tsx new file mode 100644 index 000000000..bac6c1504 --- /dev/null +++ b/components/flows/backing-history/index.tsx @@ -0,0 +1,168 @@ +'use client'; + +import type React from 'react'; +import { useState, useMemo } from 'react'; +import { Search } from 'lucide-react'; +import { Input } from '@/components/ui/input'; +import BoundlessSheet from '@/components/sheet/boundless-sheet'; +import SortFilterPopover from './sort-filter-popover'; +import AdvancedFilterPopover from './filter-popover'; +import BackingHistoryTable from './backing-history-table'; + +interface Backer { + id: string; + name: string; + avatar?: string; + amount: number; + date: Date; + walletId: string; + isAnonymous: boolean; +} + +interface BackingHistoryProps { + open: boolean; + setOpen: (open: boolean) => void; + backers: Backer[]; +} + +type SortOption = 'newest' | 'oldest' | 'alphabetical' | 'highest' | 'lowest'; +type IdentityFilter = 'all' | 'identified' | 'anonymous'; + +const BackingHistory: React.FC = ({ + open, + setOpen, + backers, +}) => { + const [searchQuery, setSearchQuery] = useState(''); + const [sortBy, setSortBy] = useState('newest'); + const [amountRange, setAmountRange] = useState([0, 10000]); + const [dateRange, setDateRange] = useState<{ from?: Date; to?: Date }>({}); + const [identityFilter, setIdentityFilter] = useState('all'); + const [showFilterPopover, setShowFilterPopover] = useState(false); + const [showSortPopover, setShowSortPopover] = useState(false); + const [showFromCalendar, setShowFromCalendar] = useState(false); + const [showToCalendar, setShowToCalendar] = useState(false); + + const setQuickDateFilter = (days: number) => { + const today = new Date(); + const pastDate = new Date(today.getTime() - days * 24 * 60 * 60 * 1000); + setDateRange({ from: pastDate, to: today }); + }; + + const resetFilters = () => { + setSearchQuery(''); + setSortBy('newest'); + setAmountRange([0, 10000]); + setDateRange({}); + setIdentityFilter('all'); + }; + + const resetDateRange = () => { + setDateRange({}); + }; + + const resetAmountRange = () => { + setAmountRange([10, 1000]); + }; + + const resetIdentityFilter = () => { + setIdentityFilter('all'); + }; + + const applyFilters = () => { + setShowSortPopover(false); + }; + + const filteredAndSortedBackers = useMemo(() => { + const filtered = backers.filter(backer => { + const matchesSearch = + backer.name.toLowerCase().includes(searchQuery.toLowerCase()) || + backer.walletId.toLowerCase().includes(searchQuery.toLowerCase()); + + const matchesAmount = + backer.amount >= amountRange[0] && backer.amount <= amountRange[1]; + + const matchesDate = + !dateRange.from || + !dateRange.to || + (backer.date >= dateRange.from && backer.date <= dateRange.to); + + const matchesIdentity = + identityFilter === 'all' || + (identityFilter === 'anonymous' && backer.isAnonymous) || + (identityFilter === 'identified' && !backer.isAnonymous); + + return matchesSearch && matchesAmount && matchesDate && matchesIdentity; + }); + + filtered.sort((a, b) => { + switch (sortBy) { + case 'newest': + return b.date.getTime() - a.date.getTime(); + case 'oldest': + return a.date.getTime() - b.date.getTime(); + case 'alphabetical': + return a.name.localeCompare(b.name); + case 'highest': + return b.amount - a.amount; + case 'lowest': + return a.amount - b.amount; + default: + return 0; + } + }); + + return filtered; + }, [backers, searchQuery, sortBy, amountRange, dateRange, identityFilter]); + + return ( + +
+
+ {/* Search and Controls */} +
+
+ + setSearchQuery(e.target.value)} + className='pl-10 py-5 focus:outline-none placeholder:font-medium bg-muted/20 border-muted-foreground/20 text-placeholder placeholder:text-muted-foreground' + /> +
+ + +
+ + +
+
+
+ ); +}; + +export default BackingHistory; diff --git a/components/flows/backing-history/sort-filter-popover.tsx b/components/flows/backing-history/sort-filter-popover.tsx new file mode 100644 index 000000000..faec8838f --- /dev/null +++ b/components/flows/backing-history/sort-filter-popover.tsx @@ -0,0 +1,135 @@ +'use client'; + +import type React from 'react'; +import { Check, Filter } from 'lucide-react'; +import { Button } from '@/components/ui/button'; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover'; + +type SortOption = 'newest' | 'oldest' | 'alphabetical' | 'highest' | 'lowest'; + +interface SortFilterPopoverProps { + sortBy: SortOption; + setSortBy: (sort: SortOption) => void; + showFilterPopover: boolean; + setShowFilterPopover: (show: boolean) => void; +} + +const SortFilterPopover: React.FC = ({ + sortBy, + setSortBy, + showFilterPopover, + setShowFilterPopover, +}) => { + return ( + + + + + +
+ {/* Time based Section */} +
+

+ Time based +

+
+ + +
+
+ + {/* Backer name Section */} +
+

+ Backer name +

+ +
+ + {/* Funding amount Section */} +
+

+ Funding amount +

+
+ + +
+
+
+
+
+ ); +}; + +export default SortFilterPopover; From 87fbd5a1d290ef2d0836c067e0f51fa9396c479c Mon Sep 17 00:00:00 2001 From: Benjtalkshow Date: Wed, 20 Aug 2025 15:12:16 +0100 Subject: [PATCH 6/6] fix: minor fixes --- .../flows/backing-history/filter-popover.tsx | 2 +- components/flows/backing-history/index.tsx | 2 +- .../backing-history/sort-filter-popover.tsx | 32 ++++++++++++------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/components/flows/backing-history/filter-popover.tsx b/components/flows/backing-history/filter-popover.tsx index 3cf7f3cfa..686d5db16 100644 --- a/components/flows/backing-history/filter-popover.tsx +++ b/components/flows/backing-history/filter-popover.tsx @@ -62,7 +62,7 @@ const AdvancedFilterPopover: React.FC = ({ diff --git a/components/flows/backing-history/index.tsx b/components/flows/backing-history/index.tsx index bac6c1504..af9bf4c98 100644 --- a/components/flows/backing-history/index.tsx +++ b/components/flows/backing-history/index.tsx @@ -127,7 +127,7 @@ const BackingHistory: React.FC = ({ placeholder='Search backer or wallet...' value={searchQuery} onChange={e => setSearchQuery(e.target.value)} - className='pl-10 py-5 focus:outline-none placeholder:font-medium bg-muted/20 border-muted-foreground/20 text-placeholder placeholder:text-muted-foreground' + className='pl-10 py-5 focus:outline-none placeholder:font-medium bg-[#1c1c1c] border-muted-foreground/20 text-placeholder placeholder:text-muted-foreground' /> = ({ @@ -53,8 +53,10 @@ const SortFilterPopover: React.FC = ({ setSortBy('newest'); setShowFilterPopover(false); }} - className={`w-full justify-between bg-transparent border-none text-white hover:bg-muted/30 ${ - sortBy === 'newest' ? 'bg-muted/40' : '' + className={`w-full justify-between bg-transparent text-white hover:bg-muted/30 ${ + sortBy === 'newest' + ? 'bg-muted/40 border-primary' + : 'border-none' }`} > Newest first @@ -66,8 +68,10 @@ const SortFilterPopover: React.FC = ({ setSortBy('oldest'); setShowFilterPopover(false); }} - className={`w-full justify-start bg-transparent border-none text-white hover:bg-muted/30 ${ - sortBy === 'oldest' ? 'bg-muted/40' : '' + className={`w-full justify-start bg-transparent text-white hover:bg-muted/30 ${ + sortBy === 'oldest' + ? 'bg-muted/40 border-primary' + : 'border-none' }`} > Oldest first @@ -86,8 +90,10 @@ const SortFilterPopover: React.FC = ({ setSortBy('alphabetical'); setShowFilterPopover(false); }} - className={`w-full justify-start bg-transparent border-none text-white hover:bg-muted/30 ${ - sortBy === 'alphabetical' ? 'bg-muted/40' : '' + className={`w-full justify-start bg-transparent text-white hover:bg-muted/30 ${ + sortBy === 'alphabetical' + ? 'bg-muted/40 border-primary' + : 'border-none' }`} > Alphabetical @@ -106,8 +112,10 @@ const SortFilterPopover: React.FC = ({ setSortBy('highest'); setShowFilterPopover(false); }} - className={`w-full justify-start bg-transparent border-none text-white hover:bg-muted/30 ${ - sortBy === 'highest' ? 'bg-muted/40' : '' + className={`w-full justify-start bg-transparent text-white hover:bg-muted/30 ${ + sortBy === 'highest' + ? 'bg-muted/40 border-primary' + : 'border-none' }`} > Highest first @@ -118,8 +126,10 @@ const SortFilterPopover: React.FC = ({ setSortBy('lowest'); setShowFilterPopover(false); }} - className={`w-full justify-start bg-transparent border-none text-white hover:bg-muted/30 ${ - sortBy === 'lowest' ? 'bg-muted/40' : '' + className={`w-full justify-start bg-transparent text-white hover:bg-muted/30 ${ + sortBy === 'lowest' + ? 'bg-muted/40 border-primary' + : 'border-none' }`} > Lowest first