text changes

This commit is contained in:
proddy
2025-12-24 13:06:28 +01:00
parent 71281bc82d
commit 18f8db7942

View File

@@ -60,6 +60,13 @@ const DEV_RELNOTES_URL =
'https://github.com/emsesp/EMS-ESP32/blob/dev/CHANGELOG_LATEST.md'; 'https://github.com/emsesp/EMS-ESP32/blob/dev/CHANGELOG_LATEST.md';
// Types for better type safety // Types for better type safety
interface PartitionData {
partition: string;
version: string;
install_date?: string;
size: number;
}
interface VersionData { interface VersionData {
emsesp_version: string; emsesp_version: string;
arduino_version: string; arduino_version: string;
@@ -67,6 +74,9 @@ interface VersionData {
flash_chip_size: number; flash_chip_size: number;
psram: boolean; psram: boolean;
build_flags?: string; build_flags?: string;
partition: string;
partitions: PartitionData[];
developer_mode: boolean;
} }
interface UpgradeCheckData { interface UpgradeCheckData {
@@ -294,7 +304,7 @@ const InstallDialog = memo(
return ( return (
<Dialog sx={dialogStyle} open={openInstallDialog} onClose={onClose}> <Dialog sx={dialogStyle} open={openInstallDialog} onClose={onClose}>
<DialogTitle> <DialogTitle>
{`${LL.UPDATE()} ${fetchDevVersion ? LL.DEVELOPMENT() : LL.STABLE()} Firmware`} {`${LL.INSTALL()} ${fetchDevVersion ? LL.DEVELOPMENT() : LL.STABLE()} Firmware`}
</DialogTitle> </DialogTitle>
<DialogContent dividers> <DialogContent dividers>
<Typography mb={2}> <Typography mb={2}>
@@ -357,7 +367,9 @@ const InstallPartitionDialog = memo(
}) => { }) => {
return ( return (
<Dialog sx={dialogStyle} open={openInstallPartitionDialog} onClose={onClose}> <Dialog sx={dialogStyle} open={openInstallPartitionDialog} onClose={onClose}>
<DialogTitle>Rollback Firmware</DialogTitle> <DialogTitle>
{LL.INSTALL()} {LL.STORED_VERSIONS()}
</DialogTitle>
<DialogContent dividers> <DialogContent dividers>
<Typography mb={2}>{LL.INSTALL_VERSION(LL.INSTALL(), version)}</Typography> <Typography mb={2}>{LL.INSTALL_VERSION(LL.INSTALL(), version)}</Typography>
</DialogContent> </DialogContent>
@@ -457,9 +469,11 @@ const Version = () => {
// Memoized values // Memoized values
const platform = useMemo(() => (data ? getPlatform(data) : ''), [data]); const platform = useMemo(() => (data ? getPlatform(data) : ''), [data]);
const isDev = useMemo(
() => data?.emsesp_version.includes('dev') ?? false, // Memoize filtered partitions to avoid recomputing on every render
[data?.emsesp_version] const otherPartitions = useMemo(
() => data?.partitions.filter((p) => p.partition !== data.partition) ?? [],
[data]
); );
const setPartitionVersionInfo = useCallback( const setPartitionVersionInfo = useCallback(
@@ -496,7 +510,7 @@ const Version = () => {
}); });
await doRestart(); await doRestart();
}, },
[sendUploadURL] [sendUploadURL, doRestart]
); );
const installPartitionFirmware = useCallback( const installPartitionFirmware = useCallback(
@@ -702,7 +716,7 @@ const Version = () => {
alignItems: 'baseline' alignItems: 'baseline'
}} }}
> >
{data.partitions.length > 0 && data.developer_mode && ( {otherPartitions.length > 0 && data.developer_mode && (
<> <>
<Grid size={{ xs: 4, md: 2 }}> <Grid size={{ xs: 4, md: 2 }}>
<Typography color="secondary"> <Typography color="secondary">
@@ -710,11 +724,7 @@ const Version = () => {
</Typography> </Typography>
</Grid> </Grid>
<Grid size={{ xs: 8, md: 10 }}> <Grid size={{ xs: 8, md: 10 }}>
{data.partitions {otherPartitions.map((partition) => (
.filter(
(partition) => partition.partition !== data.partition
)
.map((partition) => (
<Typography key={partition.partition} mb={1}> <Typography key={partition.partition} mb={1}>
{partition.version} {partition.version}
<IconButton <IconButton
@@ -834,7 +844,6 @@ const Version = () => {
loadData, loadData,
LL, LL,
platform, platform,
isDev,
internetLive, internetLive,
latestVersion, latestVersion,
latestDevVersion, latestDevVersion,
@@ -848,7 +857,15 @@ const Version = () => {
handleVersionInfoClose, handleVersionInfoClose,
closeInstallDialog, closeInstallDialog,
installFirmwareURL, installFirmwareURL,
doRestart doRestart,
otherPartitions,
setPartitionVersionInfo,
showPartitionDialog,
partitionVersion,
partition,
firmwareSize,
closeInstallPartitionDialog,
installPartitionFirmware
]); ]);
return <SectionContent>{restarting ? <SystemMonitor /> : content}</SectionContent>; return <SectionContent>{restarting ? <SystemMonitor /> : content}</SectionContent>;