From 7ccf10b52c116b3edee3354921c331e91c8476b6 Mon Sep 17 00:00:00 2001 From: CodexAdrian <83074853+CodexAdrian@users.noreply.github.com> Date: Wed, 19 Apr 2023 01:34:00 -0400 Subject: [PATCH 01/24] Base impl --- .../src/assets/stylesheets/global.scss | 1 + .../components/ui/InstanceInstallModal.vue | 95 +++++++++++++++++++ theseus_gui/src/helpers/profile.js | 4 +- theseus_gui/src/pages/Browse.vue | 92 +++++++++++++++--- theseus_gui/src/pages/Library.vue | 2 +- theseus_gui/src/pages/instance/Index.vue | 2 +- theseus_gui/src/pages/instance/Mods.vue | 12 ++- theseus_gui/src/pages/project/Index.vue | 53 +++++++++-- theseus_gui/src/store/search.js | 3 +- 9 files changed, 234 insertions(+), 30 deletions(-) create mode 100644 theseus_gui/src/components/ui/InstanceInstallModal.vue diff --git a/theseus_gui/src/assets/stylesheets/global.scss b/theseus_gui/src/assets/stylesheets/global.scss index ea9b6cc89..1d902f45c 100644 --- a/theseus_gui/src/assets/stylesheets/global.scss +++ b/theseus_gui/src/assets/stylesheets/global.scss @@ -2,6 +2,7 @@ :root { font-family: var(--font-standard); + color-scheme: dark; } * { diff --git a/theseus_gui/src/components/ui/InstanceInstallModal.vue b/theseus_gui/src/components/ui/InstanceInstallModal.vue new file mode 100644 index 000000000..8356688bf --- /dev/null +++ b/theseus_gui/src/components/ui/InstanceInstallModal.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/theseus_gui/src/helpers/profile.js b/theseus_gui/src/helpers/profile.js index 198f43e09..9d94014ab 100644 --- a/theseus_gui/src/helpers/profile.js +++ b/theseus_gui/src/helpers/profile.js @@ -44,8 +44,8 @@ export async function list() { // Add a project to a profile from a version // Returns a path to the new project file -export async function add_project_from_version(path, version_id) { - return await invoke('profile_add_project_from_version', { path, version_id }) +export async function add_project_from_version(path, versionId) { + return await invoke('profile_add_project_from_version', { path, versionId }) } // Add a project to a profile from a path + project_type diff --git a/theseus_gui/src/pages/Browse.vue b/theseus_gui/src/pages/Browse.vue index 8c324883c..2c6deab92 100644 --- a/theseus_gui/src/pages/Browse.vue +++ b/theseus_gui/src/pages/Browse.vue @@ -14,15 +14,24 @@ import { ClientIcon, ServerIcon, AnimatedLogo, + Avatar, } from 'omorphia' import Multiselect from 'vue-multiselect' import { useSearch } from '@/store/state' import { get_categories, get_loaders, get_game_versions } from '@/helpers/tags' +import { get as getProfile } from '@/helpers/profile' +import { useRoute } from 'vue-router' +import { convertFileSrc } from '@tauri-apps/api/tauri' -const searchStore = useSearch() +const route = useRoute() +const searchStore = useSearch() +searchStore.projectType = route.query.projectType ?? 'modpack' +const showVersions = ref(true) +const showLoaders = ref(true) const showSnapshots = ref(false) const loading = ref(true) +const instance = ref(null) const [categories, loaders, availableGameVersions] = await Promise.all([ get_categories(), @@ -42,6 +51,22 @@ const getSearchResults = async (shouldLoad = false) => { getSearchResults(true) +const handleReset = async () => { + searchStore.resetFilters() + await getSearchResults() +} + +if (route.query.instance) { + instance.value = await getProfile(route.query.instance) + console.log(instance.value) + searchStore.activeVersions = [instance.value.metadata.game_version] + searchStore.facets = [`categories:'${encodeURIComponent(instance.value.metadata.loader)}'`] + showVersions.value = false + showLoaders.value = false +} else { + handleReset() +} + const toggleFacet = async (facet) => { const index = searchStore.facets.indexOf(facet) @@ -66,16 +91,26 @@ const switchPage = async (page) => { else searchStore.offset = (searchStore.currentPage - 1) * searchStore.limit await getSearchResults() } - -const handleReset = async () => { - searchStore.resetFilters() - await getSearchResults() -}