minor ui change to how board profile is shown

This commit is contained in:
proddy
2026-01-10 19:00:05 +01:00
parent 8a7a1383a7
commit b78d47cbd0

View File

@@ -40,12 +40,23 @@ import { BOARD_PROFILES } from '../main/types';
import type { APIcall, BoardProfileKey, Settings } from '../main/types';
import { createSettingsValidator } from '../main/validators';
export function boardProfileSelectItems() {
return Object.keys(BOARD_PROFILES).map((code) => (
export function boardProfileSelectItems(boardProfile?: string, developerMode?: boolean, LL?: any) {
const items = Object.keys(BOARD_PROFILES).map((code) => (
<MenuItem key={code} value={code}>
{BOARD_PROFILES[code as BoardProfileKey]}
</MenuItem>
));
if (boardProfile === 'CUSTOM' || developerMode) {
items.push(<Divider />);
items.push(
<MenuItem key="CUSTOM" value="CUSTOM">
{LL?.CUSTOM()}
</MenuItem>
);
}
return items;
}
const ApplicationSettings = () => {
@@ -181,7 +192,10 @@ const ApplicationSettings = () => {
}, [validateAndSubmit, doRestart]);
// Memoize board profile select items to prevent recreation
const boardProfileItems = useMemo(() => boardProfileSelectItems(), []);
const boardProfileItems = useMemo(
() => boardProfileSelectItems(data?.board_profile, data?.developer_mode, LL),
[data?.board_profile, data?.developer_mode, LL]
);
const content = () => {
if (!data || !hardwareData) {
@@ -502,12 +516,6 @@ const ApplicationSettings = () => {
) : (
boardProfileItems
)}
<Divider />
{(data.board_profile === 'CUSTOM' || data.developer_mode) && (
<MenuItem key={'CUSTOM'} value={'CUSTOM'}>
{LL.CUSTOM()}&hellip;
</MenuItem>
)}
</TextField>
{data.board_profile === 'CUSTOM' && (
<>