chore: fix build errors and lint warnings from devices/admin implementation

- Fix setRole type error (cast to admin-accepted role type)
- Fix OG image edge runtime → nodejs (Drizzle needs Node.js)
- Fix eslint set-state-in-effect warnings
- Fix img → next/image in admin users client
- Remove unused eslint-disable directives
This commit is contained in:
2026-04-27 22:22:52 +08:00
parent cfb5940f3c
commit 647a26db94
4 changed files with 9 additions and 4 deletions
@@ -66,6 +66,7 @@ export function HardwareClient() {
} }
useEffect(() => { useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
fetchDevices() fetchDevices()
}, []) }, [])
+5 -2
View File
@@ -1,6 +1,7 @@
"use client" "use client"
import { useEffect, useMemo, useState } from "react" import { useEffect, useMemo, useState } from "react"
import Image from "next/image"
import { authClient } from "@/lib/auth-client" import { authClient } from "@/lib/auth-client"
import { Loader2, SearchIcon, BanIcon, UserCheckIcon } from "lucide-react" import { Loader2, SearchIcon, BanIcon, UserCheckIcon } from "lucide-react"
@@ -60,7 +61,7 @@ export function UsersClient() {
const handleRoleChange = async (userId: string, newRole: Role) => { const handleRoleChange = async (userId: string, newRole: Role) => {
setActionLoading((prev) => ({ ...prev, [userId]: true })) setActionLoading((prev) => ({ ...prev, [userId]: true }))
try { try {
await authClient.admin.setRole({ userId, role: newRole }) await authClient.admin.setRole({ userId, role: newRole as "user" | "admin" })
setUsers((prev) => setUsers((prev) =>
prev.map((u) => (u.id === userId ? { ...u, role: newRole } : u)) prev.map((u) => (u.id === userId ? { ...u, role: newRole } : u))
) )
@@ -151,9 +152,11 @@ export function UsersClient() {
<td className="px-4 py-3"> <td className="px-4 py-3">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
{user.image ? ( {user.image ? (
<img <Image
src={user.image} src={user.image}
alt="" alt=""
width={32}
height={32}
className="h-8 w-8 rounded-full object-cover" className="h-8 w-8 rounded-full object-cover"
/> />
) : ( ) : (
+2 -1
View File
@@ -104,8 +104,9 @@ export function DeviceDetailClient({ device }: { device: DeviceInfo }) {
} }
useEffect(() => { useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
fetchStats() fetchStats()
}, [device.slug]) }, [device.slug]) // eslint-disable-line react-hooks/exhaustive-deps
const historicalOption = useMemo<EChartsOption>(() => { const historicalOption = useMemo<EChartsOption>(() => {
if (!stats || stats.historical.length === 0) return {} if (!stats || stats.historical.length === 0) return {}
+1 -1
View File
@@ -3,7 +3,7 @@ import { db } from "@/lib/db/index"
import { hardware, performanceEntries, gameVersions, games } from "@/lib/db/schema" import { hardware, performanceEntries, gameVersions, games } from "@/lib/db/schema"
import { eq, and, sql } from "drizzle-orm" import { eq, and, sql } from "drizzle-orm"
export const runtime = "edge" export const runtime = "nodejs"
export const alt = "Device benchmarks on DeckyVault" export const alt = "Device benchmarks on DeckyVault"
export const size = { width: 1200, height: 630 } export const size = { width: 1200, height: 630 }
export const contentType = "image/png" export const contentType = "image/png"