format code + change env

This commit is contained in:
Thomas Camlong
2025-10-01 19:01:31 +02:00
parent 0a4a4a78f4
commit 49aab75953
19 changed files with 1282 additions and 1468 deletions

View File

@@ -4,13 +4,7 @@ import { Github } from "lucide-react"
import type React from "react"
import { useRef, useState } from "react"
import { Button } from "@/components/ui/button"
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog"
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Separator } from "@/components/ui/separator"
@@ -30,7 +24,6 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
const [error, setError] = useState("")
const [isLoading, setIsLoading] = useState(false)
const emailRef = useRef<HTMLInputElement>(null)
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
setError("")
@@ -95,21 +88,21 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-md bg-background border shadow-2xl ">
<DialogHeader className="space-y-3">
<DialogTitle className="text-2xl font-bold">
{isRegister ? "Create account" : "Sign in"}
</DialogTitle>
<DialogTitle className="text-2xl font-bold">{isRegister ? "Create account" : "Sign in"}</DialogTitle>
<DialogDescription className="text-base">
{isRegister
? "Enter your details to create an account"
: "Enter your credentials to continue"}
{isRegister ? "Enter your details to create an account" : "Enter your credentials to continue"}
</DialogDescription>
</DialogHeader>
<form onSubmit={handleSubmit} className="space-y-5 pt-2">
{error && (
<div className="text-sm text-destructive bg-destructive/10 border border-destructive/20 px-4 py-3 rounded-lg flex items-start gap-2">
<svg className="h-5 w-5 flex-shrink-0 mt-0.5" fill="currentColor" viewBox="0 0 20 20">
<path fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clipRule="evenodd" />
<path
fillRule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"
clipRule="evenodd"
/>
</svg>
<span>{error}</span>
</div>
@@ -135,7 +128,7 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
<fieldset className="space-y-2 border-0 p-0">
<div className="space-y-2">
<Label htmlFor="email" className="text-sm font-medium">
Email or Username
Email {!isRegister && "or Username"}
</Label>
<Input
id="email"
@@ -145,7 +138,7 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
name="email"
type="text"
autoComplete="username"
placeholder="Enter your email or username"
placeholder={`Enter your email${isRegister ? "" : " or username"}`}
value={email}
onChange={(e) => setEmail(e.target.value)}
aria-invalid={error ? "true" : "false"}
@@ -153,9 +146,7 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
required
/>
{isRegister && (
<p className="text-xs text-muted-foreground leading-relaxed">
Used only to send you updates about your submissions
</p>
<p className="text-xs text-muted-foreground leading-relaxed">Used only to send you updates about your submissions</p>
)}
</div>
@@ -177,9 +168,7 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
className="h-11 text-base"
required
/>
<p className="text-xs text-muted-foreground leading-relaxed">
This will be displayed publicly with your submissions
</p>
<p className="text-xs text-muted-foreground leading-relaxed">This will be displayed publicly with your submissions</p>
</div>
)}
@@ -225,16 +214,16 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
</fieldset>
<footer className="space-y-4 pt-2">
<Button
type="submit"
className="w-full h-11 text-base font-semibold shadow-sm"
disabled={isLoading}
>
<Button type="submit" className="w-full h-11 text-base font-semibold shadow-sm" disabled={isLoading}>
{isLoading ? (
<>
<svg className="animate-spin -ml-1 mr-3 h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
</svg>
Please wait...
</>
@@ -263,4 +252,3 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
</Dialog>
)
}