From 2a0722d0d0ec756215e423a72da4d7be7143da4f Mon Sep 17 00:00:00 2001 From: Prospector Date: Wed, 8 Jan 2025 17:41:17 -0800 Subject: [PATCH] Remove old prop and fix error with card actions on pages with instance context --- .../src/components/ui/ProjectCardActions.vue | 53 +++++++++++-------- .../src/pages/search/[searchProjectType].vue | 1 - .../src/components/project/ProjectsList.vue | 11 ++-- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/apps/app-frontend/src/components/ui/ProjectCardActions.vue b/apps/app-frontend/src/components/ui/ProjectCardActions.vue index b03c6cce8..ebfa3100b 100644 --- a/apps/app-frontend/src/components/ui/ProjectCardActions.vue +++ b/apps/app-frontend/src/components/ui/ProjectCardActions.vue @@ -32,15 +32,10 @@ const installing = ref(false) const installed: Ref = ref(false) -checkInstallStatus() - function checkInstallStatus() { if (props.instanceContent) { - installed.value = Object.values(props.instanceContent).some((content) => { - if (content.metadata?.project_id === projectId.value) { - return true - } - }) + installed.value = Object.values(props.instanceContent) + .some((content) => content.metadata?.project_id === projectId.value) } } @@ -64,7 +59,9 @@ async function install(toInstance: boolean) { const modpack = computed(() => props.project.project_type === 'modpack') -const projectWebUrl = computed(() => `https://modrinth.com/${props.project.project_type}/${props.project.slug}`) +const projectWebUrl = computed( + () => `https://modrinth.com/${props.project.project_type}/${props.project.slug}`, +) const tooltip = defineMessages({ installing: { @@ -88,23 +85,41 @@ const messages = defineMessages({ }, }) -const projectId = computed(() => isSearchResult(props.project) ? props.project.project_id : props.project.id) +const projectId = computed(() => + isSearchResult(props.project) ? props.project.project_id : props.project.id, +) const copyText = (text: string) => { - navigator.clipboard.writeText(text); + navigator.clipboard.writeText(text) } + +checkInstallStatus()