Get some async functions to be awaited, and also use different failed to load screen
This commit is contained in:
8 files changed
+31
-24
No files matched your search
@@ -235,7 +235,7 @@ function AccountChangePassword ({
|
||||
e.preventDefault()
|
||||
|
||||
if (newPassword !== retypeNewPassword) {
|
||||
message('Passwords must match', {
|
||||
await message('Passwords must match', {
|
||||
title: "Passwords don't match!",
|
||||
kind: 'error'
|
||||
})
|
||||
|
||||
@@ -316,7 +316,7 @@ export default function Installs () {
|
||||
)) &&
|
||||
!downloadProgress.find(d => d.version == v)
|
||||
) {
|
||||
downloadVersions([
|
||||
await downloadVersions([
|
||||
{
|
||||
id: v,
|
||||
type: 1
|
||||
|
||||
+15
-8
@@ -34,7 +34,7 @@ import { faChevronLeft, faXmark } from '@fortawesome/free-solid-svg-icons'
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import semver from 'semver'
|
||||
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 GamesDownloadPopup from '@/popups/GamesDownload'
|
||||
@@ -54,7 +54,6 @@ export default function RootLayout ({
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [loadingText, setLoadingText] = useState('Loading...')
|
||||
const [version, setVersion] = useState<string | null>(null)
|
||||
const [platformName, setPlatformName] = useState<string | null>(null)
|
||||
const [movingData, setMovingData] = useState(false)
|
||||
@@ -441,18 +440,18 @@ export default function RootLayout ({
|
||||
|
||||
//reinstall
|
||||
setSelectedVersionList([versionInfo.id])
|
||||
downloadVersions([
|
||||
await downloadVersions([
|
||||
{
|
||||
id: versionInfo.id,
|
||||
type: 0
|
||||
}
|
||||
])
|
||||
} else {
|
||||
openFolder(versionInfo.id)
|
||||
await openFolder(versionInfo.id)
|
||||
}
|
||||
return
|
||||
}
|
||||
invoke('launch_game', {
|
||||
await invoke('launch_game', {
|
||||
name: versionInfo.id,
|
||||
executable: versionInfo.executable,
|
||||
displayName: versionInfo.displayName,
|
||||
@@ -728,11 +727,19 @@ export default function RootLayout ({
|
||||
if (await verifySignature(JSON.stringify(data), signature)) {
|
||||
setServerVersionList(data)
|
||||
} 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
|
||||
}
|
||||
} 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
|
||||
}
|
||||
|
||||
@@ -846,7 +853,7 @@ export default function RootLayout ({
|
||||
: 'h-screen'
|
||||
} flex items-center justify-center`}
|
||||
>
|
||||
<p className='text-7xl text-center'>{loadingText}</p>
|
||||
<p className='text-7xl text-center'>Loading...</p>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -269,7 +269,7 @@ export default function Settings () {
|
||||
}
|
||||
}
|
||||
|
||||
message(
|
||||
await message(
|
||||
'Removed the following game items: ' +
|
||||
(removed.length == 0 ? '(none)' : removed.join(', ')),
|
||||
{ title: 'Sucessfully cleaned games folder', kind: 'info' }
|
||||
|
||||
@@ -58,12 +58,12 @@ export default function Sidebar () {
|
||||
{platform() == 'macos' && (
|
||||
<div
|
||||
className='macos-drag'
|
||||
onMouseDown={e => {
|
||||
onMouseDown={async e => {
|
||||
if (e.buttons === 1) {
|
||||
if (e.detail === 2) {
|
||||
getCurrentWindow().toggleMaximize()
|
||||
await getCurrentWindow().toggleMaximize()
|
||||
} 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() == 'macos' ? ' mt-6' : '')
|
||||
}
|
||||
onMouseDown={e => {
|
||||
onMouseDown={async e => {
|
||||
if (platform() != 'macos') return
|
||||
if (e.buttons === 1) {
|
||||
if (e.detail === 2) {
|
||||
getCurrentWindow().toggleMaximize()
|
||||
await getCurrentWindow().toggleMaximize()
|
||||
} else {
|
||||
getCurrentWindow().startDragging()
|
||||
await getCurrentWindow().startDragging()
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -195,7 +195,7 @@ export default function ManageVersionPopup () {
|
||||
|
||||
//reinstall
|
||||
setSelectedVersionList([managingVersion])
|
||||
downloadVersions([
|
||||
await downloadVersions([
|
||||
{
|
||||
id: managingVersion,
|
||||
type: 0
|
||||
|
||||
@@ -243,7 +243,7 @@ export default function ModDownloadsPopup () {
|
||||
)
|
||||
)
|
||||
|
||||
downloadVersions([
|
||||
await downloadVersions([
|
||||
{
|
||||
id: managingVersion,
|
||||
type: 2,
|
||||
@@ -350,8 +350,8 @@ export default function ModDownloadsPopup () {
|
||||
) : (
|
||||
<button
|
||||
className='button btntheme2 w-fit'
|
||||
onClick={() => {
|
||||
downloadVersions([
|
||||
onClick={async () =>
|
||||
await downloadVersions([
|
||||
{
|
||||
id: managingVersion,
|
||||
type: 2,
|
||||
@@ -361,7 +361,7 @@ export default function ModDownloadsPopup () {
|
||||
modVersion: showModInfo.latestVersion
|
||||
}
|
||||
])
|
||||
}}
|
||||
}
|
||||
disabled={downloadProgress.length != 0}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
|
||||
@@ -88,8 +88,8 @@ export default function VersionsDownloadPopup () {
|
||||
<div className='flex justify-center'>
|
||||
<button
|
||||
className='button btntheme1 w-fit mt-2 -mb-4'
|
||||
onClick={() => {
|
||||
downloadVersions(
|
||||
onClick={async () => {
|
||||
await downloadVersions(
|
||||
selectedVersionList.map(versionId => ({
|
||||
id: versionId,
|
||||
type: 0
|
||||
|
||||
Reference in new issue
Block a user