Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 28 additions & 23 deletions webapp/src/components/account/account-ui.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { useCluster, useWallet } from '@solana/connector/react';
import { address } from '@solana/kit';
import type { Address, Lamports } from '@solana/kit';
import { CopyButton } from '@solana/design-system';
import { Button, CopyButton, TextInput } from '@solana/design-system';

const lamportsToSol = (lamports: bigint | number): number => Number(lamports) / 1e9;
import { Link } from 'react-router';
import { Button } from '@/components/ui/button';
import { AppAlert } from '@/components/app-alert';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { useEffect, useMemo, useState } from 'react';
import { RefreshCw, Wallet, DollarSign } from 'lucide-react';
import { toast } from 'sonner';
Expand Down Expand Up @@ -42,7 +40,7 @@ export function AccountBalanceCheck({ address: addr }: { address: Address }) {
return (
<AppAlert
action={
<Button variant="outline" asChild>
<Button variant="secondary" asChild>
<Link to="/faucet">Request Airdrop</Link>
</Button>
}
Expand Down Expand Up @@ -154,14 +152,14 @@ export function WalletBalanceCards({ address: addr }: { address: Address }) {
)}
</div>
<Button
variant="outline"
variant="secondary"
size="sm"
iconOnly
iconLeft={<RefreshCw className={isRefreshing ? 'animate-spin' : ''} />}
aria-label="Refresh wallet balances"
onClick={handleRefresh}
disabled={isRefreshing}
className="rounded-full bg-white/5 border-white/10 hover:bg-white/10 text-white"
>
<RefreshCw className={`h-4 w-4 ${isRefreshing ? 'animate-spin' : ''}`} />
</Button>
/>
</div>

<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
Expand Down Expand Up @@ -316,22 +314,23 @@ export function SolFaucetCard() {
</p>
) : (
<>
<Input
<TextInput
type="number"
placeholder="0"
value={amount}
onChange={e => setAmount(e.target.value)}
min="0.1"
step="0.1"
className="text-3xl font-bold h-14 border-purple-500/20 focus-visible:ring-purple-500/40"
inputClassName="text-3xl font-bold"
size="xl"
/>
<div className="flex flex-wrap gap-2">
{[1, 2, 5, 10].map(v => (
<Button
key={v}
variant="outline"
variant="secondary"
size="sm"
className="rounded-full text-xs border-purple-500/30 hover:bg-purple-500/10"
radius="round"
onClick={() => setAmount(String(v))}
>
{v} SOL
Expand All @@ -341,9 +340,11 @@ export function SolFaucetCard() {
<Button
onClick={handleAirdrop}
disabled={airdrop.isPending}
className="w-full rounded-full bg-purple-600 hover:bg-purple-500 text-white"
loading={airdrop.isPending}
radius="round"
style={{ width: '100%' }}
>
{airdrop.isPending ? 'Requesting...' : 'Request Airdrop'}
Request Airdrop
</Button>
</>
)}
Expand Down Expand Up @@ -381,31 +382,33 @@ export function UsdcFaucetCard() {
</CardTitle>
</CardHeader>
<CardContent className="relative space-y-4">
<Input
<TextInput
type="number"
placeholder="0"
value={amount}
onChange={e => setAmount(e.target.value)}
min="1"
step="100"
className="text-3xl font-bold h-14 border-green-500/20 focus-visible:ring-green-500/40"
inputClassName="text-3xl font-bold"
size="xl"
/>
{isDevnet && (
<Input
<TextInput
type="text"
placeholder={account ?? 'Recipient address (leave empty for self)'}
value={recipient}
onChange={e => setRecipient(e.target.value)}
className="font-mono text-xs h-10 border-green-500/20 focus-visible:ring-green-500/40"
inputClassName="font-mono text-xs"
size="lg"
/>
)}
<div className="flex flex-wrap gap-2">
{[100, 1000, 5000, 10000].map(v => (
<Button
key={v}
variant="outline"
variant="secondary"
size="sm"
className="rounded-full text-xs border-green-500/30 hover:bg-green-500/10"
radius="round"
onClick={() => setAmount(String(v))}
>
{v.toLocaleString()}
Expand All @@ -416,9 +419,11 @@ export function UsdcFaucetCard() {
<Button
onClick={handleAirdrop}
disabled={airdrop.isPending}
className="w-full rounded-full bg-green-600 hover:bg-green-500 text-white"
loading={airdrop.isPending}
radius="round"
style={{ width: '100%' }}
>
{airdrop.isPending ? 'Requesting...' : isDevnet ? 'Mint USDC' : 'Request Airdrop'}
{isDevnet ? 'Mint USDC' : 'Request Airdrop'}
</Button>
</CardContent>
</Card>
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/delegation/active-delegations.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RefreshCw, FileX, Coins, ShieldAlert, Power, Trash2 } from 'lucide-react';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@solana/design-system';
import { Button } from '@/components/ui/button';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
import {
Dialog,
DialogContent,
Expand Down Expand Up @@ -288,7 +288,7 @@ function FixedDelegationTable({
<span className="px-1.5 py-0.5 rounded-full bg-muted text-xs">{delegations.length}</span>
</div>
<div className="w-full rounded-2xl overflow-hidden bg-gradient-to-br from-[#121629]/80 to-black/60 backdrop-blur-xl shadow-[0_8px_30px_rgba(0,0,0,0.4)] border border-blue-500/15 overflow-x-auto">
<Table className="min-w-[650px] table-fixed">
<Table className="min-w-[650px] rounded-none border-0 bg-transparent [&_table]:table-fixed">
<TableHeader className="bg-blue-900/30 backdrop-blur-md">
<TableRow className="border-none hover:bg-blue-900/30 border-b border-white/5">
<TableHead className="text-white font-semibold py-4 text-center" style={{ width: '18%' }}>
Expand Down Expand Up @@ -404,7 +404,7 @@ function RecurringDelegationTable({
<span className="px-1.5 py-0.5 rounded-full bg-muted text-xs">{delegations.length}</span>
</div>
<div className="w-full rounded-2xl overflow-hidden bg-gradient-to-br from-[#121629]/80 to-black/60 backdrop-blur-xl shadow-[0_8px_30px_rgba(0,0,0,0.4)] border border-blue-500/15 overflow-x-auto">
<Table className="min-w-[650px] table-fixed">
<Table className="min-w-[650px] rounded-none border-0 bg-transparent [&_table]:table-fixed">
<TableHeader className="bg-blue-900/30 backdrop-blur-md">
<TableRow className="border-none hover:bg-blue-900/30 border-b border-white/5">
<TableHead className="text-white font-semibold py-4 text-center" style={{ width: '18%' }}>
Expand Down
27 changes: 14 additions & 13 deletions webapp/src/components/delegation/create-delegation-dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState, useEffect } from 'react';
import { Coins, RefreshCw, Plus, ArrowLeft } from 'lucide-react';
import { Select, SelectItem, TextInput } from '@solana/design-system';
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, DialogFooter } from '@/components/ui/dialog';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useSubscriptionsMutations } from '@/hooks/use-subscriptions-mutations';
import { DELEGATION_KINDS, type DelegationKindId } from '@/lib/delegation-kinds';
Expand Down Expand Up @@ -217,12 +217,12 @@ export function CreateDelegationDialog({ tokenMint, disabled }: CreateDelegation
<div className="grid gap-4 py-2">
<div className="grid gap-2">
<Label htmlFor="delegatee">Delegatee Address</Label>
<Input
<TextInput
id="delegatee"
value={delegatee}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setDelegatee(e.target.value)}
placeholder="Enter Solana wallet address"
className="font-mono text-sm"
inputClassName="font-mono"
/>
<p className="text-xs text-muted-foreground">
The wallet address that can withdraw tokens
Expand All @@ -233,7 +233,7 @@ export function CreateDelegationDialog({ tokenMint, disabled }: CreateDelegation
<Label htmlFor="amount">
{selectedKind === 'fixed' ? 'Total Amount (USDC)' : 'Amount per Period (USDC)'}
</Label>
<Input
<TextInput
id="amount"
type="number"
min="0"
Expand All @@ -247,7 +247,7 @@ export function CreateDelegationDialog({ tokenMint, disabled }: CreateDelegation
{selectedKind === 'recurring' && (
<div className="grid gap-2">
<Label htmlFor="period">Period Length (days)</Label>
<Input
<TextInput
id="period"
type="number"
min="1"
Expand Down Expand Up @@ -288,7 +288,7 @@ export function CreateDelegationDialog({ tokenMint, disabled }: CreateDelegation
) : (
<>
<div className="flex gap-2">
<Input
<TextInput
id="expiry-date"
type="date"
value={expiryDate}
Expand All @@ -298,18 +298,19 @@ export function CreateDelegationDialog({ tokenMint, disabled }: CreateDelegation
min={blockDate.toLocaleDateString('en-CA')}
className="flex-1"
/>
<select
id="expiry-hour"
<Select
value={expiryHour}
onChange={e => setExpiryHour(e.target.value)}
className="h-10 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
onValueChange={value => {
if (value) setExpiryHour(value);
}}
className="w-28 shrink-0"
>
{Array.from({ length: 24 }, (_, i) => (
<option key={i} value={i.toString()}>
<SelectItem key={i} value={i.toString()}>
{i.toString().padStart(2, '0')}:00
</option>
</SelectItem>
))}
</select>
</Select>
</div>
{expiryDate && !isExpiryValid() && (
<p className="text-xs text-destructive">
Expand Down
24 changes: 11 additions & 13 deletions webapp/src/components/plan/collect-payments-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useState, useMemo, useCallback } from 'react';
import { Banknote, ChevronDown, CheckCircle2, XCircle, Loader2 } from 'lucide-react';
import { Badge } from '@solana/design-system';
import { Banknote, ChevronDown, CheckCircle2, XCircle } from 'lucide-react';
import { Badge, Button } from '@solana/design-system';
import { toast } from 'sonner';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { cn, USDC_MULTIPLIER, ellipsify, fmtDateTime } from '@/lib/utils';
import { ExplorerLink } from '@/components/cluster/cluster-ui';
import { useMyPlans, type PlanItem } from '@/hooks/use-plans';
Expand Down Expand Up @@ -146,19 +145,18 @@ function CollectPlanCard({
</div>
</div>
<div className="flex items-center gap-2">
<Button
className="bg-emerald-600 hover:bg-emerald-500 text-white"
size="sm"
disabled={isCollecting}
onClick={handleCollect}
>
{isCollecting && <Loader2 className="h-4 w-4 animate-spin" />}
<Button size="sm" disabled={isCollecting} loading={isCollecting} onClick={handleCollect}>
Collect Payments
</Button>
{history.length > 0 && (
<Button variant="ghost" size="icon" className="h-8 w-8" onClick={() => setExpanded(!expanded)}>
<ChevronDown className={cn('h-4 w-4 transition-transform', expanded && 'rotate-180')} />
</Button>
<Button
variant="secondary"
size="sm"
iconOnly
iconLeft={<ChevronDown className={cn('transition-transform', expanded && 'rotate-180')} />}
aria-label={expanded ? 'Collapse collection history' : 'Expand collection history'}
onClick={() => setExpanded(!expanded)}
/>
)}
</div>
</div>
Expand Down
Loading
Loading