chore: build cleanup, fix lint errors in our changes, fix login Suspense boundary
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
|
import { Suspense } from "react"
|
||||||
import LoginForm from "@/components/auth/login-form"
|
import LoginForm from "@/components/auth/login-form"
|
||||||
|
|
||||||
export default function LoginPage() {
|
export default function LoginPage() {
|
||||||
return <LoginForm />
|
return (
|
||||||
|
<Suspense>
|
||||||
|
<LoginForm />
|
||||||
|
</Suspense>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,12 +54,10 @@ function AutocompleteInput({
|
|||||||
const [suggestions, setSuggestions] = useState<string[]>([])
|
const [suggestions, setSuggestions] = useState<string[]>([])
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const [inputValue, setInputValue] = useState(value)
|
const [localValue, setLocalValue] = useState("")
|
||||||
|
const [isFocused, setIsFocused] = useState(false)
|
||||||
const containerRef = useRef<HTMLDivElement>(null)
|
const containerRef = useRef<HTMLDivElement>(null)
|
||||||
|
const inputValue = isFocused ? localValue : (value ?? "")
|
||||||
useEffect(() => {
|
|
||||||
setInputValue(value)
|
|
||||||
}, [value])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleClickOutside(e: MouseEvent) {
|
function handleClickOutside(e: MouseEvent) {
|
||||||
@@ -93,19 +91,21 @@ function AutocompleteInput({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const handleFocus = () => {
|
const handleFocus = () => {
|
||||||
|
setLocalValue(value ?? "")
|
||||||
|
setIsFocused(true)
|
||||||
setOpen(true)
|
setOpen(true)
|
||||||
fetchSuggestions(inputValue)
|
fetchSuggestions(value ?? "")
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleChange = (val: string) => {
|
const handleChange = (val: string) => {
|
||||||
setInputValue(val)
|
setLocalValue(val)
|
||||||
onChange(val)
|
onChange(val)
|
||||||
fetchSuggestions(val)
|
fetchSuggestions(val)
|
||||||
setOpen(true)
|
setOpen(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSelect = (val: string) => {
|
const handleSelect = (val: string) => {
|
||||||
setInputValue(val)
|
setLocalValue(val)
|
||||||
onChange(val)
|
onChange(val)
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
}
|
}
|
||||||
@@ -119,6 +119,7 @@ function AutocompleteInput({
|
|||||||
value={inputValue}
|
value={inputValue}
|
||||||
onChange={(e) => handleChange(e.target.value)}
|
onChange={(e) => handleChange(e.target.value)}
|
||||||
onFocus={handleFocus}
|
onFocus={handleFocus}
|
||||||
|
onBlur={() => setIsFocused(false)}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
className="w-full px-4 py-3 rounded-lg border border-border bg-text/5 text-text text-sm placeholder:text-text/40 outline-none focus:border-primary focus:ring-2 focus:ring-primary/50 transition-colors"
|
className="w-full px-4 py-3 rounded-lg border border-border bg-text/5 text-text text-sm placeholder:text-text/40 outline-none focus:border-primary focus:ring-2 focus:ring-primary/50 transition-colors"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { Elysia, t } from "elysia"
|
import { Elysia, t } from "elysia"
|
||||||
import { auth } from "@/lib/auth"
|
|
||||||
import { db } from "@/lib/db/index"
|
import { db } from "@/lib/db/index"
|
||||||
import {
|
import {
|
||||||
performanceEntries,
|
performanceEntries,
|
||||||
gameVersions,
|
gameVersions,
|
||||||
hardware,
|
hardware,
|
||||||
} from "@/lib/db/schema"
|
} from "@/lib/db/schema"
|
||||||
import { eq, sql, and } from "drizzle-orm"
|
import { eq, sql } from "drizzle-orm"
|
||||||
import { requireRole } from "@/lib/auth/guard"
|
import { requireRole } from "@/lib/auth/guard"
|
||||||
|
|
||||||
export const performanceSubmitRoutes = new Elysia({ prefix: "/performance" })
|
export const performanceSubmitRoutes = new Elysia({ prefix: "/performance" })
|
||||||
|
|||||||
Reference in New Issue
Block a user