Menu
diff --git a/plugins/decky-vault/src/components/LibraryAppPanel.tsx b/plugins/decky-vault/src/components/LibraryAppPanel.tsx
index 601a3a4..8899671 100644
--- a/plugins/decky-vault/src/components/LibraryAppPanel.tsx
+++ b/plugins/decky-vault/src/components/LibraryAppPanel.tsx
@@ -1,18 +1,17 @@
import { useEffect, useState, useRef } from "react"
-import { PanelSectionRow, DropdownItem, ButtonItem, staticClasses } from "@decky/ui"
+import { PanelSectionRow, DialogButtonPrimary, staticClasses } from "@decky/ui"
import { Router } from "@decky/ui"
import {
fetchPluginGame,
- fetchPluginDevices,
setPluginApiBaseUrl,
type PluginGameResponse,
- type PluginDeviceRow,
} from "../lib/plugin-api"
+import { getHardwareInfo } from "../lib/api"
interface Props {
appId: number
title: string
- hardwareSlug: string | null // detected device
+ hardwareSlug: string | null // detected device (from settings, may be null)
baseUrl: string
}
@@ -34,10 +33,9 @@ function openExternalUrl(url: string) {
export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }: Props) {
const [data, setData] = useState
(null)
- const [devices, setDevices] = useState([])
const [loading, setLoading] = useState(true)
- const [device, setDevice] = useState(hardwareSlug ?? "") // "" = all devices
const [fetchError, setFetchError] = useState("")
+ const [detectedSlug, setDetectedSlug] = useState(hardwareSlug ?? null)
const reqIdRef = useRef(0)
useEffect(() => {
@@ -47,13 +45,23 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
async function load() {
setLoading(true)
try {
- const d = await fetchPluginGame(appId, device || null, 3)
+ // Detect hardware if not set in settings
+ let slug = hardwareSlug ?? null
+ if (!slug) {
+ try {
+ const hw = await getHardwareInfo()
+ if (hw.slug && hw.slug !== "unknown") slug = hw.slug
+ } catch {
+ // Fall back to global
+ }
+ if (!cancelled) setDetectedSlug(slug)
+ }
+
+ const d = await fetchPluginGame(appId, slug, 3)
if (cancelled || id !== reqIdRef.current) return
setFetchError(d.error && !d.game ? d.error : "")
setData(d)
setLoading(false)
- const devs = await fetchPluginDevices(appId)
- if (!cancelled && id === reqIdRef.current) setDevices(devs)
} catch {
if (!cancelled && id === reqIdRef.current) {
setData(null)
@@ -64,15 +72,7 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
}
load()
return () => { cancelled = true }
- }, [appId, device, baseUrl])
-
- const deviceOptions = [
- { label: "All devices", data: "" },
- ...(hardwareSlug ? [{ label: `Your device (${hardwareSlug})`, data: hardwareSlug }] : []),
- ...devices
- .filter((d) => d.slug !== hardwareSlug)
- .map((d) => ({ label: `${d.name} (${d.count})`, data: d.slug })),
- ]
+ }, [appId, baseUrl]) // re-fetch only when app changes
const gameUrl = data?.game?.steamAppId
? `${baseUrl}/game/${data.game.steamAppId}`
@@ -81,7 +81,7 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
if (loading) {
return (
-
+
DeckyVault loading…
@@ -91,7 +91,7 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
if (fetchError) {
return (
-
+
DeckyVault: {fetchError}
@@ -101,7 +101,7 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
if (!data || !data.game) {
return (
-
+
@@ -110,37 +110,34 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
return (
<>
- {/* Stats + device dropdown inline */}
-
-
-
- {data.estFps ? (
-
- {data.estFps.avg} avg
- {data.estFps.onePct != null && {data.estFps.onePct} 1% low}
- {data.estFps.low != null && {data.estFps.low} min}
- {data.estFps.high != null && {data.estFps.high} max}
- {data.estFps.tdpAvg != null && {data.estFps.tdpAvg}W TDP}
- ({data.estFps.count})
-
- ) : (
- No data yet
- )}
+
+
+ {/* Stats */}
+
+ {data.estFps ? (
+
+ {data.estFps.avg} avg
+ {data.estFps.onePct != null && {data.estFps.onePct} 1% low}
+ {data.estFps.low != null && {data.estFps.low} min}
+ {data.estFps.high != null && {data.estFps.high} max}
+ {data.estFps.tdpAvg != null && {data.estFps.tdpAvg}W TDP}
+ ({data.estFps.count})
+
+ ) : (
+ No data yet
+ )}
+ {/* Device scope badge */}
+
+ {detectedSlug ? detectedSlug : ⚠ global}
- setDevice(opt.data as string)}
- />
-
-
-
- {/* View Details button */}
-
- openExternalUrl(gameUrl)}>
+
+ {/* View Details — gamepad-navigable, CSS-constrained width */}
+
openExternalUrl(gameUrl)}>
View Details
-
-
+
+
>
)
}
\ No newline at end of file