Get some async functions to be awaited, and also use different failed to load screen

This commit is contained in:
Lncvrt committed 2026-05-10 07:54:38 -07:00
1 parent 36b9f6bb55
commit 7103d0e3a1
8 files changed
+31 -24

No files matched your search

+1 -1
View File
@@ -235,7 +235,7 @@ function AccountChangePassword ({
e.preventDefault() e.preventDefault()
if (newPassword !== retypeNewPassword) { if (newPassword !== retypeNewPassword) {
message('Passwords must match', { await message('Passwords must match', {
title: "Passwords don't match!", title: "Passwords don't match!",
kind: 'error' kind: 'error'
}) })
+1 -1
View File
@@ -316,7 +316,7 @@ export default function Installs () {
)) && )) &&
!downloadProgress.find(d => d.version == v) !downloadProgress.find(d => d.version == v)
) { ) {
downloadVersions([ await downloadVersions([
{ {
id: v, id: v,
type: 1 type: 1
+15 -8
View File
@@ -34,7 +34,7 @@ import { faChevronLeft, faXmark } from '@fortawesome/free-solid-svg-icons'
import { invoke } from '@tauri-apps/api/core' import { invoke } from '@tauri-apps/api/core'
import semver from 'semver' import semver from 'semver'
import { exit } from '@tauri-apps/plugin-process' import { exit } from '@tauri-apps/plugin-process'
import { ask } from '@tauri-apps/plugin-dialog' import { ask, message } from '@tauri-apps/plugin-dialog'
import VersionsDownloadPopup from '@/popups/VersionsDownload' import VersionsDownloadPopup from '@/popups/VersionsDownload'
import GamesDownloadPopup from '@/popups/GamesDownload' import GamesDownloadPopup from '@/popups/GamesDownload'
@@ -54,7 +54,6 @@ export default function RootLayout ({
children: React.ReactNode children: React.ReactNode
}) { }) {
const [loading, setLoading] = useState(true) const [loading, setLoading] = useState(true)
const [loadingText, setLoadingText] = useState('Loading...')
const [version, setVersion] = useState<string | null>(null) const [version, setVersion] = useState<string | null>(null)
const [platformName, setPlatformName] = useState<string | null>(null) const [platformName, setPlatformName] = useState<string | null>(null)
const [movingData, setMovingData] = useState(false) const [movingData, setMovingData] = useState(false)
@@ -441,18 +440,18 @@ export default function RootLayout ({
//reinstall //reinstall
setSelectedVersionList([versionInfo.id]) setSelectedVersionList([versionInfo.id])
downloadVersions([ await downloadVersions([
{ {
id: versionInfo.id, id: versionInfo.id,
type: 0 type: 0
} }
]) ])
} else { } else {
openFolder(versionInfo.id) await openFolder(versionInfo.id)
} }
return return
} }
invoke('launch_game', { await invoke('launch_game', {
name: versionInfo.id, name: versionInfo.id,
executable: versionInfo.executable, executable: versionInfo.executable,
displayName: versionInfo.displayName, displayName: versionInfo.displayName,
@@ -728,11 +727,19 @@ export default function RootLayout ({
if (await verifySignature(JSON.stringify(data), signature)) { if (await verifySignature(JSON.stringify(data), signature)) {
setServerVersionList(data) setServerVersionList(data)
} else { } else {
setLoadingText('Failed to download versions list.') await message(
'Failed to get version manifest, please try again later.',
{ title: 'Error fetching launcher manifest', kind: 'error' }
)
await exit(1)
return return
} }
} catch { } catch {
setLoadingText('Failed to download versions list.') await message(
'Failed to get version manifest, please try again later.',
{ title: 'Error fetching launcher manifest', kind: 'error' }
)
await exit(1)
return return
} }
@@ -846,7 +853,7 @@ export default function RootLayout ({
: 'h-screen' : 'h-screen'
} flex items-center justify-center`} } flex items-center justify-center`}
> >
<p className='text-7xl text-center'>{loadingText}</p> <p className='text-7xl text-center'>Loading...</p>
</div> </div>
</> </>
) : ( ) : (
+1 -1
View File
@@ -269,7 +269,7 @@ export default function Settings () {
} }
} }
message( await message(
'Removed the following game items: ' + 'Removed the following game items: ' +
(removed.length == 0 ? '(none)' : removed.join(', ')), (removed.length == 0 ? '(none)' : removed.join(', ')),
{ title: 'Sucessfully cleaned games folder', kind: 'info' } { title: 'Sucessfully cleaned games folder', kind: 'info' }
+6 -6
View File
@@ -58,12 +58,12 @@ export default function Sidebar () {
{platform() == 'macos' && ( {platform() == 'macos' && (
<div <div
className='macos-drag' className='macos-drag'
onMouseDown={e => { onMouseDown={async e => {
if (e.buttons === 1) { if (e.buttons === 1) {
if (e.detail === 2) { if (e.detail === 2) {
getCurrentWindow().toggleMaximize() await getCurrentWindow().toggleMaximize()
} else { } else {
getCurrentWindow().startDragging() await getCurrentWindow().startDragging()
} }
} }
}} }}
@@ -75,13 +75,13 @@ export default function Sidebar () {
(platform() == 'windows' ? 'pl-1 pt-1' : 'pl-2 pt-2') + (platform() == 'windows' ? 'pl-1 pt-1' : 'pl-2 pt-2') +
(platform() == 'macos' ? ' mt-6' : '') (platform() == 'macos' ? ' mt-6' : '')
} }
onMouseDown={e => { onMouseDown={async e => {
if (platform() != 'macos') return if (platform() != 'macos') return
if (e.buttons === 1) { if (e.buttons === 1) {
if (e.detail === 2) { if (e.detail === 2) {
getCurrentWindow().toggleMaximize() await getCurrentWindow().toggleMaximize()
} else { } else {
getCurrentWindow().startDragging() await getCurrentWindow().startDragging()
} }
} }
}} }}
+1 -1
View File
@@ -195,7 +195,7 @@ export default function ManageVersionPopup () {
//reinstall //reinstall
setSelectedVersionList([managingVersion]) setSelectedVersionList([managingVersion])
downloadVersions([ await downloadVersions([
{ {
id: managingVersion, id: managingVersion,
type: 0 type: 0
+4 -4
View File
@@ -243,7 +243,7 @@ export default function ModDownloadsPopup () {
) )
) )
downloadVersions([ await downloadVersions([
{ {
id: managingVersion, id: managingVersion,
type: 2, type: 2,
@@ -350,8 +350,8 @@ export default function ModDownloadsPopup () {
) : ( ) : (
<button <button
className='button btntheme2 w-fit' className='button btntheme2 w-fit'
onClick={() => { onClick={async () =>
downloadVersions([ await downloadVersions([
{ {
id: managingVersion, id: managingVersion,
type: 2, type: 2,
@@ -361,7 +361,7 @@ export default function ModDownloadsPopup () {
modVersion: showModInfo.latestVersion modVersion: showModInfo.latestVersion
} }
]) ])
}} }
disabled={downloadProgress.length != 0} disabled={downloadProgress.length != 0}
> >
<FontAwesomeIcon <FontAwesomeIcon
+2 -2
View File
@@ -88,8 +88,8 @@ export default function VersionsDownloadPopup () {
<div className='flex justify-center'> <div className='flex justify-center'>
<button <button
className='button btntheme1 w-fit mt-2 -mb-4' className='button btntheme1 w-fit mt-2 -mb-4'
onClick={() => { onClick={async () => {
downloadVersions( await downloadVersions(
selectedVersionList.map(versionId => ({ selectedVersionList.map(versionId => ({
id: versionId, id: versionId,
type: 0 type: 0