From 421dcfdf367a8d5d3fd1526d67d47a3860a249ca Mon Sep 17 00:00:00 2001 From: Random <65575762+rndaom@users.noreply.github.com> Date: Mon, 16 Nov 2026 13:53:31 -0500 Subject: [PATCH 1/3] feat(hud): offer Match to catalog for an imported HUD An imported HUD that is also in the catalog now shows Match to catalog, so it can get update checks without being reinstalled. Folder names such as rayshud-master match their catalog HUD; the button stays hidden when no single catalog HUD fits. --- CHANGELOG.md | 5 +++++ apps/desktop/src/HudPane.tsx | 14 +++++++++----- apps/desktop/src/lib/hud-ui.test.ts | 27 +++++++++++++++++++++++++++ apps/desktop/src/lib/hud-ui.ts | 26 ++++++++++++++++++++++++++ docs/ARCHITECTURE.md | 2 +- docs/guide/hud.md | 2 ++ 6 files changed, 70 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b20ff24..0e05edb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ User-facing changes only. The release workflow publishes the matching ## [Unreleased] +### Fixed + +- HUD: an imported HUD that is also in the catalog now offers Match to catalog, so it can get + updates. The button was missing for imported HUDs. + ## [0.3.0] - 2026-11-15 ### Fixed diff --git a/apps/desktop/src/HudPane.tsx b/apps/desktop/src/HudPane.tsx index 5947611d..9ad0b4da 100644 --- a/apps/desktop/src/HudPane.tsx +++ b/apps/desktop/src/HudPane.tsx @@ -50,6 +50,7 @@ import { HUD_SORTS, hudAuthorCopy, hudCatalogControls, + hudCatalogMatch, hudDisplayName, hudInstallSourceCopy, hudOptionsDirty, @@ -224,6 +225,7 @@ export function HudPane({ const installedEntry = installedId ? (catalog.find((entry) => entry.id.toLowerCase() === installedId.toLowerCase()) ?? null) : null; + const catalogMatch = hudCatalogMatch(catalog, state); const mutationBlocked = locked || dirty || stateLoading || stateError !== null; const mutationReason = running ? "Close TF2 before changing the installed HUD." @@ -371,8 +373,10 @@ export function HudPane({ {installedEntry ? `${hudAuthorCopy(installedEntry)} · ` : ""} {installedLabel}

