diff --git a/src/app/layout.tsx b/src/app/layout.tsx index e667072..9f1d0a5 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -50,6 +50,7 @@ export default function RootLayout ({ const [loadingText, setLoadingText] = useState('Loading...') const [outdated, setOutdated] = useState(false) const [version, setVersion] = useState(null) + const [platformName, setPlatformName] = useState(null) const [serverVersionList, setServerVersionList] = useState(null) @@ -88,7 +89,7 @@ export default function RootLayout ({ ) .filter(v => { if ( - platform() == 'linux' && + platformName == 'linux' && v.wine && !normalConfig.settings.useWineOnUnixWhenNeeded ) @@ -146,7 +147,7 @@ export default function RootLayout ({ if (!downloadedVersionsConfig || !serverVersionList) return null const allowWine = - platform() !== 'linux' || normalConfig?.settings.useWineOnUnixWhenNeeded + platformName !== 'linux' || normalConfig?.settings.useWineOnUnixWhenNeeded const installed = Object.keys(downloadedVersionsConfig.list).filter(v => { const info = getVersionInfo(v) @@ -231,10 +232,10 @@ export default function RootLayout ({ useEffect(() => { ;(async () => { + setPlatformName(platform()) const client = await app.getVersion() setVersion(client) if (process.env.NODE_ENV === 'production') { - setLoadingText('Checking latest version...') try { const response = await axios.get( 'https://games.lncvrt.xyz/api/launcher/latest' @@ -248,7 +249,6 @@ export default function RootLayout ({ return } } - setLoadingText('Downloading version list...') try { const res = await axios.get( `https://games.lncvrt.xyz/api/launcher/versions?platform=${platform()}&arch=${arch()}` @@ -258,7 +258,6 @@ export default function RootLayout ({ setLoadingText('Failed to download versions list.') return } - setLoadingText('Loading configs...') const normalConfig = await readNormalConfig() const versionsConfig = await readVersionsConfig() setDownloadedVersionsConfig(versionsConfig) @@ -450,26 +449,38 @@ export default function RootLayout ({ } > {loading ? ( -
- {outdated ? ( -
-

Outdated Launcher!

-

- Please update to the latest version to continue. -

- -
- ) : ( -

{loadingText}

- )} -
+ <> +