fix(examples): show STM32 boards in the gallery filter
Add STM32 Blue Pill / Black Pill tabs to BOARD_TABS, and make getBoardFilter honor an explicit boardFilter before the boards[] check. The STM32 examples are authored with the multi-board boards[] format even when single-board, so they were all bucketed under "Multi-Board" and had no STM32 filter tab. Now they appear under their dedicated STM32 tabs (attiny85 single-board examples authored the same way get correctly bucketed too). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
853877dbc9
commit
d9f98709d2
|
|
@ -33,6 +33,8 @@ const BOARD_TABS: BoardTab[] = [
|
|||
{ id: 'esp32', label: 'ESP32 (Xtensa)', color: '#ffffff', bg: '#e77d11' },
|
||||
{ id: 'esp32-cam', label: 'ESP32-CAM', color: '#ffffff', bg: '#d35400' },
|
||||
{ id: 'esp32-c3', label: 'ESP32-C3 (RISC-V)', color: '#ffffff', bg: '#27ae60' },
|
||||
{ id: 'stm32-bluepill', label: 'STM32 Blue Pill', color: '#ffffff', bg: '#0a7ea4' },
|
||||
{ id: 'stm32-blackpill', label: 'STM32 Black Pill', color: '#ffffff', bg: '#2d3436' },
|
||||
{ id: 'attiny85', label: 'ATtiny85', color: '#ffffff', bg: '#5d4037' },
|
||||
{ id: 'multi', label: 'Multi-Board', color: '#ffffff', bg: '#7b2d8b' },
|
||||
{ id: 'analog', label: 'Analog', color: '#ffffff', bg: '#0ea5a5' },
|
||||
|
|
@ -40,8 +42,12 @@ const BOARD_TABS: BoardTab[] = [
|
|||
];
|
||||
|
||||
function getBoardFilter(example: ExampleProject): string {
|
||||
if (example.boards) return 'multi';
|
||||
// An explicit boardFilter is the author's intent and wins — even for
|
||||
// examples authored with the multi-board `boards[]` format (e.g. the STM32
|
||||
// single-board examples). Genuinely multi-board examples with no boardFilter
|
||||
// still fall through to 'multi'.
|
||||
if ((example as any).boardFilter) return (example as any).boardFilter;
|
||||
if (example.boards) return 'multi';
|
||||
return example.boardType ?? 'arduino-uno';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue