mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-26 08:39:09 +03:00
rollback
This commit is contained in:
@@ -40,23 +40,12 @@ import { BOARD_PROFILES } from '../main/types';
|
|||||||
import type { APIcall, BoardProfileKey, Settings } from '../main/types';
|
import type { APIcall, BoardProfileKey, Settings } from '../main/types';
|
||||||
import { createSettingsValidator } from '../main/validators';
|
import { createSettingsValidator } from '../main/validators';
|
||||||
|
|
||||||
export function boardProfileSelectItems(boardProfile?: string, developerMode?: boolean, LL?: any) {
|
export function boardProfileSelectItems() {
|
||||||
const items = Object.keys(BOARD_PROFILES).map((code) => (
|
return Object.keys(BOARD_PROFILES).map((code) => (
|
||||||
<MenuItem key={code} value={code}>
|
<MenuItem key={code} value={code}>
|
||||||
{BOARD_PROFILES[code as BoardProfileKey]}
|
{BOARD_PROFILES[code as BoardProfileKey]}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
));
|
));
|
||||||
|
|
||||||
if (boardProfile === 'CUSTOM' || developerMode) {
|
|
||||||
items.push(<Divider />);
|
|
||||||
items.push(
|
|
||||||
<MenuItem key="CUSTOM" value="CUSTOM">
|
|
||||||
{LL?.CUSTOM()}
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ApplicationSettings = () => {
|
const ApplicationSettings = () => {
|
||||||
@@ -192,10 +181,7 @@ const ApplicationSettings = () => {
|
|||||||
}, [validateAndSubmit, doRestart]);
|
}, [validateAndSubmit, doRestart]);
|
||||||
|
|
||||||
// Memoize board profile select items to prevent recreation
|
// Memoize board profile select items to prevent recreation
|
||||||
const boardProfileItems = useMemo(
|
const boardProfileItems = useMemo(() => boardProfileSelectItems(), []);
|
||||||
() => boardProfileSelectItems(data?.board_profile, data?.developer_mode, LL),
|
|
||||||
[data?.board_profile, data?.developer_mode, LL]
|
|
||||||
);
|
|
||||||
|
|
||||||
const content = () => {
|
const content = () => {
|
||||||
if (!data || !hardwareData) {
|
if (!data || !hardwareData) {
|
||||||
@@ -516,6 +502,12 @@ const ApplicationSettings = () => {
|
|||||||
) : (
|
) : (
|
||||||
boardProfileItems
|
boardProfileItems
|
||||||
)}
|
)}
|
||||||
|
<Divider />
|
||||||
|
{(data.board_profile === 'CUSTOM' || data.developer_mode) && (
|
||||||
|
<MenuItem key={'CUSTOM'} value={'CUSTOM'}>
|
||||||
|
{LL.CUSTOM()}…
|
||||||
|
</MenuItem>
|
||||||
|
)}
|
||||||
</TextField>
|
</TextField>
|
||||||
{data.board_profile === 'CUSTOM' && (
|
{data.board_profile === 'CUSTOM' && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user