Refactor About component to use getAppEngine for Electron context
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
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:
parent
a5cad3b746
commit
3534a797fc
@ -30,7 +30,7 @@ const About = () => {
|
||||
const { token } = useContext(AuthContext)
|
||||
const { fetchApiServerVersion, fetchWsServerVersion } =
|
||||
useContext(ApiServerContext)
|
||||
const { isElectron, getElectronVersion } = useContext(ElectronContext)
|
||||
const { isElectron, getAppEngine } = useContext(ElectronContext)
|
||||
const { checkForUpdates } = useContext(AppUpdateContext)
|
||||
const isMobile = useMediaQuery({ maxWidth: 768 })
|
||||
|
||||
@ -74,18 +74,18 @@ const About = () => {
|
||||
useEffect(() => {
|
||||
if (!isElectron) return
|
||||
|
||||
getElectronVersion()
|
||||
.then((version) => {
|
||||
setElectronVersion(version || 'unknown')
|
||||
getAppEngine()
|
||||
.then((engine) => {
|
||||
setAppEngine(engine === 'chromium' ? 'Chromium' : 'Native')
|
||||
})
|
||||
.catch(() => {
|
||||
setElectronVersion('unknown')
|
||||
setAppEngine('Unknown')
|
||||
})
|
||||
}, [getElectronVersion, isElectron])
|
||||
}, [getAppEngine, isElectron])
|
||||
|
||||
const [apiServerVersion, setApiServerVersion] = useState(null)
|
||||
const [wsServerVersion, setWsServerVersion] = useState(null)
|
||||
const [electronVersion, setElectronVersion] = useState(null)
|
||||
const [appEngine, setAppEngine] = useState(null)
|
||||
|
||||
const apiServerVersionText = apiServerVersion ? (
|
||||
<Text>
|
||||
@ -99,8 +99,8 @@ const About = () => {
|
||||
) : (
|
||||
<Skeleton.Input active size='small' className='text-skeleton' />
|
||||
)
|
||||
const electronVersionText = electronVersion ? (
|
||||
<Text>{`v${electronVersion}`}</Text>
|
||||
const appEngineText = appEngine ? (
|
||||
<Text>{appEngine}</Text>
|
||||
) : (
|
||||
<Skeleton.Input active size='small' className='text-skeleton' />
|
||||
)
|
||||
@ -153,9 +153,7 @@ const About = () => {
|
||||
</Text>
|
||||
</Text>
|
||||
{isElectron && (
|
||||
<Text type='secondary'>
|
||||
Electron: {electronVersionText}
|
||||
</Text>
|
||||
<Text type='secondary'>Engine: {appEngineText}</Text>
|
||||
)}
|
||||
|
||||
<Text type='secondary'>REST API: {apiServerVersionText}</Text>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user