Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | 28x 4x 1x 2x 2x 2x 2x 2x 2x 2x 6x 2x 2x 2x 28x 28x 28x 28x 28x | <template>
<div
class="card h-100 pack-card card-clickable"
role="link"
tabindex="0"
:data-pack-id="pack.id"
@click="$emit('open', pack)"
@keydown.enter="$emit('open', pack)"
>
<!-- The pack's picture, chosen by its publisher (UC-STORE-014.1) -->
<div class="pack-picture-container">
<CardPicture :picture="pack.picture" />
</div>
<div class="card-body d-flex flex-column">
<div class="d-flex justify-content-between align-items-start gap-2 mb-1">
<h2 class="h5 card-title pack-name mb-0">{{ getTranslation(pack.name) }}</h2>
<span class="badge bg-secondary pack-version">
{{ t('store.versionLabel').replace('{version}', String(pack.version)) }}
</span>
</div>
<p v-if="pack.flow.name" class="small text-muted mb-2 pack-flow">{{ pack.flow.name }}</p>
<p v-if="getTranslation(pack.description)" class="card-text small pack-description">
{{ getTranslation(pack.description) }}
</p>
<!-- On the Installed tab: the version of the flow's copies (UC-STORE-015.1) -->
<div
v-if="installedVersion !== undefined && installedVersion !== null"
class="d-flex flex-wrap align-items-center gap-2 mb-2 small"
>
<span class="text-muted pack-installed-version">
{{ t('store.installedVersion').replace('{version}', String(installedVersion)) }}
</span>
<span v-if="installedVersion < pack.version" class="badge bg-warning text-dark pack-update">
<font-awesome-icon icon="fa-solid fa-arrows-rotate" class="me-1" />
{{
t('store.updateAvailable')
.replace('{from}', String(installedVersion))
.replace('{to}', String(pack.version))
}}
</span>
</div>
<ul class="list-unstyled small text-muted mb-3 pack-entities">
<li v-for="(entity, index) in pack.entities" :key="index">
<font-awesome-icon icon="fa-solid fa-cube" class="me-1" />
{{ getTranslation(entity.name) }}
ยท
{{ t('store.fieldCount').replace('{count}', String(entity.fieldCount)) }}
</li>
</ul>
<div class="mt-auto d-flex align-items-center gap-3 small">
<button
type="button"
class="btn btn-sm pack-like"
:class="pack.likedByMe ? 'btn-danger' : 'btn-outline-secondary'"
:aria-pressed="pack.likedByMe"
:aria-label="t('store.like')"
@click.stop="$emit('toggle-like', pack)"
>
<font-awesome-icon icon="fa-solid fa-heart" class="me-1" />
<span class="pack-like-count">{{ pack.likesCount }}</span>
</button>
<span class="text-muted pack-imports" :title="t('store.importsCount')">
<font-awesome-icon icon="fa-solid fa-download" class="me-1" />
{{ pack.importsCount }}
</span>
<span
v-if="pack.commentsEnabled"
class="text-muted pack-comments-count"
:title="t('comment.title')"
>
<font-awesome-icon icon="fa-solid fa-comment" class="me-1" />
{{ pack.commentsCount }}
</span>
</div>
</div>
</div>
</template>
<script setup lang="ts">
// @implements UC-STORE-001.1, UC-STORE-009.1, UC-STORE-014.1, UC-STORE-015.1
import { computed } from 'vue'
import CardPicture from '@/components/CardPicture.vue'
import { useUILanguage } from '@/composables/useUILanguage'
import { useLanguage } from '@/composables/useLanguage'
import type { InstalledPack, Pack } from '@/stores/packs'
const props = defineProps<{ pack: Pack | InstalledPack }>()
defineEmits<{ open: [pack: Pack]; 'toggle-like': [pack: Pack] }>()
// Only an installed pack has one: null for an install from before it was kept
const installedVersion = computed(() =>
'installedVersion' in props.pack ? props.pack.installedVersion : undefined
)
const { t } = useUILanguage()
const { getTranslation } = useLanguage()
</script>
<style scoped>
.pack-picture-container {
width: 100%;
height: 150px;
overflow: hidden;
border-top-left-radius: var(--bs-card-inner-border-radius, 0.375rem);
border-top-right-radius: var(--bs-card-inner-border-radius, 0.375rem);
border-bottom: 1px solid var(--bw-border);
background: var(--bw-surface-muted);
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
}
.pack-picture-container :deep(img) {
display: block;
}
.pack-card {
cursor: pointer;
}
.pack-name,
.pack-description {
overflow-wrap: anywhere;
}
</style>
|