2023-05-16 22:25:00 -04:00
|
|
|
<template>
|
2026-02-07 11:18:59 -08:00
|
|
|
<ProjectCard
|
|
|
|
|
:title="project.title"
|
|
|
|
|
:link="
|
2025-08-14 21:48:38 +01:00
|
|
|
() => {
|
|
|
|
|
emit('open')
|
|
|
|
|
$router.push({
|
|
|
|
|
path: `/project/${project.project_id ?? project.id}`,
|
|
|
|
|
query: { i: props.instance ? props.instance.path : undefined },
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
"
|
2026-02-07 11:18:59 -08:00
|
|
|
:author="{ name: project.author, link: `https://modrinth.com/user/${project.author}` }"
|
|
|
|
|
:icon-url="project.icon_url"
|
|
|
|
|
:summary="project.description"
|
|
|
|
|
:tags="project.display_categories"
|
|
|
|
|
:all-tags="project.categories"
|
|
|
|
|
:downloads="project.downloads"
|
|
|
|
|
:followers="project.follows"
|
|
|
|
|
:date-updated="project.date_modified"
|
|
|
|
|
:banner="project.featured_gallery ?? undefined"
|
|
|
|
|
:color="project.color ?? undefined"
|
|
|
|
|
:environment="
|
|
|
|
|
projectType
|
|
|
|
|
? ['mod', 'modpack'].includes(projectType)
|
|
|
|
|
? {
|
|
|
|
|
clientSide: project.client_side,
|
|
|
|
|
serverSide: project.server_side,
|
|
|
|
|
}
|
|
|
|
|
: undefined
|
|
|
|
|
: undefined
|
|
|
|
|
"
|
|
|
|
|
layout="list"
|
2025-08-14 21:48:38 +01:00
|
|
|
>
|
2026-02-07 11:18:59 -08:00
|
|
|
<template #actions>
|
|
|
|
|
<ButtonStyled color="brand" type="outlined">
|
|
|
|
|
<button
|
|
|
|
|
:disabled="installed || installing"
|
|
|
|
|
class="shrink-0 no-wrap"
|
|
|
|
|
@click.stop="install()"
|
2025-08-14 21:48:38 +01:00
|
|
|
>
|
2026-02-07 11:18:59 -08:00
|
|
|
<template v-if="!installed">
|
|
|
|
|
<DownloadIcon v-if="modpack || instance" />
|
|
|
|
|
<PlusIcon v-else />
|
2025-08-14 21:48:38 +01:00
|
|
|
</template>
|
2026-02-07 11:18:59 -08:00
|
|
|
<CheckIcon v-else />
|
|
|
|
|
{{
|
|
|
|
|
installing
|
|
|
|
|
? 'Installing'
|
|
|
|
|
: installed
|
|
|
|
|
? 'Installed'
|
|
|
|
|
: modpack || instance
|
|
|
|
|
? 'Install'
|
|
|
|
|
: 'Add to an instance'
|
|
|
|
|
}}
|
|
|
|
|
</button>
|
|
|
|
|
</ButtonStyled>
|
|
|
|
|
</template>
|
|
|
|
|
</ProjectCard>
|
2023-05-16 22:25:00 -04:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-02-07 11:18:59 -08:00
|
|
|
import { CheckIcon, DownloadIcon, PlusIcon } from '@modrinth/assets'
|
|
|
|
|
import { ButtonStyled, injectNotificationManager, ProjectCard } from '@modrinth/ui'
|
2023-05-16 22:25:00 -04:00
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
import relativeTime from 'dayjs/plugin/relativeTime'
|
2025-08-14 21:48:38 +01:00
|
|
|
import { computed, ref } from 'vue'
|
2025-05-01 16:13:13 -07:00
|
|
|
import { useRouter } from 'vue-router'
|
2025-08-14 21:48:38 +01:00
|
|
|
|
|
|
|
|
import { install as installVersion } from '@/store/install.js'
|
2023-05-16 22:25:00 -04:00
|
|
|
dayjs.extend(relativeTime)
|
|
|
|
|
|
2025-08-15 19:02:55 +01:00
|
|
|
const { handleError } = injectNotificationManager()
|
|
|
|
|
|
2025-05-01 16:13:13 -07:00
|
|
|
const router = useRouter()
|
|
|
|
|
|
2023-05-16 22:25:00 -04:00
|
|
|
const props = defineProps({
|
2025-08-14 21:48:38 +01:00
|
|
|
backgroundImage: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
|
|
|
|
project: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
instance: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
|
|
|
|
featured: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
installed: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2026-02-07 11:18:59 -08:00
|
|
|
projectType: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: undefined,
|
|
|
|
|
},
|
2023-05-16 22:25:00 -04:00
|
|
|
})
|
|
|
|
|
|
App redesign (#2946)
* Start of app redesign
* format
* continue progress
* Content page nearly done
* Fix recursion issues with content page
* Fix update all alignment
* Discover page progress
* Settings progress
* Removed unlocked-size hack that breaks web
* Revamp project page, refactor web project page to share code with app, fixed loading bar, misc UI/UX enhancements, update ko-fi logo, update arrow icons, fix web issues caused by floating-vue migration, fix tooltip issues, update web tooltips, clean up web hydration issues
* Ads + run prettier
* Begin auth refactor, move common messages to ui lib, add i18n extraction to all apps, begin Library refactor
* fix ads not hiding when plus log in
* rev lockfile changes/conflicts
* Fix sign in page
* Add generated
* (mostly) Data driven search
* Fix search mobile issue
* profile fixes
* Project versions page, fix typescript on UI lib and misc fixes
* Remove unused gallery component
* Fix linkfunction err
* Search filter controls at top, localization for locked filters
* Fix provided filter names
* Fix navigating from instance browse to main browse
* Friends frontend (#2995)
* Friends system frontend
* (almost) finish frontend
* finish friends, fix lint
* Fix lint
---------
Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
* Refresh macOS app icon
* Update web search UI more
* Fix link opens
* Fix frontend build
---------
Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2024-12-11 19:54:18 -08:00
|
|
|
const emit = defineEmits(['open', 'install'])
|
2023-08-03 11:07:35 -04:00
|
|
|
|
2023-05-16 22:25:00 -04:00
|
|
|
const installing = ref(false)
|
|
|
|
|
|
|
|
|
|
async function install() {
|
2025-08-14 21:48:38 +01:00
|
|
|
installing.value = true
|
|
|
|
|
await installVersion(
|
|
|
|
|
props.project.project_id ?? props.project.id,
|
|
|
|
|
null,
|
|
|
|
|
props.instance ? props.instance.path : null,
|
|
|
|
|
'SearchCard',
|
|
|
|
|
() => {
|
|
|
|
|
installing.value = false
|
|
|
|
|
emit('install', props.project.project_id ?? props.project.id)
|
|
|
|
|
},
|
|
|
|
|
(profile) => {
|
|
|
|
|
router.push(`/instance/${profile}`)
|
|
|
|
|
},
|
2025-08-15 19:02:55 +01:00
|
|
|
).catch(handleError)
|
2023-05-16 22:25:00 -04:00
|
|
|
}
|
|
|
|
|
|
App redesign (#2946)
* Start of app redesign
* format
* continue progress
* Content page nearly done
* Fix recursion issues with content page
* Fix update all alignment
* Discover page progress
* Settings progress
* Removed unlocked-size hack that breaks web
* Revamp project page, refactor web project page to share code with app, fixed loading bar, misc UI/UX enhancements, update ko-fi logo, update arrow icons, fix web issues caused by floating-vue migration, fix tooltip issues, update web tooltips, clean up web hydration issues
* Ads + run prettier
* Begin auth refactor, move common messages to ui lib, add i18n extraction to all apps, begin Library refactor
* fix ads not hiding when plus log in
* rev lockfile changes/conflicts
* Fix sign in page
* Add generated
* (mostly) Data driven search
* Fix search mobile issue
* profile fixes
* Project versions page, fix typescript on UI lib and misc fixes
* Remove unused gallery component
* Fix linkfunction err
* Search filter controls at top, localization for locked filters
* Fix provided filter names
* Fix navigating from instance browse to main browse
* Friends frontend (#2995)
* Friends system frontend
* (almost) finish frontend
* finish friends, fix lint
* Fix lint
---------
Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
* Refresh macOS app icon
* Update web search UI more
* Fix link opens
* Fix frontend build
---------
Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2024-12-11 19:54:18 -08:00
|
|
|
const modpack = computed(() => props.project.project_type === 'modpack')
|
|
|
|
|
</script>
|