From 03ec5a220a947092062c1e10568fe26e9ced1a1d Mon Sep 17 00:00:00 2001
From: Lncvrt
Date: Tue, 10 Feb 2026 14:58:53 -0700
Subject: [PATCH] Use system popup for revision update warning
---
src/app/componets/VersionUpdateWarning.tsx | 105 ---------------------
src/app/game/page.tsx | 69 ++++++++++++--
src/app/layout.tsx | 9 --
3 files changed, 63 insertions(+), 120 deletions(-)
delete mode 100644 src/app/componets/VersionUpdateWarning.tsx
diff --git a/src/app/componets/VersionUpdateWarning.tsx b/src/app/componets/VersionUpdateWarning.tsx
deleted file mode 100644
index edd8889..0000000
--- a/src/app/componets/VersionUpdateWarning.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-'use client'
-
-import { invoke } from '@tauri-apps/api/core'
-import { useGlobal } from '../GlobalProvider'
-import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs'
-import { writeVersionsConfig } from '../util/BazookaManager'
-import { useState } from 'react'
-
-export default function VersionUpdateWarning () {
- const [confirmed, setConfirmed] = useState<-1 | 0>(-1)
-
- const {
- managingVersion,
- setDownloadedVersionsConfig,
- setManagingVersion,
- setPopupMode,
- setSelectedVersionList,
- downloadVersions
- } = useGlobal()
- if (!managingVersion) return Error
-
- return (
- <>
- Warning!
-
-
- Before proceeding, please note that any modifications to the
- installation directory (NOT THE SAVE DATA) will be completely
- wiped/reset.
-
-
- If you do not want your installation directory wiped just yet, please
- backup the files to another directory. When you click update, it will
- be wiped.
-
-
- Updating will have the same effect as clicking the uninstall button
- then installing again.
-
-
Revisions are not a frequent thing and rarely ever happen.
-
-
- invoke('open_folder', {
- name: managingVersion
- })
- }
- title="Click to browse the game's files."
- >
- Open Folder / Installation directory
-
- {
- if (confirmed == -1) {
- setConfirmed(0)
- return
- }
-
- //change popup to downloads
- setManagingVersion(null)
- setPopupMode(1)
-
- //uninstall
- setDownloadedVersionsConfig(prev => {
- if (!prev) return prev
- const updatedList = Object.fromEntries(
- Object.entries(prev.list).filter(
- ([k]) => k !== managingVersion
- )
- )
- const updatedConfig = {
- ...prev,
- list: updatedList
- }
- writeVersionsConfig(updatedConfig)
- return updatedConfig
- })
-
- if (
- await exists('game/' + managingVersion, {
- baseDir: BaseDirectory.AppLocalData
- })
- )
- await remove('game/' + managingVersion, {
- baseDir: BaseDirectory.AppLocalData,
- recursive: true
- })
-
- //reinstall
- setSelectedVersionList([managingVersion])
- downloadVersions([managingVersion])
- }}
- title='Click to update the game'
- >
-
- {confirmed == -1 ? 'Update' : 'Are you sure?'}
-
-
-
-
- >
- )
-}
diff --git a/src/app/game/page.tsx b/src/app/game/page.tsx
index f88cebd..72de0af 100644
--- a/src/app/game/page.tsx
+++ b/src/app/game/page.tsx
@@ -8,6 +8,9 @@ import { useSearchParams } from 'next/navigation'
import { platform } from '@tauri-apps/plugin-os'
import { faWarning } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
+import { ask } from '@tauri-apps/plugin-dialog'
+import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs'
+import { writeVersionsConfig } from '../util/BazookaManager'
export default function Installs () {
const {
@@ -24,7 +27,9 @@ export default function Installs () {
setSelectedGame,
serverVersionList,
category,
- setCategory
+ setCategory,
+ setDownloadedVersionsConfig,
+ downloadVersions
} = useGlobal()
const params = useSearchParams()
@@ -390,12 +395,64 @@ export default function Installs () {
{
+ onClick={async e => {
e.stopPropagation()
- setManagingVersion(entry)
- setPopupMode(5)
- setShowPopup(true)
- setFadeOut(false)
+ const answer = await ask(
+ 'Before proceeding, if you do not want your installation directory wiped just yet, please backup the files to another directory. When you click "Yes", it will be wiped. Click "No" if you want to open the installation folder instead.',
+ {
+ title: 'Revision Update',
+ kind: 'warning'
+ }
+ )
+ if (answer) {
+ const answer2 = await ask(
+ 'Are you sure you want to update? If you did not read the last popup, please go back and read it.',
+ {
+ title: 'Revision Update',
+ kind: 'warning'
+ }
+ )
+ if (!answer2) return
+
+ //open downloads popup
+ setPopupMode(1)
+ setShowPopup(true)
+ setFadeOut(false)
+
+ //uninstall
+ setDownloadedVersionsConfig(prev => {
+ if (!prev) return prev
+ const updatedList = Object.fromEntries(
+ Object.entries(prev.list).filter(
+ ([k]) => k !== entry
+ )
+ )
+ const updatedConfig = {
+ ...prev,
+ list: updatedList
+ }
+ writeVersionsConfig(updatedConfig)
+ return updatedConfig
+ })
+
+ if (
+ await exists('game/' + entry, {
+ baseDir: BaseDirectory.AppLocalData
+ })
+ )
+ await remove('game/' + entry, {
+ baseDir: BaseDirectory.AppLocalData,
+ recursive: true
+ })
+
+ //reinstall
+ setSelectedVersionList([entry])
+ downloadVersions([entry])
+ } else {
+ invoke('open_folder', {
+ name: entry
+ })
+ }
}}
hidden={
!needsRevisionUpdate(
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index a77a2b1..80f52b5 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -46,7 +46,6 @@ import {
} from '@tauri-apps/plugin-notification'
import VersionChangelog from './componets/VersionChangelog'
import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs'
-import VersionUpdateWarning from './componets/VersionUpdateWarning'
const roboto = Roboto({
subsets: ['latin']
@@ -897,14 +896,6 @@ export default function RootLayout ({
No version selected
)
- ) : popupMode === 5 ? (
- managingVersion && downloadedVersionsConfig ? (
-
- ) : (
-
- No version selected
-
- )
) : null}
{popupMode == 0 &&
selectedGame &&