- {state.inferred ? ( -

Match it to hud-db to enable updates.

+ {catalogMatch ? ( +

+ Match it to {hudDisplayName(catalogMatch)} in the catalog to get updates. +

) : null}
{state.updateAvailable ? ( @@ -387,16 +391,16 @@ export function HudPane({ {running ? "Close TF2 to update" : "Update HUD"} ) : null} - {state.inferred ? ( + {catalogMatch ? ( ) : null} + ) : null} + {onDismissModsImportHint ? ( + + ) : null} + + + ) : null} +
void>>; +let onNavigate: ReturnType void>>; function makeApi() { return { getFilesContext: vi.fn(async () => ({ profileId, root: "fixture", layer: "vanilla" })), @@ -104,6 +105,7 @@ async function render() { onBindSyncHandled={() => {}} onBusyChange={() => {}} onPendingChange={onPendingChange} + onNavigate={onNavigate} onError={() => {}} /> @@ -131,6 +133,7 @@ beforeEach(() => { refreshKey = 1; api = makeApi(); onPendingChange = vi.fn(); + onNavigate = vi.fn(); }); afterEach(async () => { await act(async () => root.unmount()); @@ -322,6 +325,25 @@ describe("HUD loading through the real settings host and pane", () => { expect(element("toast").getAttribute("data-kind")).toBe("saved"); }); + it("points an import that is not a HUD to Mods instead of a bare failure", async () => { + await render(); + api.importHudArchive.mockRejectedValueOnce({ + code: "NotAHud", + message: "No HUD folder was found (missing info.vdf).", + }); + await click("hud-import"); + await click("hud-import-archive"); + const hint = element("hud-import-not-a-hud"); + expect(hint.textContent).toContain("That isn't a HUD"); + expect(container.querySelector('[data-testid="toast"][data-kind="error"]')).toBeNull(); + const open = Array.from(hint.querySelectorAll("button")).find( + (button) => button.textContent === "Open Mods", + ); + await act(async () => open?.click()); + expect(onNavigate).toHaveBeenCalledWith("mods"); + expect(container.querySelector('[data-testid="hud-import-not-a-hud"]')).toBeNull(); + }); + it("retains a same-HUD dirty draft through schema failure and retry without saving unavailable controls", async () => { vi.useFakeTimers(); running = true; diff --git a/apps/desktop/src/SettingsHost.tsx b/apps/desktop/src/SettingsHost.tsx index 55e9e043..4d0e57c0 100644 --- a/apps/desktop/src/SettingsHost.tsx +++ b/apps/desktop/src/SettingsHost.tsx @@ -272,6 +272,13 @@ export function SettingsHost({ }, [settled, onSettledChange]); // biome-ignore lint/correctness/useExhaustiveDependencies: Profile changes invalidate guidance from the previous import attempt. useEffect(() => setModsHudImportRequired(null), [profileId]); + // An import refused because the pick belongs in Mods, kept on its pane. + const [modsImportHint, setModsImportHint] = useState<{ + tab: "hud" | "viewmodels"; + message: string; + } | null>(null); + // biome-ignore lint/correctness/useExhaustiveDependencies: the notice belongs to the profile it was raised in. + useEffect(() => setModsImportHint(null), [profileId]); const hud = useHudResources( api, profileId, @@ -654,6 +661,15 @@ export function SettingsHost({ options?.onHandledFailure?.("review-required"); return false; } + if (failure.code === "NotAHud" || failure.code === "ViewmodelMixedContent") { + if (started) toast.cancelSave(copy?.source); + setModsImportHint({ + tab: failure.code === "NotAHud" ? "hud" : "viewmodels", + message: failure.message, + }); + options?.onFailure?.(failure.message); + return false; + } if ( (failure.code === "HudReviewRequired" || failure.code === "HudLiveReviewRequired") && expectedProfileId && @@ -1105,8 +1121,15 @@ export function SettingsHost({ await hud.reloadLocal(); }); }} + modsImportHint={modsImportHint?.tab === "hud" ? modsImportHint.message : null} + onOpenMods={() => { + setModsImportHint(null); + onNavigate?.("mods"); + }} + onDismissModsImportHint={() => setModsImportHint(null)} onImportArchive={() => { setModsHudImportRequired(null); + setModsImportHint(null); return write( async () => { if ((await api.importHudArchive()) === null) return null; @@ -1118,6 +1141,7 @@ export function SettingsHost({ }} onImportFolder={() => { setModsHudImportRequired(null); + setModsImportHint(null); return write( async () => { if ((await api.importHudFolder()) === null) return null; @@ -1223,7 +1247,14 @@ export function SettingsHost({ }} profilePreload={modsPayload?.profilePreload ?? null} loadCatalog={api.getViewmodelSourceCatalog} + modsImportHint={modsImportHint?.tab === "viewmodels" ? modsImportHint.message : null} + onOpenMods={() => { + setModsImportHint(null); + onNavigate?.("mods"); + }} + onDismissModsImportHint={() => setModsImportHint(null)} onImport={(preload) => { + setModsImportHint(null); return write( async () => { if ((await api.importViewmodels(preload)) === null) return null; diff --git a/apps/desktop/src/ViewmodelPane.tsx b/apps/desktop/src/ViewmodelPane.tsx index 70add161..41f2ce7d 100644 --- a/apps/desktop/src/ViewmodelPane.tsx +++ b/apps/desktop/src/ViewmodelPane.tsx @@ -1,5 +1,6 @@ import { DownloadSimple, Trash } from "@phosphor-icons/react"; import { useState } from "react"; +import { Alert } from "./components/ui/Alert"; import { ClassTabs } from "./components/ui/ClassTabs"; import { PaneHeader } from "./components/ui/PaneHeader"; import { useAppStatus, useCanWrite } from "./hooks/useAppStatus"; @@ -24,6 +25,9 @@ export function ViewmodelPane({ onImport, onBuild, onRemove, + modsImportHint = null, + onOpenMods, + onDismissModsImportHint, }: { active: boolean; profileId: string | null; @@ -33,6 +37,10 @@ export function ViewmodelPane({ profilePreload: boolean | null; loadCatalog: () => Promise; onImport: (preload: boolean) => void; + /** Why the last VPK was refused for carrying more than viewmodels. */ + modsImportHint?: string | null; + onOpenMods?: () => void; + onDismissModsImportHint?: () => void; onBuild: (request: ViewmodelBuildRequest) => Promise; onRemove: () => void; }) { @@ -69,6 +77,25 @@ export function ViewmodelPane({ onRemovePack={onRemove} /> + {modsImportHint ? ( + + That pack has more than viewmodels + {modsImportHint} + + {onOpenMods ? ( + + ) : null} + {onDismissModsImportHint ? ( + + ) : null} + + + ) : null} +
Date: Mon, 16 Nov 2026 13:53:34 -0500 Subject: [PATCH 3/3] feat(mods): show the conflicting pack from Crosshair and Sounds The conflict notices in Crosshair and Sounds now open Mods on Custom packs with the named pack scrolled into view and marked. When the folder is not one of the profile's custom packs, Mods says so. --- CHANGELOG.md | 5 ++++ apps/desktop/src/CrosshairPane.tsx | 11 ++++++-- apps/desktop/src/ModsPane.tsx | 18 +++++++++++- apps/desktop/src/SettingsHost.tsx | 13 ++++++++- apps/desktop/src/SoundsPane.tsx | 12 ++++++++ apps/desktop/src/components/ModList.test.tsx | 28 +++++++++++++++++++ apps/desktop/src/components/ModList.tsx | 26 +++++++++++++++-- .../src/crosshair/CrosshairWorkflow.test.tsx | 1 + apps/desktop/src/lib/mods-ui.test.ts | 14 ++++++++++ apps/desktop/src/lib/mods-ui.ts | 10 +++++++ docs/ARCHITECTURE.md | 2 +- docs/guide/crosshair.md | 2 +- docs/guide/sounds.md | 2 +- 13 files changed, 133 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b20ff24..f61d2280 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ User-facing changes only. The release workflow publishes the matching ## [Unreleased] +### Fixed + +- Crosshair and Sounds: when another pack replaces the same files, Show in Mods now opens Custom + packs with that pack marked, instead of only opening Mods. + ## [0.3.0] - 2026-11-15 ### Fixed diff --git a/apps/desktop/src/CrosshairPane.tsx b/apps/desktop/src/CrosshairPane.tsx index 1d255c44..328d5be8 100644 --- a/apps/desktop/src/CrosshairPane.tsx +++ b/apps/desktop/src/CrosshairPane.tsx @@ -174,7 +174,8 @@ export function CrosshairPane({ onDeactivate?: (stock?: { file: string; scale: number }) => Promise; stockArtSources?: ContentIndex | null; sourceStatus?: CrosshairSourceStatus | null; - onOpenMods?: () => void; + /** Shows the named `tf/custom` pack in Mods → Custom packs. */ + onOpenMods?: (pack: string) => void; hudOverlayState?: "enabled" | "disabled" | "possible" | "none"; hudName?: string; onOpenHud?: () => void; @@ -559,8 +560,12 @@ export function CrosshairPane({ different art.

{onOpenMods ? ( - ) : null}
diff --git a/apps/desktop/src/ModsPane.tsx b/apps/desktop/src/ModsPane.tsx index 4ea1735a..c1d02a33 100644 --- a/apps/desktop/src/ModsPane.tsx +++ b/apps/desktop/src/ModsPane.tsx @@ -102,6 +102,8 @@ export type ModsPaneProps = { hudImportRequired?: string | null; onReviewHudImport?: () => void; onDismissHudImport?: () => void; + /** A pack another pane asked to show; a new `key` opens Custom packs on it. */ + packFocus?: { pack: string; key: number } | null; /** Navigate from Viewmodels directly to the shared Casual preload control. */ casualOpenRequest?: number; }; @@ -138,6 +140,7 @@ export function ModsPane({ hudImportRequired, onReviewHudImport, onDismissHudImport, + packFocus = null, casualOpenRequest, }: ModsPaneProps) { const { running, busy } = useAppStatus(); @@ -211,6 +214,15 @@ export function ModsPane({ useEffect(() => { if (casualOpenRequest) setTask("casual"); }, [casualOpenRequest]); + // The highlight lasts until the player picks another task themselves. + const [focusedPack, setFocusedPack] = useState<{ pack: string; key: number } | null>(null); + const packFocusKey = packFocus?.key ?? 0; + // biome-ignore lint/correctness/useExhaustiveDependencies: only a new request, not a re-render with the same one, opens Custom packs. + useEffect(() => { + if (!packFocus) return; + setFocusedPack(packFocus); + setTask("installed"); + }, [packFocusKey]); const [confirmRestore, setConfirmRestore] = useState(false); // Steam's verify runs outside the app; while it does, poll the status and, // once every stale file reads as stock again, put the selection back. @@ -360,7 +372,10 @@ export function ModsPane({ label="Mod tasks" idPrefix="mods-task" panelId="mods-task-panel" - onSelect={setTask} + onSelect={(next) => { + setFocusedPack(null); + setTask(next); + }} /> {task !== "casual" && hasRepair ? ( + ) : null} ))} diff --git a/apps/desktop/src/components/ModList.test.tsx b/apps/desktop/src/components/ModList.test.tsx index 9dc209c6..b2e0d1a2 100644 --- a/apps/desktop/src/components/ModList.test.tsx +++ b/apps/desktop/src/components/ModList.test.tsx @@ -33,6 +33,34 @@ afterEach(async () => { }); describe("ModList", () => { + it("marks the pack another pane asked to show, or says it isn't a custom pack", async () => { + const render = (pack: string) => + root.render( + , + ); + await act(async () => render("Long-Mod.vpk")); + expect( + box.querySelector('[data-testid="mods-row-long-mod"]')?.getAttribute("data-focused"), + ).toBe("true"); + expect(box.querySelector('[data-testid="mods-row-other"]')?.hasAttribute("data-focused")).toBe( + false, + ); + expect(box.querySelector('[data-testid="mods-focus-missing"]')).toBeNull(); + await act(async () => render("execs-crosshairs")); + expect(box.querySelector('[data-testid="mods-focus-missing"]')?.textContent).toContain( + "tf/custom/execs-crosshairs", + ); + expect(box.querySelector("[data-focused]")).toBeNull(); + }); + it("toggles saved packs and protects selected particle sources", async () => { const onSetEnabled = vi.fn(); const render = (selected: string[], inactive = false) => diff --git a/apps/desktop/src/components/ModList.tsx b/apps/desktop/src/components/ModList.tsx index 6aa59adc..8e246392 100644 --- a/apps/desktop/src/components/ModList.tsx +++ b/apps/desktop/src/components/ModList.tsx @@ -1,8 +1,8 @@ import { ArrowSquareOut, Package } from "@phosphor-icons/react"; -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import type { ModRecord, ModUpdateStatus, ProfileSummary } from "../lib/bridge"; import { openExternal } from "../lib/bridge"; -import { formatModBytes, modDomId, modMetaLine, modSourceUrl } from "../lib/mods-ui"; +import { formatModBytes, modDomId, modMetaLine, modOwnsPack, modSourceUrl } from "../lib/mods-ui"; import { ModImport } from "./ModImport"; import { Modal } from "./ui/Modal"; import { PaneSection } from "./ui/PaneSection"; @@ -34,7 +34,10 @@ export function ModList({ checking = false, managementError, onCheckUpdates, + focus = null, }: { + /** A `tf/custom` pack to scroll to and mark; a new `key` repeats it. */ + focus?: { pack: string; key: number } | null; mods: ModRecord[]; /** TF2 is running or a write is in flight. */ locked: boolean; @@ -66,6 +69,13 @@ export function ModList({ setCopying(null); } }, [active]); + const focused = focus ? (mods.find((mod) => modOwnsPack(mod, focus.pack)) ?? null) : null; + const focusedRow = useRef(null); + const focusKey = focus?.key ?? 0; + // Scroll once per request, not on every list refresh. + useEffect(() => { + if (focusKey && active) focusedRow.current?.scrollIntoView?.({ block: "center" }); + }, [focusKey, active]); const copyMod = mods.find((mod) => mod.id === copying); // A status refresh may protect or remove a pack while its dialog is open. const current = confirming ? mods.find((mod) => mod.id === confirming.id) : undefined; @@ -114,6 +124,12 @@ export function ModList({

) : null} + {focus && !focused ? ( +

+ tf/custom/{focus.pack} isn't one of this profile's custom packs. +

+ ) : null} + {mods.length === 0 ? (