chore: more linter errors

This commit is contained in:
Vasily Zubarev
2025-04-10 11:58:28 +02:00
parent 29a4ac4977
commit d88d0a1174
14 changed files with 67 additions and 62 deletions

View File

@@ -70,7 +70,7 @@ export default async function TransactionsPage({ searchParams }: { searchParams:
{transactions.length === 0 && (
<div className="flex flex-col items-center justify-center gap-2 h-full min-h-[400px]">
<p className="text-muted-foreground">
You don't seem to have any transactions yet. Let's start and create the first one!
You don&apos;t seem to have any transactions yet. Let&apos;s start and create the first one!
</p>
<div className="flex flex-row gap-5 mt-8">
<UploadButton>

View File

@@ -2,6 +2,7 @@ import SignupForm from "@/components/auth/signup-form"
import { Card, CardContent, CardTitle } from "@/components/ui/card"
import { ColoredText } from "@/components/ui/colored-text"
import config from "@/lib/config"
import Image from "next/image"
import { redirect } from "next/navigation"
export default async function LoginPage() {
@@ -11,7 +12,7 @@ export default async function LoginPage() {
return (
<Card className="w-full max-w-xl mx-auto p-8 flex flex-col items-center justify-center gap-4">
<img src="/logo/512.png" alt="Logo" className="w-36 h-36" />
<Image src="/logo/512.png" alt="Logo" width={144} height={144} className="w-36 h-36" />
<CardTitle className="text-3xl font-bold ">
<ColoredText>TaxHacker: Cloud Edition</ColoredText>
</CardTitle>

View File

@@ -14,7 +14,7 @@ export async function subscribeToNewsletterAction(email: string) {
})
if (existingContacts.data) {
const existingContact = existingContacts.data.data.find((contact: any) => contact.email === email)
const existingContact = existingContacts.data.data.find((contact: { email: string }) => contact.email === email)
if (existingContact) {
return { success: false, error: "You are already subscribed to the newsletter" }

View File

@@ -34,8 +34,8 @@ export function NewsletterForm() {
<div className="max-w-2xl mx-auto text-center">
<h3 className="text-2xl font-semibold mb-4">Stay Tuned</h3>
<p className="text-gray-600 mb-6">
We're working hard on making TaxHacker useful for everyone. Subscribe to our emails to get notified about our
plans and new features. No marketing, ads or spam.
We&apos;re working hard on making TaxHacker useful for everyone. Subscribe to our emails to get notified about
our plans and new features. No marketing, ads or spam.
</p>
<form onSubmit={handleSubmit} className="flex flex-col gap-4 max-w-md mx-auto">
<div className="flex flex-wrap items-center justify-center gap-4">

View File

@@ -5,6 +5,7 @@ import { getCurrentUser } from "@/lib/auth"
import { getSettings, updateSettings } from "@/models/settings"
import { Banknote, ChartBarStacked, FolderOpenDot, Key, TextCursorInput, X } from "lucide-react"
import { revalidatePath } from "next/cache"
import Image from "next/image"
import Link from "next/link"
export async function WelcomeWidget() {
@@ -13,11 +14,11 @@ export async function WelcomeWidget() {
return (
<Card className="flex flex-col lg:flex-row items-start gap-10 p-10 w-full">
<img src="/logo/1024.png" alt="Logo" className="w-64 h-64" />
<Image src="/logo/1024.png" alt="Logo" width={256} height={256} className="w-64 h-64" />
<div className="flex flex-col">
<CardTitle className="flex items-center justify-between">
<span className="text-2xl font-bold">
<ColoredText>Hey, I'm TaxHacker 👋</ColoredText>
<ColoredText>Hey, I&apos;m TaxHacker 👋</ColoredText>
</span>
<Button
variant="outline"
@@ -33,8 +34,8 @@ export async function WelcomeWidget() {
</CardTitle>
<CardDescription className="mt-5">
<p className="mb-3">
I'm a little accountant app that tries to help you deal with endless receipts, checks and invoices with (you
guessed it) GenAI. Here's what I can do:
I&apos;m a little accountant app that tries to help you deal with endless receipts, checks and invoices with
(you guessed it) GenAI. Here&apos;s what I can do:
</p>
<ul className="mb-5 list-disc pl-5 space-y-1">
<li>
@@ -59,7 +60,7 @@ export async function WelcomeWidget() {
CSV export for your tax advisor.
</li>
<li>
I'm still <strong>very young</strong> and can make mistakes. Use me at your own risk!
I&apos;m still <strong>very young</strong> and can make mistakes. Use me at your own risk!
</li>
</ul>
<p className="mb-3">

View File

@@ -1,3 +1,4 @@
import Head from "next/head"
import React from "react"
interface EmailLayoutProps {
@@ -7,7 +8,7 @@ interface EmailLayoutProps {
export const EmailLayout: React.FC<EmailLayoutProps> = ({ children, preview = "" }) => (
<html>
<head>
<Head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="color-scheme" content="light" />
@@ -49,7 +50,7 @@ export const EmailLayout: React.FC<EmailLayoutProps> = ({ children, preview = ""
`,
}}
/>
</head>
</Head>
<body>
<div className="container">{children}</div>
</body>

View File

@@ -6,7 +6,7 @@ export const NewsletterWelcomeEmail: React.FC = () => (
<h2 style={{ color: "#4f46e5" }}>👋 Welcome to TaxHacker!</h2>
<p style={{ fontSize: "16px", lineHeight: "1.5", color: "#333" }}>
Thank you for subscribing to our updates. We'll keep you updated about:
Thank you for subscribing to our updates. We&apos;ll keep you updated about:
</p>
<ul
style={{

View File

@@ -32,7 +32,7 @@ export const OTPEmail: React.FC<OTPEmailProps> = ({ otp }) => (
</div>
<p style={{ fontSize: "14px", color: "#666", textAlign: "center" }}>This code will expire in 10 minutes.</p>
<p style={{ fontSize: "14px", color: "#666", textAlign: "center" }}>
If you didn't request this code, please ignore this email.
If you didn&apos;t request this code, please ignore this email.
</p>
</EmailLayout>
)

View File

@@ -5,7 +5,7 @@ import { uploadFilesAction } from "@/app/(app)/files/actions"
import { uploadTransactionFilesAction } from "@/app/(app)/transactions/actions"
import { AlertCircle, CloudUpload, Loader2 } from "lucide-react"
import { useParams, useRouter } from "next/navigation"
import { startTransition, useEffect, useRef, useState } from "react"
import { startTransition, useCallback, useEffect, useRef, useState } from "react"
export default function ScreenDropArea({ children }: { children: React.ReactNode }) {
const router = useRouter()
@@ -54,51 +54,54 @@ export default function ScreenDropArea({ children }: { children: React.ReactNode
}
}
const handleDrop = async (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault()
e.stopPropagation()
const handleDrop = useCallback(
async (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault()
e.stopPropagation()
// Reset counter and dragging state
dragCounter.current = 0
setIsDragging(false)
// Reset counter and dragging state
dragCounter.current = 0
setIsDragging(false)
const files = e.dataTransfer.files
if (files && files.length > 0) {
setIsUploading(true)
setUploadError("")
const files = e.dataTransfer.files
if (files && files.length > 0) {
setIsUploading(true)
setUploadError("")
try {
const formData = new FormData()
if (transactionId) {
formData.append("transactionId", transactionId as string)
}
for (let i = 0; i < files.length; i++) {
formData.append("files", files[i])
}
startTransition(async () => {
const result = transactionId
? await uploadTransactionFilesAction(formData)
: await uploadFilesAction(formData)
if (result.success) {
showNotification({ code: "sidebar.unsorted", message: "new" })
setTimeout(() => showNotification({ code: "sidebar.unsorted", message: "" }), 3000)
if (!transactionId) {
router.push("/unsorted")
}
} else {
setUploadError(result.error ? result.error : "Something went wrong...")
try {
const formData = new FormData()
if (transactionId) {
formData.append("transactionId", transactionId as string)
}
for (let i = 0; i < files.length; i++) {
formData.append("files", files[i])
}
startTransition(async () => {
const result = transactionId
? await uploadTransactionFilesAction(formData)
: await uploadFilesAction(formData)
if (result.success) {
showNotification({ code: "sidebar.unsorted", message: "new" })
setTimeout(() => showNotification({ code: "sidebar.unsorted", message: "" }), 3000)
if (!transactionId) {
router.push("/unsorted")
}
} else {
setUploadError(result.error ? result.error : "Something went wrong...")
}
setIsUploading(false)
})
} catch (error) {
console.error("Upload error:", error)
setIsUploading(false)
})
} catch (error) {
console.error("Upload error:", error)
setIsUploading(false)
setUploadError(error instanceof Error ? error.message : "Something went wrong...")
setUploadError(error instanceof Error ? error.message : "Something went wrong...")
}
}
}
}
},
[transactionId, router, showNotification]
)
// Add event listeners to document body
useEffect(() => {

View File

@@ -16,10 +16,6 @@ export const FormConvertCurrency = ({
date?: Date | undefined
onChange?: (value: number) => void
}) => {
if (!originalTotal || !originalCurrencyCode || !targetCurrencyCode || originalCurrencyCode === targetCurrencyCode) {
return <></>
}
const normalizedDate = startOfDay(date || new Date(Date.now() - 24 * 60 * 60 * 1000))
const normalizedDateString = format(normalizedDate, "yyyy-MM-dd")
const [exchangeRate, setExchangeRate] = useState(0)
@@ -54,6 +50,10 @@ export const FormConvertCurrency = ({
onChange?.(convertedTotal)
}, [convertedTotal])
if (!originalTotal || !originalCurrencyCode || !targetCurrencyCode || originalCurrencyCode === targetCurrencyCode) {
return <></>
}
return (
<div className="flex flex-row gap-2 items-center">
{isLoading ? (

View File

@@ -117,7 +117,7 @@ export const FormDate = ({
if (!isNaN(newDate.getTime())) {
setDate(newDate)
}
} catch (_) {}
} catch {}
}
return (

View File

@@ -36,7 +36,7 @@ export function ImportCSVTable({ fields }: { fields: Field[] }) {
setColumnMappings([])
}
}
}, [parseState])
}, [parseState, fields])
useEffect(() => {
if (saveState?.success) {

View File

@@ -270,7 +270,6 @@ export function CrudTable<T extends { [key: string]: any }>({ items, columns, on
</div>
)
}
function itemDefaults<T>(columns: CrudColumn<T>[]) {
return columns.reduce((acc, column) => {
acc[column.key] = column.defaultValue as T[keyof T]

View File

@@ -254,7 +254,7 @@ export function TransactionList({ transactions, fields = [] }: { transactions: T
</TableRow>
</TableHeader>
<TableBody>
{transactions.map((transaction: any) => (
{transactions.map((transaction) => (
<TableRow
key={transaction.id}
className={cn(selectedIds.includes(transaction.id) && "bg-muted", "cursor-pointer hover:bg-muted/50")}