chore: fix lint and type errors from feature bundle implementation

This commit is contained in:
2026-04-29 00:54:39 +08:00
parent 2101dfef08
commit fcfcce614a
5 changed files with 19 additions and 18 deletions
@@ -49,6 +49,7 @@ export function StabilityScatterChart({ data, deviceNames }: { data: ScatterPoin
const option = {
tooltip: {
trigger: "item" as const,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
formatter: (params: any) => {
if (params.seriesName === "Perfect Stability") return ""
return `${params.seriesName}<br/>Avg: ${params.value[0]} fps<br/>1% Low: ${params.value[1]} fps`
+13 -13
View File
@@ -3,6 +3,7 @@
import { useState, useEffect, useRef } from "react"
import Image from "next/image"
import { SearchIcon, XIcon, Gamepad2Icon } from "lucide-react"
import { useDebounce } from "@/lib/hooks/useDebounce"
interface SearchResult {
id: string
@@ -25,28 +26,28 @@ export function GameSelector({ selectedGames, onSelect, onRemove, maxSelections
const [loading, setLoading] = useState(false)
const [open, setOpen] = useState(false)
const wrapperRef = useRef<HTMLDivElement>(null)
const debouncedQuery = useDebounce(query, 300)
useEffect(() => {
if (query.length < 2) {
setResults([])
if (debouncedQuery.length < 2) {
return
}
let cancelled = false
const timeout = setTimeout(async () => {
async function fetchResults() {
setLoading(true)
try {
const res = await fetch(`/api/search/unified?q=${encodeURIComponent(query)}`)
const res = await fetch(`/api/search/unified?q=${encodeURIComponent(debouncedQuery)}`)
if (!res.ok) throw new Error("Search failed")
const data = await res.json()
const data = await res.json() as { results: Array<{ id?: string; appId?: number; title: string; image: string | null; source: string }> }
if (!cancelled) {
setResults(
(data.results || [])
.filter((r: any) => !selectedGames.some(sg => sg.id === (r.id || `steam-${r.appId}`)))
.filter((r) => !selectedGames.some(sg => sg.id === (r.id || `steam-${r.appId}`)))
.slice(0, 8)
.map((r: any) => ({
.map((r) => ({
id: r.id || `steam-${r.appId}`,
appId: r.appId,
appId: r.appId ?? null,
title: r.title,
image: r.image,
source: r.source,
@@ -58,13 +59,12 @@ export function GameSelector({ selectedGames, onSelect, onRemove, maxSelections
} finally {
if (!cancelled) setLoading(false)
}
}, 300)
}
fetchResults()
return () => {
cancelled = true
clearTimeout(timeout)
}
}, [query, selectedGames])
}, [debouncedQuery, selectedGames])
// Close dropdown on outside click
useEffect(() => {
@@ -122,7 +122,7 @@ export function GameSelector({ selectedGames, onSelect, onRemove, maxSelections
</div>
{/* Dropdown results */}
{open && (query.length >= 2) && (
{open && (debouncedQuery.length >= 2) && (
<div className="absolute z-50 top-full left-0 right-0 mt-1 rounded-lg border border-border bg-background shadow-lg max-h-64 overflow-y-auto">
{loading && (
<div className="px-4 py-3 text-xs text-text/40">Searching...</div>
+2 -2
View File
@@ -98,8 +98,8 @@ export function NonSteamEditForm({ game, platformSupport, hardwareList, isOwner,
}
router.push(`/game/${game.id}`)
router.refresh()
} catch (err: any) {
setError(err.message || "Failed to update game")
} catch (err: unknown) {
setError(err instanceof Error ? err.message : "Failed to update game")
} finally {
setLoading(false)
}
@@ -1,6 +1,6 @@
"use client"
import { ImageIcon, Monitor, Info, FileText, Link, Calendar } from "lucide-react"
import { ImageIcon, Monitor, Info, FileText, Link } from "lucide-react"
import { BasicInfoData } from "./non-steam-basic-info-step"
import { PlatformSupportItem } from "./non-steam-platform-step"