From 686499f8dd77e4d6ae02d2ba13c0bed396de478e Mon Sep 17 00:00:00 2001 From: lucas lelievre Date: Mon, 5 Jan 2026 16:20:45 +0100 Subject: [PATCH] fix fw tool source (#1690) --- gui/public/i18n/en/translation.ftl | 3 + .../firmware-tool/steps/SelectSourceStep.tsx | 63 +++++++++++-------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/gui/public/i18n/en/translation.ftl b/gui/public/i18n/en/translation.ftl index 30754f16f..914783abe 100644 --- a/gui/public/i18n/en/translation.ftl +++ b/gui/public/i18n/en/translation.ftl @@ -1399,6 +1399,9 @@ firmware_tool-select_source-firmware = Firmware Source firmware_tool-select_source-version = Firmware Version firmware_tool-select_source-official = Official firmware_tool-select_source-dev = Dev +firmware_tool-select_source-not_selected = No source selected +firmware_tool-select_source-no_boards = No available boards for this source +firmware_tool-select_source-no_versions = No available versions for this source firmware_tool-board_defaults = Configure your board firmware_tool-board_defaults-description = Set the pins or settings relative to your hardware diff --git a/gui/src/components/firmware-tool/steps/SelectSourceStep.tsx b/gui/src/components/firmware-tool/steps/SelectSourceStep.tsx index e15e6d761..18410bf76 100644 --- a/gui/src/components/firmware-tool/steps/SelectSourceStep.tsx +++ b/gui/src/components/firmware-tool/steps/SelectSourceStep.tsx @@ -101,13 +101,10 @@ export function SelectSourceSetep({ curr.push({ name: source.source, official: source.official, - disabled: - !partialBoard?.board || - !source.availableBoards.includes(partialBoard.board), }); return curr; }, - [] as { name: string; official: boolean; disabled: boolean }[] + [] as { name: string; official: boolean }[] ) .sort((a, b) => { if (a.official !== b.official) return a.official ? -1 : 1; @@ -115,6 +112,7 @@ export function SelectSourceSetep({ }), possibleBoards: sources ?.reduce((curr, source) => { + if (source.source !== partialBoard?.source) return curr; const unknownBoards = source.availableBoards.filter( (b) => !curr.includes(b) ); @@ -136,6 +134,7 @@ export function SelectSourceSetep({ possibleVersions: sources ?.reduce( (curr, source) => { + if (source.source !== partialBoard?.source) return curr; if (!curr.find(({ name }) => source.version === name)) curr.push({ disabled: @@ -193,6 +192,25 @@ export function SelectSourceSetep({ {!isFetching && !isError && (
+
+ + + +
+ {sourcesGroupped?.map(({ name, official }) => ( + { + if (partialBoard?.source !== name) + setPartialBoard({ source: name }); + }} + text={formatSource(name, official)} + /> + ))} +
+
@@ -203,7 +221,7 @@ export function SelectSourceSetep({ active={partialBoard?.board === board} key={`${board}`} onClick={() => { - setPartialBoard({ board }); + setPartialBoard((curr) => ({ ...curr, board })); }} tag={ board.startsWith('BOARD_SLIMEVR') @@ -219,30 +237,15 @@ export function SelectSourceSetep({ } /> ))} + {partialBoard?.source && possibleBoards?.length === 0 && ( + + )} + {!partialBoard?.source && ( + + )}
-
- - - -
- {sourcesGroupped?.map(({ name, official, disabled }) => ( - { - setPartialBoard((curr) => ({ - ...curr, - source: name, - })); - }} - text={formatSource(name, official)} - /> - ))} -
-
+
@@ -268,6 +271,12 @@ export function SelectSourceSetep({ text={name} /> ))} + {partialBoard?.source && possibleVersions?.length === 0 && ( + + )} + {!partialBoard?.source && ( + + )}