Files
cloudron-box/dashboard/src/components/AppStoreItem.vue
2025-05-14 10:26:04 +02:00

89 lines
1.7 KiB
Vue

<script setup>
import { ref, onMounted, useTemplateRef } from 'vue';
defineProps([ 'app' ]);
const visible = ref(false);
const elem = useTemplateRef('elem');
onMounted(() => {
const observer = new IntersectionObserver(result => {
if (result[0].isIntersecting && elem.value) {
visible.value = true;
observer.unobserve(elem.value);
}
});
observer.observe(elem.value);
});
</script>
<template>
<div class="item" ref="elem" :class="{ unstable: app.releaseState === 'unstable' }">
<img v-if="visible" class="icon" :src="app.iconUrl" />
<div class="description">
<div class="title">{{ app.manifest.title }}</div>
<div class="tagline">{{ app.manifest.tagline }}</div>
</div>
<div v-if="app.releaseState === 'unstable'" class="unstable-label">{{ $t('appstore.unstable') }}</div>
</div>
</template>
<style scoped>
.item {
display: flex;
align-items: center;
width: 300px;
padding: 10px 15px;
border-radius: 10px;
cursor: pointer;
position: relative;
}
.item:hover {
background-color: var(--card-background);
}
.item.active {
width: 100%;
background-color: var(--card-background);
}
.icon {
width: 64px;
height: 64px;
object-fit: contain;
margin-right: 20px;
}
.title {
font-size: 16px;
}
.tagline {
font-size: 12px;
opacity: 0.8;
}
.unstable {
background-image: linear-gradient(45deg,rgba(128,128,128,.15) 25%,transparent 25%,transparent 50%,rgba(128,128,128,.15) 50%,rgba(128,128,128,.15) 75%,transparent 75%,transparent);
background-size: 48px 48px;
}
.unstable:hover {
background-color: var(--card-background);
}
.unstable-label {
position: absolute;
color: var(--pankow-color-danger);
top: 3px;
right: 6px;
font-size: 12px;
}
</style>