diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue
index 0fbc724f6e..dbdc2a35dc 100644
--- a/apps/app-frontend/src/App.vue
+++ b/apps/app-frontend/src/App.vue
@@ -31,6 +31,7 @@ import {
Button,
ButtonStyled,
commonMessages,
+ CreationFlowModal,
defineMessages,
I18nDebugPanel,
NewsArticleCard,
@@ -65,7 +66,6 @@ import FriendsList from '@/components/ui/friends/FriendsList.vue'
import IncompatibilityWarningModal from '@/components/ui/install_flow/IncompatibilityWarningModal.vue'
import InstallConfirmModal from '@/components/ui/install_flow/InstallConfirmModal.vue'
import ModInstallModal from '@/components/ui/install_flow/ModInstallModal.vue'
-import InstanceCreationModal from '@/components/ui/InstanceCreationModal.vue'
import AppSettingsModal from '@/components/ui/modal/AppSettingsModal.vue'
import AuthGrantFlowWaitModal from '@/components/ui/modal/AuthGrantFlowWaitModal.vue'
import NavButton from '@/components/ui/NavButton.vue'
@@ -84,6 +84,7 @@ import { get_user } from '@/helpers/cache.js'
import { command_listener, warning_listener } from '@/helpers/events.js'
import { useFetch } from '@/helpers/fetch.js'
import { cancelLogin, get as getCreds, login, logout } from '@/helpers/mr_auth.ts'
+import { create_profile_and_install_from_file } from '@/helpers/pack'
import { list } from '@/helpers/profile.js'
import { get as getSettings, set as setSettings } from '@/helpers/settings.ts'
import { get_opening_command, initialize_state } from '@/helpers/state'
@@ -100,11 +101,11 @@ import {
provideAppUpdateDownloadProgress,
subscribeToDownloadProgress,
} from '@/providers/download-progress.ts'
+import { setupProviders } from '@/providers/setup'
import { useError } from '@/store/error.js'
import { useInstall } from '@/store/install.js'
import { useLoading, useTheming } from '@/store/state'
-import { create_profile_and_install_from_file } from './helpers/pack'
import { generateSkinPreviews } from './helpers/rendering/batch-skin-renderer'
import { get_available_capes, get_available_skins } from './helpers/skins'
import { AppNotificationManager } from './providers/app-notifications'
@@ -134,6 +135,10 @@ provideModalBehavior({
onShow: () => hide_ads_window(),
onHide: () => show_ads_window(),
})
+
+const { installationModal, handleCreate, handleBrowseModpacks } =
+ setupProviders(notificationManager)
+
const news = ref([])
const availableSurvey = ref(false)
@@ -804,9 +809,13 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
Name
- diff --git a/apps/app-frontend/src/helpers/pack.js b/apps/app-frontend/src/helpers/pack.js deleted file mode 100644 index 312dfc62aa..0000000000 --- a/apps/app-frontend/src/helpers/pack.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * All theseus API calls return serialized values (both return values and errors); - * So, for example, addDefaultInstance creates a blank Profile object, where the Rust struct is serialized, - * and deserialized into a usable JS object. - */ -import { invoke } from '@tauri-apps/api/core' - -import { create } from './profile' - -// Installs pack from a version ID -export async function create_profile_and_install( - projectId, - versionId, - packTitle, - iconUrl, - createInstanceCallback = () => {}, -) { - const location = { - type: 'fromVersionId', - project_id: projectId, - version_id: versionId, - title: packTitle, - icon_url: iconUrl, - } - const profile_creator = await invoke('plugin:pack|pack_get_profile_from_pack', { location }) - const profile = await create( - profile_creator.name, - profile_creator.gameVersion, - profile_creator.modloader, - profile_creator.loaderVersion, - null, - true, - ) - createInstanceCallback(profile) - - return await invoke('plugin:pack|pack_install', { location, profile }) -} - -export async function install_to_existing_profile(projectId, versionId, title, profilePath) { - const location = { - type: 'fromVersionId', - project_id: projectId, - version_id: versionId, - title, - } - return await invoke('plugin:pack|pack_install', { location, profile: profilePath }) -} - -// Installs pack from a path -export async function create_profile_and_install_from_file(path) { - const location = { - type: 'fromFile', - path: path, - } - const profile_creator = await invoke('plugin:pack|pack_get_profile_from_pack', { location }) - const profile = await create( - profile_creator.name, - profile_creator.gameVersion, - profile_creator.modloader, - profile_creator.loaderVersion, - null, - true, - ) - return await invoke('plugin:pack|pack_install', { location, profile }) -} diff --git a/apps/app-frontend/src/helpers/pack.ts b/apps/app-frontend/src/helpers/pack.ts new file mode 100644 index 0000000000..ae1131a3f8 --- /dev/null +++ b/apps/app-frontend/src/helpers/pack.ts @@ -0,0 +1,90 @@ +import { invoke } from '@tauri-apps/api/core' + +import { create } from './profile' +import type { InstanceLoader } from './types' + +interface PackProfileCreator { + name: string + gameVersion: string + modloader: InstanceLoader + loaderVersion: string | null +} + +interface PackLocationVersionId { + type: 'fromVersionId' + project_id: string + version_id: string + title: string + icon_url?: string +} + +interface PackLocationFile { + type: 'fromFile' + path: string +} + +export async function create_profile_and_install( + projectId: string, + versionId: string, + packTitle: string, + iconUrl?: string, + createInstanceCallback: (profile: string) => void = () => {}, +): PromiseSomething went wrong while loading your modpack.
++ {{ versionsError || currentVersionError }} +
+