fix: show existing screenshots in edit mode, fix drag reorder jank, bump version to 2026.1.102
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
import { db } from "@/lib/db/index"
|
import { db } from "@/lib/db/index"
|
||||||
import { games, gameVersions, performanceEntries, gamePlatformSupport } from "@/lib/db/schema"
|
import { games, gameVersions, performanceEntries, gamePlatformSupport, entryScreenshots } from "@/lib/db/schema"
|
||||||
import { eq, sql } from "drizzle-orm"
|
import { eq, sql } from "drizzle-orm"
|
||||||
import { GameEntryWizard, type GameVersionInfo } from "@/components/wizard/game-entry-wizard"
|
import { GameEntryWizard, type GameVersionInfo } from "@/components/wizard/game-entry-wizard"
|
||||||
|
import { getR2PublicUrl } from "@/lib/storage/r2-client"
|
||||||
|
|
||||||
// This page needs live data — skip static generation at build time
|
// This page needs live data — skip static generation at build time
|
||||||
export const dynamic = "force-dynamic"
|
export const dynamic = "force-dynamic"
|
||||||
@@ -77,14 +78,39 @@ export default async function SubmitBenchmarkPage({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If editing, fetch the existing performance entry
|
// If editing, fetch the existing performance entry
|
||||||
let editEntry = null
|
let editEntry: any = null
|
||||||
if (edit) {
|
if (edit) {
|
||||||
const [entry] = await db
|
const [entry] = await db
|
||||||
.select()
|
.select()
|
||||||
.from(performanceEntries)
|
.from(performanceEntries)
|
||||||
.where(eq(performanceEntries.id, edit))
|
.where(eq(performanceEntries.id, edit))
|
||||||
.limit(1)
|
.limit(1)
|
||||||
editEntry = entry ?? null
|
|
||||||
|
if (entry) {
|
||||||
|
const publicUrl = getR2PublicUrl()
|
||||||
|
const screenshots = await db
|
||||||
|
.select({
|
||||||
|
id: entryScreenshots.id,
|
||||||
|
storageKey: entryScreenshots.storageKey,
|
||||||
|
orderIndex: entryScreenshots.orderIndex,
|
||||||
|
width: entryScreenshots.width,
|
||||||
|
height: entryScreenshots.height,
|
||||||
|
})
|
||||||
|
.from(entryScreenshots)
|
||||||
|
.where(eq(entryScreenshots.entryId, entry.id))
|
||||||
|
.orderBy(entryScreenshots.orderIndex)
|
||||||
|
|
||||||
|
editEntry = {
|
||||||
|
...entry,
|
||||||
|
screenshots: screenshots.map((ss) => ({
|
||||||
|
id: ss.id,
|
||||||
|
url: `${publicUrl}/${ss.storageKey}`,
|
||||||
|
width: ss.width,
|
||||||
|
height: ss.height,
|
||||||
|
orderIndex: ss.orderIndex,
|
||||||
|
})),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine default version: when editing, use the entry's version;
|
// Determine default version: when editing, use the entry's version;
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ function SettingRow({
|
|||||||
data-setting-row
|
data-setting-row
|
||||||
data-category={category}
|
data-category={category}
|
||||||
data-title={setting.title}
|
data-title={setting.title}
|
||||||
className="group grid grid-cols-[28px_36px_1fr_1fr_56px] gap-2 items-center rounded-lg border border-border bg-text/3 px-2 py-2 shadow-sm hover:shadow-md hover:bg-text/5 transition-all"
|
className="group grid grid-cols-[28px_36px_1fr_1fr_56px] gap-2 items-center rounded-lg border border-border bg-text/3 px-2 py-2 shadow-sm hover:shadow-md hover:bg-text/5 transition-shadow transition-colors"
|
||||||
initial={{ opacity: 0, x: -8 }}
|
initial={{ opacity: 0, x: -8 }}
|
||||||
animate={{ opacity: 1, x: 0 }}
|
animate={{ opacity: 1, x: 0 }}
|
||||||
exit={{ opacity: 0, x: -8 }}
|
exit={{ opacity: 0, x: -8 }}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ function ScreenshotCard({
|
|||||||
dragListener={false}
|
dragListener={false}
|
||||||
dragControls={dragControls}
|
dragControls={dragControls}
|
||||||
as='div'
|
as='div'
|
||||||
className='group relative rounded-xl border border-border bg-text/3 overflow-hidden shadow-sm hover:shadow-md hover:border-primary/30 transition-all'
|
className='group relative rounded-xl border border-border bg-text/3 overflow-hidden shadow-sm hover:shadow-md hover:border-primary/30 transition-shadow transition-colors transition-[border-color]'
|
||||||
whileDrag={{
|
whileDrag={{
|
||||||
scale: 1.02,
|
scale: 1.02,
|
||||||
boxShadow: "0 12px 40px rgba(0,0,0,0.3)",
|
boxShadow: "0 12px 40px rgba(0,0,0,0.3)",
|
||||||
|
|||||||
+2
-2
@@ -73,7 +73,7 @@ export const app = new Elysia({ prefix: "/api" })
|
|||||||
documentation: {
|
documentation: {
|
||||||
info: {
|
info: {
|
||||||
title: "DeckyVault API",
|
title: "DeckyVault API",
|
||||||
version: "2026.1.0",
|
version: "2026.1.102",
|
||||||
description:
|
description:
|
||||||
"API for DeckyVault — Steam Deck game compatibility, performance reports, and community features.",
|
"API for DeckyVault — Steam Deck game compatibility, performance reports, and community features.",
|
||||||
},
|
},
|
||||||
@@ -214,7 +214,7 @@ export const app = new Elysia({ prefix: "/api" })
|
|||||||
.use(rateLimit("default"))
|
.use(rateLimit("default"))
|
||||||
.get("/", () => ({
|
.get("/", () => ({
|
||||||
name: "DeckyVault API",
|
name: "DeckyVault API",
|
||||||
version: "2026.1.0",
|
version: "2026.1.102",
|
||||||
}))
|
}))
|
||||||
|
|
||||||
export type App = typeof app
|
export type App = typeof app
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "deckyvault",
|
"name": "deckyvault",
|
||||||
"version": "2026.1.0",
|
"version": "2026.1.102",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --experimental-https --webpack",
|
"dev": "next dev --experimental-https --webpack",
|
||||||
|
|||||||
Reference in New Issue
Block a user