diff --git a/app/globals.css b/app/globals.css index a5c68ecf0..e57eb72d1 100644 --- a/app/globals.css +++ b/app/globals.css @@ -173,3 +173,16 @@ button { .slim-scrollbar::-webkit-scrollbar-track { background-color: transparent; } + +/* 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/backing-history/page.tsx b/app/user/backing-history/page.tsx new file mode 100644 index 000000000..bb21f5a66 --- /dev/null +++ b/app/user/backing-history/page.tsx @@ -0,0 +1,109 @@ +'use client'; + +import { useState } from 'react'; +import { Button } from '@/components/ui/button'; +import BackingHistory from '@/components/flows/backing-history/Index'; + +// 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 ( +
+
+ + + +
+
+ ); +} 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..972d5a0e9 --- /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/flows/backing-history/backing-history-table.tsx b/components/flows/backing-history/backing-history-table.tsx new file mode 100644 index 000000000..bbbf3da68 --- /dev/null +++ b/components/flows/backing-history/backing-history-table.tsx @@ -0,0 +1,103 @@ +'use client'; + +import type React from 'react'; +import { User, Wallet, CheckIcon } from 'lucide-react'; +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { format } from 'date-fns'; + +interface Backer { + id: string; + name: string; + avatar?: string; + amount: number; + date: Date; + walletId: string; + isAnonymous: boolean; +} + +interface BackingHistoryTableProps { + backers: Backer[]; +} + +const BackingHistoryTable: React.FC = ({ + backers, +}) => { + 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 ( + <> + {/* Results Header */} +
+
Backer
+
Amount
+
Date
+
+ + {/* Backing List */} +
+ {backers.map(backer => ( +
+
+
+ + + + {backer.isAnonymous ? ( + + ) : ( + backer.name.charAt(0) + )} + + +
+ +
+
+
+
+ {backer.name} +
+
+ + {backer.walletId} +
+
+
+
+ ${backer.amount.toLocaleString()} +
+
+ {formatDate(backer.date)} +
+
+ ))} +
+ + {backers.length === 0 && ( +
+ No backers found matching your criteria +
+ )} + + ); +}; + +export default BackingHistoryTable; diff --git a/components/flows/backing-history/filter-popover.tsx b/components/flows/backing-history/filter-popover.tsx new file mode 100644 index 000000000..686d5db16 --- /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..af9bf4c98 --- /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-[#1c1c1c] 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..ecb0629bc --- /dev/null +++ b/components/flows/backing-history/sort-filter-popover.tsx @@ -0,0 +1,145 @@ +'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; 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} +

-