Refactor About component to use getAppEngine for Electron context
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

- Replaced getElectronVersion with getAppEngine in the About component to retrieve the app engine type.
- Updated state management to reflect the app engine instead of the Electron version.
- Adjusted UI elements to display the app engine type, enhancing clarity for users regarding the application environment.
This commit is contained in:
Tom Butcher 2026-08-08 19:40:30 +01:00
parent a5cad3b746
commit 3534a797fc

View File

@ -30,7 +30,7 @@ const About = () => {
const { token } = useContext(AuthContext) const { token } = useContext(AuthContext)
const { fetchApiServerVersion, fetchWsServerVersion } = const { fetchApiServerVersion, fetchWsServerVersion } =
useContext(ApiServerContext) useContext(ApiServerContext)
const { isElectron, getElectronVersion } = useContext(ElectronContext) const { isElectron, getAppEngine } = useContext(ElectronContext)
const { checkForUpdates } = useContext(AppUpdateContext) const { checkForUpdates } = useContext(AppUpdateContext)
const isMobile = useMediaQuery({ maxWidth: 768 }) const isMobile = useMediaQuery({ maxWidth: 768 })
@ -74,18 +74,18 @@ const About = () => {
useEffect(() => { useEffect(() => {
if (!isElectron) return if (!isElectron) return
getElectronVersion() getAppEngine()
.then((version) => { .then((engine) => {
setElectronVersion(version || 'unknown') setAppEngine(engine === 'chromium' ? 'Chromium' : 'Native')
}) })
.catch(() => { .catch(() => {
setElectronVersion('unknown') setAppEngine('Unknown')
}) })
}, [getElectronVersion, isElectron]) }, [getAppEngine, isElectron])
const [apiServerVersion, setApiServerVersion] = useState(null) const [apiServerVersion, setApiServerVersion] = useState(null)
const [wsServerVersion, setWsServerVersion] = useState(null) const [wsServerVersion, setWsServerVersion] = useState(null)
const [electronVersion, setElectronVersion] = useState(null) const [appEngine, setAppEngine] = useState(null)
const apiServerVersionText = apiServerVersion ? ( const apiServerVersionText = apiServerVersion ? (
<Text> <Text>
@ -99,8 +99,8 @@ const About = () => {
) : ( ) : (
<Skeleton.Input active size='small' className='text-skeleton' /> <Skeleton.Input active size='small' className='text-skeleton' />
) )
const electronVersionText = electronVersion ? ( const appEngineText = appEngine ? (
<Text>{`v${electronVersion}`}</Text> <Text>{appEngine}</Text>
) : ( ) : (
<Skeleton.Input active size='small' className='text-skeleton' /> <Skeleton.Input active size='small' className='text-skeleton' />
) )
@ -153,9 +153,7 @@ const About = () => {
</Text> </Text>
</Text> </Text>
{isElectron && ( {isElectron && (
<Text type='secondary'> <Text type='secondary'>Engine: {appEngineText}</Text>
Electron: {electronVersionText}
</Text>
)} )}
<Text type='secondary'>REST API: {apiServerVersionText}</Text> <Text type='secondary'>REST API: {apiServerVersionText}</Text>