style: clean up code formatting and remove trailing whitespace
refactor: reorganize imports and fix type imports
This commit is contained in:
1 parent
d3704602fd
commit
47c04de6fe
232 files changed
+7140
-4798
No files matched your search
@@ -1,32 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import confetti from "canvas-confetti";
|
||||
import {
|
||||
Heart,
|
||||
Coffee,
|
||||
Pizza,
|
||||
Loader2,
|
||||
Copy,
|
||||
Check,
|
||||
Lock,
|
||||
User,
|
||||
CheckCircle,
|
||||
CheckCircle2,
|
||||
DollarSign,
|
||||
Coffee,
|
||||
Copy,
|
||||
Heart,
|
||||
Loader2,
|
||||
Lock,
|
||||
Pizza,
|
||||
User,
|
||||
} from "lucide-react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { DonationTier, DonationResponse } from "@/types/donation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import type { DonationResponse, DonationTier } from "@/types/donation";
|
||||
|
||||
interface DonationCardProps extends DonationTier {}
|
||||
|
||||
@@ -61,7 +60,7 @@ export function DonationCard({
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [timeRemaining, setTimeRemaining] = useState<string | null>(null);
|
||||
const [paymentConfirmed, setPaymentConfirmed] = useState(false);
|
||||
const [_paymentConfirmed, setPaymentConfirmed] = useState(false);
|
||||
const [showThankYouModal, setShowThankYouModal] = useState(false);
|
||||
|
||||
const t = useTranslations("donation");
|
||||
@@ -94,7 +93,7 @@ export function DonationCard({
|
||||
|
||||
const updateTimer = () => {
|
||||
try {
|
||||
const expires = new Date(pixData!.expiresAt!);
|
||||
const expires = new Date(pixData?.expiresAt!);
|
||||
const now = new Date();
|
||||
const diff = expires.getTime() - now.getTime();
|
||||
|
||||
@@ -118,7 +117,7 @@ export function DonationCard({
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
`/api/donations/status?pixId=${pixData.pixId}`
|
||||
`/api/donations/status?pixId=${pixData.pixId}`,
|
||||
);
|
||||
const data = await response.json();
|
||||
|
||||
@@ -346,7 +345,7 @@ export function DonationCard({
|
||||
const isValidCustomAmount = () => {
|
||||
const amount = parseFloat(customAmount);
|
||||
return (
|
||||
!isNaN(amount) &&
|
||||
!Number.isNaN(amount) &&
|
||||
amount >= customProduct.minAmount &&
|
||||
amount <= customProduct.maxAmount
|
||||
);
|
||||
@@ -363,12 +362,12 @@ export function DonationCard({
|
||||
// Garante apenas um separador decimal
|
||||
const parts = normalized.split(".");
|
||||
if (parts.length > 2) {
|
||||
return parts[0] + "." + parts.slice(1).join("");
|
||||
return `${parts[0]}.${parts.slice(1).join("")}`;
|
||||
}
|
||||
|
||||
// Limita 2 casas decimais
|
||||
if (parts[1]?.length > 2) {
|
||||
return parts[0] + "." + parts[1].substring(0, 2);
|
||||
return `${parts[0]}.${parts[1].substring(0, 2)}`;
|
||||
}
|
||||
|
||||
return normalized;
|
||||
@@ -396,12 +395,12 @@ export function DonationCard({
|
||||
setError("Digite um valor");
|
||||
return;
|
||||
}
|
||||
const amount = parseFloat(customAmount);
|
||||
const _amount = parseFloat(customAmount);
|
||||
if (!isValidCustomAmount()) {
|
||||
setError(
|
||||
`Valor deve estar entre R$ ${customProduct.minAmount.toFixed(
|
||||
2
|
||||
)} e R$ ${customProduct.maxAmount.toFixed(2)}`
|
||||
2,
|
||||
)} e R$ ${customProduct.maxAmount.toFixed(2)}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -463,10 +462,10 @@ export function DonationCard({
|
||||
<p className="text-xs text-red-500">
|
||||
{parseFloat(customAmount) < customProduct.minAmount
|
||||
? `${t(
|
||||
"form.minAmount"
|
||||
"form.minAmount",
|
||||
)} ${customProduct.minAmount.toFixed(2)}`
|
||||
: `${t(
|
||||
"form.maxAmount"
|
||||
"form.maxAmount",
|
||||
)} ${customProduct.maxAmount.toFixed(2)}`}
|
||||
</p>
|
||||
)}
|
||||
@@ -485,7 +484,7 @@ export function DonationCard({
|
||||
</>
|
||||
) : customAmount ? (
|
||||
`${t("form.donate")} ${parseFloat(
|
||||
customAmount || "0"
|
||||
customAmount || "0",
|
||||
).toFixed(2)}`
|
||||
) : (
|
||||
t("form.chooseAmount")
|
||||
|
||||
Reference in new issue
Block a user