chore: organize ts types, fix eslint errors

This commit is contained in:
Vasily Zubarev
2025-04-09 12:45:56 +02:00
parent 707a030a0a
commit 416c45d08c
29 changed files with 277 additions and 84 deletions

View File

@@ -15,12 +15,12 @@ export async function selfHostedGetStartedAction(formData: FormData) {
const openaiApiKey = formData.get("openai_api_key")
if (openaiApiKey) {
await updateSettings(user.id, "openai_api_key", openaiApiKey)
await updateSettings(user.id, "openai_api_key", openaiApiKey as string)
}
const defaultCurrency = formData.get("default_currency")
if (defaultCurrency) {
await updateSettings(user.id, "default_currency", defaultCurrency)
await updateSettings(user.id, "default_currency", defaultCurrency as string)
}
revalidatePath("/dashboard")

View File

@@ -2,6 +2,7 @@ import { LoginForm } from "@/components/auth/login-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

@@ -1,16 +1,17 @@
import { X } from "lucide-react"
import Link from "next/link"
export default function AuthLayout({ children }: { children: React.ReactNode }) {
return (
<div className="min-h-screen bg-gray-900 flex flex-col relative">
<a
<Link
href="/"
className="absolute top-4 right-4 flex items-center justify-center w-10 h-10 rounded-full bg-gray-800 hover:bg-gray-700 transition-colors"
>
<span className="text-gray-300 font-bold text-xl">
<X />
</span>
</a>
</Link>
<div className="flex-grow flex flex-col justify-center items-center py-12 px-4 sm:px-6 lg:px-8">{children}</div>
</div>
)

View File

@@ -7,6 +7,7 @@ import config from "@/lib/config"
import { DEFAULT_CURRENCIES, DEFAULT_SETTINGS } from "@/models/defaults"
import { getSelfHostedUser } from "@/models/users"
import { ShieldAlert } from "lucide-react"
import Image from "next/image"
import { redirect } from "next/navigation"
import { selfHostedGetStartedAction } from "../actions"
@@ -36,12 +37,12 @@ export default async function SelfHostedWelcomePage() {
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: Self-Hosted Edition</ColoredText>
</CardTitle>
<CardDescription className="flex flex-col gap-4 text-center text-lg">
<p>Welcome to your own instance of TaxHacker. Let's set up a couple of settings to get started.</p>
<p>Welcome to your own instance of TaxHacker. Let&apos;s set up a couple of settings to get started.</p>
<form action={selfHostedGetStartedAction} className="flex flex-col gap-8 pt-8">
<div>

View File

@@ -4,7 +4,7 @@ import { getSelfHostedUser } from "@/models/users"
import { revalidatePath } from "next/cache"
import { redirect } from "next/navigation"
export async function GET(request: Request) {
export async function GET() {
if (!config.selfHosted.isEnabled) {
redirect(config.auth.loginUrl)
}