diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-12-22 23:55:52 +0100 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-12-22 23:55:52 +0100 |
commit | f1dee718da95836ffa5c0985c9e8f5643e0f3f6f (patch) | |
tree | 24967a28bcae1fc1e5b08da9f58bcc678ed52937 /src-vue/src/plugins/modules | |
parent | cc5ae684221d3165479d7a68556a2bb6fa81cf3a (diff) | |
download | FlightCore-f1dee718da95836ffa5c0985c9e8f5643e0f3f6f.tar.gz FlightCore-f1dee718da95836ffa5c0985c9e8f5643e0f3f6f.zip |
dev: Replace with sample Tauri 2.0 project
as a first step to convert FlightCore to Tauri 2.0
Diffstat (limited to 'src-vue/src/plugins/modules')
-rw-r--r-- | src-vue/src/plugins/modules/notifications.ts | 31 | ||||
-rw-r--r-- | src-vue/src/plugins/modules/pull_requests.ts | 94 | ||||
-rw-r--r-- | src-vue/src/plugins/modules/search.ts | 20 |
3 files changed, 0 insertions, 145 deletions
diff --git a/src-vue/src/plugins/modules/notifications.ts b/src-vue/src/plugins/modules/notifications.ts deleted file mode 100644 index ed57f8af..00000000 --- a/src-vue/src/plugins/modules/notifications.ts +++ /dev/null @@ -1,31 +0,0 @@ -type NotificationType = 'success' | 'warning' | 'info' | 'error'; - -export interface Notification { - title: string; - text: string; - type: NotificationType; -} - -interface NotificationsStoreState { - notifications: Notification[]; -} - - -/** - * This notification module is meant to host the list of notifications that have been fired while the application was - * not focused. - * This list is then used by the [NotificationButton] component to display notifications to user. - **/ -export const notificationsModule = { - state: () => ({ - notifications: [] - }) as NotificationsStoreState, - mutations: { - addNotification(state: NotificationsStoreState, payload: Notification) { - state.notifications.push(payload); - }, - removeNotification(state: NotificationsStoreState, index: number): void { - state.notifications.splice(index, 1); - } - } - } diff --git a/src-vue/src/plugins/modules/pull_requests.ts b/src-vue/src/plugins/modules/pull_requests.ts deleted file mode 100644 index 4caec0b0..00000000 --- a/src-vue/src/plugins/modules/pull_requests.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { invoke, shell } from "@tauri-apps/api"; -import { PullsApiResponseElement } from "../../../../src-tauri/bindings/PullsApiResponseElement"; -import { PullRequestType } from '../../../../src-tauri/bindings/PullRequestType'; -import { store } from "../store"; -import { showErrorNotification, showNotification } from "../../utils/ui"; - -interface PullRequestStoreState { - searchValue: string, - pull_requests_launcher: PullsApiResponseElement[], - pull_requests_mods: PullsApiResponseElement[], -} - -export const pullRequestModule = { - state: () => ({ - pull_requests_launcher: [], - pull_requests_mods: [], - }), - mutations: { - async getPullRequests(state: PullRequestStoreState, pull_request_type: PullRequestType) { - await invoke<PullsApiResponseElement[]>("get_pull_requests_wrapper", { installType: pull_request_type }) - .then((message) => { - switch (pull_request_type) { - case "Mods": - state.pull_requests_mods = message; - break; - - case "Launcher": - state.pull_requests_launcher = message; - break; - - default: - console.error("We should never end up here"); - } - }) - .catch((error) => { - showErrorNotification(error); - }); - }, - async downloadLauncherPR(state: PullRequestStoreState, pull_request: PullsApiResponseElement) { - await invoke<string>("get_launcher_download_link", { commitSha: pull_request.head.sha }) - .then((url) => { - // Open URL in default HTTPS handler (i.e. default browser) - shell.open(url); - }) - .catch((error) => { - showErrorNotification(error); - }); - }, - async downloadModsPR(state: PullRequestStoreState, pull_request: PullsApiResponseElement) { - let url = `https://github.com/${pull_request.head.repo.full_name}/archive/refs/heads/${pull_request.head.ref}.zip` - shell.open(url); - }, - async installLauncherPR(state: PullRequestStoreState, pull_request: PullsApiResponseElement) { - // Send notification telling the user to wait for the process to finish - const notification = showNotification(`Installing launcher PR ${pull_request.number}`, 'Please wait', 'info', 0); - - await invoke("apply_launcher_pr", { pullRequest: pull_request, gameInstall: store.state.game_install }) - .then((message) => { - console.log(message); - // Show user notification if mod install completed. - showNotification(`Done`, `Installed ${pull_request.number}: "${pull_request.title}"`); - }) - .catch((error) => { - showErrorNotification(error); - }) - .finally(() => { - // Clear old notification - notification.close(); - }); - }, - async installModsPR(state: PullRequestStoreState, pull_request: PullsApiResponseElement) { - // Send notification telling the user to wait for the process to finish - const notification = showNotification(`Installing mods PR ${pull_request.number}`, 'Please wait', 'info', 0); - - await invoke("apply_mods_pr", { pullRequest: pull_request, gameInstall: store.state.game_install }) - .then((message) => { - // Show user notification if mod install completed. - showNotification( - `Done`, - `Installed ${pull_request.number}: "${pull_request.title}"\nMake sure to launch via batch file or by specifying correct profile!`, - 'success', - 7000 - ); - }) - .catch((error) => { - showErrorNotification(error); - }) - .finally(() => { - // Clear old notification - notification.close(); - }); - }, - } -} diff --git a/src-vue/src/plugins/modules/search.ts b/src-vue/src/plugins/modules/search.ts deleted file mode 100644 index 9614b0be..00000000 --- a/src-vue/src/plugins/modules/search.ts +++ /dev/null @@ -1,20 +0,0 @@ -interface SearchStoreState { - searchValue: string -} - -export const searchModule = { - state: () => ({ - // This is the treated value of search input - searchValue: '', - // Selected mod categories - selectedCategories: [], - showDeprecatedMods: false, - showNsfwMods: false, - sortValue: {label: '', value: ''} - }), - getters: { - searchWords(state: SearchStoreState): string { - return state.searchValue.toLowerCase(); - } - } - } |