Make it so there is a topbar for windows if something fails to load
This commit is contained in:
@@ -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,26 +449,38 @@ export default function RootLayout ({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className='w-screen h-screen flex items-center justify-center'>
|
<>
|
||||||
{outdated ? (
|
<div
|
||||||
<div className='text-center'>
|
className='relative z-2 w-screen border-b border-b-(--col3) h-8.25 bg-(--col1)'
|
||||||
<p className='text-8xl mb-4'>Outdated Launcher!</p>
|
hidden={platformName != 'windows'}
|
||||||
<p className='text-4xl mb-4'>
|
/>
|
||||||
Please update to the latest version to continue.
|
<div
|
||||||
</p>
|
className={`w-screen ${
|
||||||
<button
|
platformName == 'windows'
|
||||||
className='button'
|
? 'h-[calc(100vh-64px)]'
|
||||||
onClick={() =>
|
: 'h-screen'
|
||||||
openUrl('https://games.lncvrt.xyz/berrydash/download')
|
} flex items-center justify-center`}
|
||||||
}
|
>
|
||||||
>
|
{outdated ? (
|
||||||
Download latest version
|
<div className='text-center'>
|
||||||
</button>
|
<p className='text-8xl mb-4'>Outdated Launcher!</p>
|
||||||
</div>
|
<p className='text-4xl mb-4'>
|
||||||
) : (
|
Please update to the latest version to continue.
|
||||||
<p className='text-7xl text-center'>{loadingText}</p>
|
</p>
|
||||||
)}
|
<button
|
||||||
</div>
|
className='button'
|
||||||
|
onClick={() =>
|
||||||
|
openUrl('https://games.lncvrt.xyz/berrydash/download')
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Download latest version
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className='text-7xl text-center'>{loadingText}</p>
|
||||||
|
)}
|
||||||
|
</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>
|
||||||
|
|||||||
Reference in New Issue
Block a user