solid cashu foundation

This commit is contained in:
lemonknowsall committed 2025-10-11 00:34:32 -07:00
1 parent a8faa03b49
commit 967bdca369
15 files changed
+1249 -1477

No files matched your search

+26 -40
View File
@@ -1,6 +1,7 @@
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { X, Copy, Check, QrCode, Zap } from 'lucide-react';
import { useCopyToClipboard } from '@/hooks/useCopyToClipboard';
interface QRModalProps {
isOpen: boolean;
@@ -10,11 +11,6 @@ interface QRModalProps {
qrCodeUrl: string;
content: string;
icon?: 'qr' | 'zap';
showCopyButton?: boolean;
copiedText?: string | null;
onCopy?: () => void;
copyButtonText?: string;
helpText?: string;
}
export function QRModal({
@@ -25,19 +21,25 @@ export function QRModal({
qrCodeUrl,
content,
icon = 'qr',
showCopyButton = false,
copiedText,
onCopy,
copyButtonText = 'Copy',
helpText,
}: QRModalProps) {
const { copy, copied } = useCopyToClipboard();
const handleCopy = () => {
copy(content);
};
if (!isOpen) return null;
const IconComponent = icon === 'zap' ? Zap : QrCode;
return (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-[100] p-4">
<Card className="w-full max-w-md border-0 shadow-lg bg-background">
<div
className="fixed inset-0 bg-black/50 flex items-center justify-center z-[100] p-4"
onClick={onClose}
>
<Card
className="w-full max-w-md border-0 shadow-lg bg-background"
onClick={(e) => e.stopPropagation()}
>
<CardHeader className="relative">
<Button
onClick={onClose}
@@ -67,38 +69,22 @@ export function QRModal({
</div>
<div className="text-center">
<div className="bg-muted p-3 rounded-lg border font-mono text-sm break-all">
<div
className="bg-muted p-3 rounded-lg border font-mono text-sm break-all cursor-pointer hover:bg-muted/80 transition-colors relative group"
onClick={handleCopy}
title="Click to copy"
>
{content}
<div className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity">
{copied ? (
<Check className="h-4 w-4 text-green-600" />
) : (
<Copy className="h-4 w-4 text-muted-foreground" />
)}
</div>
</div>
</div>
{showCopyButton && onCopy && (
<div className="flex gap-2 justify-center">
<Button
variant="outline"
onClick={onCopy}
className="flex items-center gap-2"
>
{copiedText === content ? (
<>
<Check className="h-4 w-4" />
Copied!
</>
) : (
<>
<Copy className="h-4 w-4" />
{copyButtonText}
</>
)}
</Button>
</div>
)}
{helpText && (
<div className="text-xs text-muted-foreground bg-muted/30 p-3 rounded text-center">
{helpText}
</div>
)}
</CardContent>
</Card>
</div>