Make it so there is a topbar for windows if something fails to load

This commit is contained in:
2026-02-14 19:04:16 -07:00
parent 1700d127c3
commit 16ce04ba7a

View File

@@ -50,6 +50,7 @@ export default function RootLayout ({
const [loadingText, setLoadingText] = useState('Loading...') const [loadingText, setLoadingText] = useState('Loading...')
const [outdated, setOutdated] = useState(false) const [outdated, setOutdated] = useState(false)
const [version, setVersion] = useState<string | null>(null) const [version, setVersion] = useState<string | null>(null)
const [platformName, setPlatformName] = useState<string | null>(null)
const [serverVersionList, setServerVersionList] = const [serverVersionList, setServerVersionList] =
useState<null | ServerVersionsResponse>(null) useState<null | ServerVersionsResponse>(null)
@@ -88,7 +89,7 @@ export default function RootLayout ({
) )
.filter(v => { .filter(v => {
if ( if (
platform() == 'linux' && platformName == 'linux' &&
v.wine && v.wine &&
!normalConfig.settings.useWineOnUnixWhenNeeded !normalConfig.settings.useWineOnUnixWhenNeeded
) )
@@ -146,7 +147,7 @@ export default function RootLayout ({
if (!downloadedVersionsConfig || !serverVersionList) return null if (!downloadedVersionsConfig || !serverVersionList) return null
const allowWine = const allowWine =
platform() !== 'linux' || normalConfig?.settings.useWineOnUnixWhenNeeded platformName !== 'linux' || normalConfig?.settings.useWineOnUnixWhenNeeded
const installed = Object.keys(downloadedVersionsConfig.list).filter(v => { const installed = Object.keys(downloadedVersionsConfig.list).filter(v => {
const info = getVersionInfo(v) const info = getVersionInfo(v)
@@ -231,10 +232,10 @@ export default function RootLayout ({
useEffect(() => { useEffect(() => {
;(async () => { ;(async () => {
setPlatformName(platform())
const client = await app.getVersion() const client = await app.getVersion()
setVersion(client) setVersion(client)
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
setLoadingText('Checking latest version...')
try { try {
const response = await axios.get( const response = await axios.get(
'https://games.lncvrt.xyz/api/launcher/latest' 'https://games.lncvrt.xyz/api/launcher/latest'
@@ -248,7 +249,6 @@ export default function RootLayout ({
return return
} }
} }
setLoadingText('Downloading version list...')
try { try {
const res = await axios.get( const res = await axios.get(
`https://games.lncvrt.xyz/api/launcher/versions?platform=${platform()}&arch=${arch()}` `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.') setLoadingText('Failed to download versions list.')
return return
} }
setLoadingText('Loading configs...')
const normalConfig = await readNormalConfig() const normalConfig = await readNormalConfig()
const versionsConfig = await readVersionsConfig() const versionsConfig = await readVersionsConfig()
setDownloadedVersionsConfig(versionsConfig) setDownloadedVersionsConfig(versionsConfig)
@@ -450,7 +449,18 @@ export default function RootLayout ({
} }
> >
{loading ? ( {loading ? (
<div className='w-screen h-screen flex items-center justify-center'> <>
<div
className='relative z-2 w-screen border-b border-b-(--col3) h-8.25 bg-(--col1)'
hidden={platformName != 'windows'}
/>
<div
className={`w-screen ${
platformName == 'windows'
? 'h-[calc(100vh-64px)]'
: 'h-screen'
} flex items-center justify-center`}
>
{outdated ? ( {outdated ? (
<div className='text-center'> <div className='text-center'>
<p className='text-8xl mb-4'>Outdated Launcher!</p> <p className='text-8xl mb-4'>Outdated Launcher!</p>
@@ -470,6 +480,7 @@ export default function RootLayout ({
<p className='text-7xl text-center'>{loadingText}</p> <p className='text-7xl text-center'>{loadingText}</p>
)} )}
</div> </div>
</>
) : ( ) : (
<GlobalProvider <GlobalProvider
value={{ value={{
@@ -517,7 +528,7 @@ export default function RootLayout ({
<Sidebar /> <Sidebar />
<div <div
className='relative z-2 ml-59.75 w-[calc(100vw-239px)] border-b border-b-(--col3) h-8.25 bg-(--col1)' className='relative z-2 ml-59.75 w-[calc(100vw-239px)] border-b border-b-(--col3) h-8.25 bg-(--col1)'
hidden={platform() != 'windows'} hidden={platformName != 'windows'}
/> />
<div className='relative z-0'> <div className='relative z-0'>
<main className='ml-60'>{children}</main> <main className='ml-60'>{children}</main>