From f1dee718da95836ffa5c0985c9e8f5643e0f3f6f Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Sun, 22 Dec 2024 23:55:52 +0100 Subject: dev: Replace with sample Tauri 2.0 project as a first step to convert FlightCore to Tauri 2.0 --- src-vue/src/utils/GameInstall.ts | 5 --- src-vue/src/utils/NorthstarState.ts | 8 ----- src-vue/src/utils/ReleaseCanal.ts | 4 --- src-vue/src/utils/SortOptions.d.ts | 8 ----- src-vue/src/utils/Tabs.ts | 8 ----- src-vue/src/utils/filter.ts | 26 --------------- .../utils/thunderstore/ThunderstoreModStatus.ts | 7 ---- src-vue/src/utils/thunderstore/version.ts | 33 ------------------ src-vue/src/utils/ui.ts | 39 ---------------------- 9 files changed, 138 deletions(-) delete mode 100644 src-vue/src/utils/GameInstall.ts delete mode 100644 src-vue/src/utils/NorthstarState.ts delete mode 100644 src-vue/src/utils/ReleaseCanal.ts delete mode 100644 src-vue/src/utils/SortOptions.d.ts delete mode 100644 src-vue/src/utils/Tabs.ts delete mode 100644 src-vue/src/utils/filter.ts delete mode 100644 src-vue/src/utils/thunderstore/ThunderstoreModStatus.ts delete mode 100644 src-vue/src/utils/thunderstore/version.ts delete mode 100644 src-vue/src/utils/ui.ts (limited to 'src-vue/src/utils') diff --git a/src-vue/src/utils/GameInstall.ts b/src-vue/src/utils/GameInstall.ts deleted file mode 100644 index 162d2860..00000000 --- a/src-vue/src/utils/GameInstall.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface GameInstall { - game_path: string; - profile: string, - install_type: string; -} diff --git a/src-vue/src/utils/NorthstarState.ts b/src-vue/src/utils/NorthstarState.ts deleted file mode 100644 index 2c8756b1..00000000 --- a/src-vue/src/utils/NorthstarState.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum NorthstarState { - GAME_NOT_FOUND = "GAME_NOT_FOUND", - INSTALL = "INSTALL", - INSTALLING = "INSTALLING", - MUST_UPDATE = "MUST_UPDATE", - UPDATING = "UPDATING", - READY_TO_PLAY = "READY_TO_PLAY" -} \ No newline at end of file diff --git a/src-vue/src/utils/ReleaseCanal.ts b/src-vue/src/utils/ReleaseCanal.ts deleted file mode 100644 index 9363aa25..00000000 --- a/src-vue/src/utils/ReleaseCanal.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ReleaseCanal { - RELEASE = 'Northstar', - RELEASE_CANDIDATE = 'NorthstarReleaseCandidate' -} diff --git a/src-vue/src/utils/SortOptions.d.ts b/src-vue/src/utils/SortOptions.d.ts deleted file mode 100644 index b6f180d2..00000000 --- a/src-vue/src/utils/SortOptions.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum SortOptions { - NAME_ASC = 'name_asc', - NAME_DESC = 'name_desc', - DATE_ASC = 'date_asc', - DATE_DESC = 'date_desc', - MOST_DOWNLOADED = 'most_downloaded', - TOP_RATED = 'top_rated' -} diff --git a/src-vue/src/utils/Tabs.ts b/src-vue/src/utils/Tabs.ts deleted file mode 100644 index 5d31379c..00000000 --- a/src-vue/src/utils/Tabs.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum Tabs { - PLAY = '/', - CHANGELOG = '/changelog', - SETTINGS = '/settings', - DEV = '/dev', - MODS = '/mods', - REPAIR = '/repair', -} diff --git a/src-vue/src/utils/filter.ts b/src-vue/src/utils/filter.ts deleted file mode 100644 index b85b9623..00000000 --- a/src-vue/src/utils/filter.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Implements a fuzzy filter - * Iterates through chars of `search_term` and checks if each char exists in consecutive order in `text`. - * For example, this means that `text="Gecko"` and `search_term="geo"` will return `true` - * but using `text="Gecko"` and `search_term="goe"` will return `false` - * - * Implements a subset of "fuzzy string searching" - * https://en.wikipedia.org/wiki/Approximate_string_matching - */ -function fuzzy_filter(text: string, search_term: string): boolean { - const lowercase_text = text.toLowerCase(); - const lowercase_search_term = search_term.toLowerCase(); - - let previousIndex = -1; - for (let i = 0; i < lowercase_search_term.length; i++) { - const char = lowercase_search_term[i]; - const currentIndex = lowercase_text.indexOf(char, previousIndex + 1); - if (currentIndex === -1) { - return false; - } - previousIndex = currentIndex; - } - - return true; -} -export { fuzzy_filter }; diff --git a/src-vue/src/utils/thunderstore/ThunderstoreModStatus.ts b/src-vue/src/utils/thunderstore/ThunderstoreModStatus.ts deleted file mode 100644 index f2351226..00000000 --- a/src-vue/src/utils/thunderstore/ThunderstoreModStatus.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum ThunderstoreModStatus { - INSTALLED, - BEING_INSTALLED, - BEING_UPDATED, - NOT_INSTALLED, - OUTDATED -} diff --git a/src-vue/src/utils/thunderstore/version.ts b/src-vue/src/utils/thunderstore/version.ts deleted file mode 100644 index a111e08c..00000000 --- a/src-vue/src/utils/thunderstore/version.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {ThunderstoreMod} from "../../../../src-tauri/bindings/ThunderstoreMod"; -import {NorthstarMod} from "../../../../src-tauri/bindings/NorthstarMod"; -import {store} from "../../plugins/store"; - -/** - * Strips off a Thunderstore dependency string from its version - * (e.g. "taskinoz-WallrunningTitans-1.0.0" to - * "taskinoz-WallrunningTitans"). - **/ -function getThunderstoreDependencyStringPrefix(dependency: string): string { - const dependencyStringMembers = dependency.split('-'); - return `${dependencyStringMembers[0]}-${dependencyStringMembers[1]}`; -} - -function isThunderstoreModOutdated(mod: ThunderstoreMod): boolean { - // Ensure mod is up-to-date. - const tsModPrefix = getThunderstoreDependencyStringPrefix(mod.versions[0].full_name); - const matchingMods: NorthstarMod[] = store.state.installed_mods.filter((mod: NorthstarMod) => { - if (!mod.thunderstore_mod_string) return false; - return getThunderstoreDependencyStringPrefix(mod.thunderstore_mod_string!) === tsModPrefix; - }); - if (matchingMods.length !== 0) { - // There shouldn't be several mods with same dependency string, but we never know... - const matchingMod = matchingMods[0]; - // A mod is outdated if its dependency strings differs from Thunderstore dependency string - // (no need for semver check here). - // This assumes mod versions list is sorted from newest to oldest version. - return matchingMod.thunderstore_mod_string !== mod.versions[0].full_name; - } - return false; -} - -export { isThunderstoreModOutdated }; diff --git a/src-vue/src/utils/ui.ts b/src-vue/src/utils/ui.ts deleted file mode 100644 index f5183bcc..00000000 --- a/src-vue/src/utils/ui.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { ElNotification, NotificationHandle } from "element-plus"; -import { appWindow, UserAttentionType } from '@tauri-apps/api/window'; -import { i18n } from "../main"; -import { store } from "../plugins/store"; - -/** - * Displays content to the user in the form of a notification appearing on screen bottom right. - * If the app is not focused when this is invoked, a notification is added to the notifications menu. - **/ -function showNotification( - title: string, - message: string = '', - type: 'success' | 'warning' | 'error' | 'info' = 'success', - duration: number = 4500 -): NotificationHandle { - if (!document.hasFocus()) { - const date = new Date(); - const titleWithDate = `${title} (${i18n.global.tc('notification.date_prefix')} ${('0' + date.getHours()).slice(-2)}:${('0' + date.getMinutes()).slice(-2)})`; - store.commit('addNotification', {title: titleWithDate, text: message, type}); - appWindow.requestUserAttention(UserAttentionType.Informational); - } - - return ElNotification({ - title, message, type, duration, - position: 'bottom-right', - }); -} - -/** - * Helper method displaying an error message to the user. - **/ -function showErrorNotification( - error: string, - title: string = i18n.global.tc('generic.error') -): NotificationHandle { - return showNotification(title, error, 'error'); -} - -export {showNotification, showErrorNotification}; -- cgit v1.2.3