feat: updates page and lint fixes

This commit is contained in:
2026-05-01 10:15:13 +08:00
parent 7bcd580397
commit ca08024cb5
25 changed files with 188 additions and 314 deletions
+1
View File
@@ -31,6 +31,7 @@ export function CommentSection({ gameId, initialCount }: CommentSectionProps) {
const limit = 20
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
setMounted(true)
}, [])
+4 -4
View File
@@ -1,18 +1,18 @@
"use client";
import { useState, useEffect } from "react";
import { Bookmark, Plus, Trash2, Check } from "lucide-react";
import { Bookmark, Plus, Trash2 } from "lucide-react";
import { cn } from "@/lib/utils";
interface SavedFilter {
id: string;
name: string;
filters: Record<string, any>;
filters: Record<string, unknown>;
}
interface SavedFiltersProps {
currentFilters: Record<string, any>;
onLoad: (filters: Record<string, any>) => void;
currentFilters: Record<string, unknown>;
onLoad: (filters: Record<string, unknown>) => void;
className?: string;
}
+5 -4
View File
@@ -1,6 +1,6 @@
"use client";
import { useState, useEffect } from "react";
import { useState, useEffect, useCallback } from "react";
import { ThumbsUp, ThumbsDown, ExternalLink, MessageSquare } from "lucide-react";
import { cn } from "@/lib/utils";
@@ -42,7 +42,7 @@ export function SteamReviews({ gameId, steamAppId, className }: SteamReviewsProp
const [error, setError] = useState<string | null>(null);
const [offset, setOffset] = useState(0);
const fetchReviews = async (newOffset: number) => {
const fetchReviews = useCallback(async (newOffset: number) => {
setLoading(true);
setError(null);
@@ -64,11 +64,12 @@ export function SteamReviews({ gameId, steamAppId, className }: SteamReviewsProp
} finally {
setLoading(false);
}
};
}, [gameId, setData, setLoading, setError, setOffset]);
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
fetchReviews(0);
}, [gameId]);
}, [gameId, fetchReviews]);
// Loading skeleton
if (loading && !data) {
+25 -21
View File
@@ -2,26 +2,30 @@ import Link from "next/link"
import type { UpdateMeta } from "@/lib/updates"
export function UpdateCard({ update }: { update: UpdateMeta }) {
const formattedDate = new Date(update.date).toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
})
const formattedDate = new Date(update.date).toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
})
return (
<Link href={`/updates/${update.slug}`}>
<article className="group flex flex-col gap-2 p-4 rounded-lg border border-border hover:border-border-active hover:bg-text/3 transition-colors">
<div className="flex flex-row items-center gap-2">
<span className="text-xs font-mono px-2 py-0.5 rounded bg-primary/10 text-primary border border-primary/20">
v{update.version}
</span>
<time className="text-xs text-text/60">{formattedDate}</time>
</div>
<h3 className="text-lg font-semibold group-hover:text-primary transition-colors">
{update.title}
</h3>
<p className="text-sm text-text/60 line-clamp-2">{update.summary}</p>
</article>
</Link>
)
return (
<Link href={`/updates/${update.slug}`}>
<article className='group flex flex-col gap-2 p-4 border border-border rounded-md hover:bg-text/3 transition-colors'>
<div className='flex flex-row items-center gap-2'>
<span className='text-xs font-mono px-2 py-0.5 rounded bg-primary/10 text-primary border border-primary/20'>
v{update.version}
</span>
<time className='text-xs text-text/60'>
{formattedDate}
</time>
</div>
<h3 className='text-lg font-semibold group-hover:text-primary transition-colors'>
{update.title}
</h3>
<p className='text-sm text-text/60 line-clamp-2'>
{update.summary}
</p>
</article>
</Link>
)
}
+1 -1
View File
@@ -27,7 +27,7 @@ export function UpdateViewer({
</aside>
{/* Main content */}
<article className="flex-1 min-w-0">
<article className="flex-1 min-w-0 prose prose-invert lg:proxe-xl">
<header className="mb-8">
<div className="flex flex-row items-center gap-2 mb-2">
<span className="text-xs font-mono px-2 py-0.5 rounded bg-primary/10 text-primary border border-primary/20">
+2 -1
View File
@@ -5,7 +5,7 @@ import { useRouter } from "next/navigation"
import { motion, AnimatePresence } from "motion/react"
import { StepIndicator } from "@/components/wizard/step-indicator"
import { SetupStep, type GameVersionInfo } from "@/components/wizard/steps/setup-step"
import { AntiCheatStep, type AntiCheatData } from "@/components/wizard/steps/anti-cheat-step"
import { type AntiCheatData } from "@/components/wizard/steps/anti-cheat-step"
import { PerformanceStep, type PerformanceData } from "@/components/wizard/steps/performance-step"
import { SettingsStep } from "@/components/wizard/steps/settings-step"
import { EnvironmentStep, type EnvironmentData } from "@/components/wizard/steps/environment-step"
@@ -69,6 +69,7 @@ export function GameEntryWizard({ gameId, gameVersions, defaultVersionId, editEn
) ?? platformSupport.find((p) => p.antiCheatRelevant)
if (entry) {
// eslint-disable-next-line react-hooks/set-state-in-effect
setAntiCheat({
antiCheatRelevant: entry.antiCheatRelevant,
antiCheatName: entry.antiCheatName ?? "",
+2 -2
View File
@@ -1,7 +1,7 @@
"use client"
import { useState, useEffect } from "react"
import { Shield, ShieldCheck, ShieldX, ShieldQuestion, Pencil } from "lucide-react"
import { Shield, ShieldCheck, ShieldX, ShieldQuestion } from "lucide-react"
import { cn } from "@/lib/utils"
export type AntiCheatData = {
@@ -61,7 +61,7 @@ export function AntiCheatStep({
value,
onChange,
}: AntiCheatStepProps) {
const [isEditing, setIsEditing] = useState(false)
const [isEditing] = useState(false)
// Find the best existing entry to prefill:
// Prefer the entry for the currently selected hardware,
+1 -1
View File
@@ -1,7 +1,7 @@
"use client"
import { motion } from "motion/react"
import { Send, Loader2, AlertCircle, Monitor, Gauge, SlidersHorizontal, Terminal, FileText, GitBranch, Shield } from "lucide-react"
import { Send, Loader2, AlertCircle, Monitor, Gauge, SlidersHorizontal, Terminal, FileText } from "lucide-react"
import { TiptapEditor } from "@/components/tiptap-editor"
import type { SettingCategory } from "@/components/wizard/settings-editor"
import type { PerformanceData } from "./performance-step"
+4 -2
View File
@@ -33,11 +33,13 @@ interface SetupStepProps {
}
export function SetupStep({
gameId,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
gameId: _gameId,
gameVersions,
hardwareSlug,
onHardwareChange,
hardwareName,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
hardwareName: _hardwareName,
selectedVersionId,
onVersionChange,
newVersionString,