You've already forked AstralRinth
forked from didirus/AstralRinth
c39bb78e38
* 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>
158 lines
4.5 KiB
Vue
158 lines
4.5 KiB
Vue
<template>
|
|
<div
|
|
class="button-base p-4 bg-bg-raised rounded-xl flex gap-3 group"
|
|
@click="
|
|
() => {
|
|
emit('open')
|
|
$router.push({
|
|
path: `/project/${project.project_id ?? project.id}`,
|
|
query: { i: props.instance ? props.instance.path : undefined },
|
|
})
|
|
}
|
|
"
|
|
>
|
|
<div class="icon">
|
|
<Avatar :src="project.icon_url" size="96px" class="search-icon" />
|
|
</div>
|
|
<div class="flex flex-col gap-2 overflow-hidden">
|
|
<div class="gap-2 overflow-hidden no-wrap text-ellipsis">
|
|
<span class="text-lg font-extrabold text-contrast m-0 leading-none">{{
|
|
project.title
|
|
}}</span>
|
|
<span v-if="project.author" class="text-secondary"> by {{ project.author }}</span>
|
|
</div>
|
|
<div class="m-0 line-clamp-2">
|
|
{{ project.description }}
|
|
</div>
|
|
<div class="mt-auto flex items-center gap-1 no-wrap">
|
|
<TagsIcon class="h-4 w-4 shrink-0" />
|
|
<div
|
|
v-for="tag in categories"
|
|
:key="tag"
|
|
class="text-sm font-semibold text-secondary flex gap-1 px-[0.375rem] py-0.5 bg-button-bg rounded-full"
|
|
>
|
|
{{ formatCategory(tag.name) }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-col gap-2 items-end shrink-0 ml-auto">
|
|
<div class="flex items-center gap-2">
|
|
<DownloadIcon class="shrink-0" />
|
|
<span>
|
|
{{ formatNumber(project.downloads) }}
|
|
<span class="text-secondary">downloads</span>
|
|
</span>
|
|
</div>
|
|
<div class="flex items-center gap-2">
|
|
<HeartIcon class="shrink-0" />
|
|
<span>
|
|
{{ formatNumber(project.follows ?? project.followers) }}
|
|
<span class="text-secondary">followers</span>
|
|
</span>
|
|
</div>
|
|
<div class="mt-auto relative">
|
|
<div
|
|
class="flex items-center gap-2 group-hover:-translate-y-3 group-hover:opacity-0 group-focus-within:opacity-0 group-hover:scale-95 group-focus-within:scale-95 transition-all"
|
|
>
|
|
<HistoryIcon class="shrink-0" />
|
|
<span>
|
|
<span class="text-secondary">Updated</span>
|
|
{{ dayjs(project.date_modified ?? project.updated).fromNow() }}
|
|
</span>
|
|
</div>
|
|
<div
|
|
class="opacity-0 scale-95 translate-y-3 group-hover:translate-y-0 group-hover:scale-100 group-hover:opacity-100 group-focus-within:opacity-100 group-focus-within:scale-100 absolute bottom-0 right-0 transition-all w-fit"
|
|
>
|
|
<ButtonStyled color="brand">
|
|
<button
|
|
:disabled="installed || installing"
|
|
class="shrink-0 no-wrap"
|
|
@click.stop="install()"
|
|
>
|
|
<template v-if="!installed">
|
|
<DownloadIcon v-if="modpack || instance" />
|
|
<PlusIcon v-else />
|
|
</template>
|
|
<CheckIcon v-else />
|
|
{{
|
|
installing
|
|
? 'Installing'
|
|
: installed
|
|
? 'Installed'
|
|
: modpack || instance
|
|
? 'Install'
|
|
: 'Add to an instance'
|
|
}}
|
|
</button>
|
|
</ButtonStyled>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {
|
|
TagsIcon,
|
|
DownloadIcon,
|
|
HeartIcon,
|
|
PlusIcon,
|
|
CheckIcon,
|
|
HistoryIcon,
|
|
} from '@modrinth/assets'
|
|
import { ButtonStyled, Avatar } from '@modrinth/ui'
|
|
import { formatNumber, formatCategory } from '@modrinth/utils'
|
|
import dayjs from 'dayjs'
|
|
import relativeTime from 'dayjs/plugin/relativeTime'
|
|
import { ref, computed } from 'vue'
|
|
import { install as installVersion } from '@/store/install.js'
|
|
dayjs.extend(relativeTime)
|
|
|
|
const props = defineProps({
|
|
backgroundImage: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
project: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
categories: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
instance: {
|
|
type: Object,
|
|
default: null,
|
|
},
|
|
featured: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
installed: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
})
|
|
|
|
const emit = defineEmits(['open', 'install'])
|
|
|
|
const installing = ref(false)
|
|
|
|
async function install() {
|
|
installing.value = true
|
|
await installVersion(
|
|
props.project.project_id,
|
|
null,
|
|
props.instance ? props.instance.path : null,
|
|
'SearchCard',
|
|
() => {
|
|
installing.value = false
|
|
emit('install', props.project.project_id)
|
|
},
|
|
)
|
|
}
|
|
|
|
const modpack = computed(() => props.project.project_type === 'modpack')
|
|
</script>
|