fix: address final review — 404 error field, aggregate estFps, recent entries, panel props

This commit is contained in:
2026-07-13 05:30:17 +08:00
parent d63ec4a42e
commit bfd36ad632
4 changed files with 105 additions and 24 deletions
@@ -140,23 +140,33 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
</div>
</PanelSectionRow>
{/* Est FPS */}
<PanelSectionRow>
<div className={staticClasses.Text} style={{ fontSize: "13px", padding: "4px 0", display: "flex", alignItems: "center", gap: 6 }}>
<FaChartLine /> Est FPS
</div>
</PanelSectionRow>
{data.estFps ? (
<PanelSectionRow>
<div className={staticClasses.Text} style={{ fontSize: "13px", padding: "0 0 6px 0" }}>
<strong>{data.estFps.avg}</strong> avg · {data.estFps.low ?? "—"} low · {data.estFps.onePct ?? "—"} 1% · {data.estFps.high ?? "—"} high
<span style={{ opacity: 0.5, fontSize: "11px" }}> · {data.estFps.count} entries</span>
</div>
</PanelSectionRow>
{/* Est FPS — hidden when "All devices" selected to avoid mixing hardware */}
{device ? (
<>
<PanelSectionRow>
<div className={staticClasses.Text} style={{ fontSize: "13px", padding: "4px 0", display: "flex", alignItems: "center", gap: 6 }}>
<FaChartLine /> Est FPS
</div>
</PanelSectionRow>
{data.estFps ? (
<PanelSectionRow>
<div className={staticClasses.Text} style={{ fontSize: "13px", padding: "0 0 6px 0" }}>
<strong>{data.estFps.avg}</strong> avg · {data.estFps.low ?? "—"} low · {data.estFps.onePct ?? "—"} 1% · {data.estFps.high ?? "—"} high
<span style={{ opacity: 0.5, fontSize: "11px" }}> · {data.estFps.count} entries</span>
</div>
</PanelSectionRow>
) : (
<PanelSectionRow>
<div className={staticClasses.Text} style={{ fontSize: "12px", opacity: 0.6, padding: "0 0 6px 0" }}>
No entries for this device yet be the first: open the DeckyVault plugin and record.
</div>
</PanelSectionRow>
)}
</>
) : (
<PanelSectionRow>
<div className={staticClasses.Text} style={{ fontSize: "12px", opacity: 0.6, padding: "0 0 6px 0" }}>
No entries for this device yet be the first: open the DeckyVault plugin and record.
<div className={staticClasses.Text} style={{ fontSize: "12px", opacity: 0.6, padding: "4px 0" }}>
Select a device to see estimated FPS.
</div>
</PanelSectionRow>
)}
@@ -182,6 +192,18 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
{data.topEntries.map((e) => <EntryCard key={e.id} e={e} />)}
</>
)}
{/* Recent entries */}
{data.recentEntries.length > 0 && (
<>
<PanelSectionRow>
<div className={staticClasses.Text} style={{ fontSize: "11px", opacity: 0.5, padding: "8px 0 2px 0", textTransform: "uppercase", letterSpacing: "0.05em" }}>
Recent entries
</div>
</PanelSectionRow>
{data.recentEntries.map((e) => <EntryCard key={e.id} e={e} />)}
</>
)}
</PanelSection>
)
}
@@ -7,6 +7,7 @@ import {
import { routerHook } from "@decky/api"
import type { ReactElement } from "react"
import LibraryAppPanel from "../components/LibraryAppPanel"
import { getSettings } from "../lib/api"
// Mirror of HLTB-for-Deck's patchAppPage, guarded so a Steam UI change
// degrades to "section not shown" instead of crashing Steam.
@@ -20,7 +21,24 @@ export function setLibraryAppPanelProps(p: { hardwareSlug: string | null; baseUr
panelProps = p
}
// Read settings directly from the Python backend so the panel has them even
// if the QAM Content tab has never mounted (which is what populates panelProps
// via setLibraryAppPanelProps). Keeps hardwareSlug/baseUrl in sync eagerly.
async function loadPanelProps() {
try {
const s = await getSettings()
panelProps = {
hardwareSlug: (s.hardwareSlug as string) || null,
baseUrl: (s.baseUrl as string) || "https://deckyvault.xyz",
}
} catch {
// Use defaults — panelProps retains its last known value
}
}
export function registerLibraryAppPatch() {
// Load settings eagerly so the panel has them even if Content never mounted
loadPanelProps()
return routerHook.addPatch("/library/app/:appid", (routerTree: any) => {
try {
const routeProps = findInReactTree(routerTree, (x: any) => x?.renderFunc)