2023-12-19 18:43:42 +01:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import type { InputOption } from '~/types'
|
|
|
|
|
2024-09-17 08:12:43 +02:00
|
|
|
const { categories, usecases, ecosystems, assets, features, filteredProjectsCount, selectedCategoryId, selectedUsecaseId, selectedEcosystemId, selectedAssetsUsedId, selectedFeaturesId } = storeToRefs(useData())
|
2023-12-19 18:43:42 +01:00
|
|
|
|
2024-09-17 08:12:43 +02:00
|
|
|
const selectedCategory = computed(() => {
|
|
|
|
return categories.value.find(c => c.id === selectedCategoryId.value)
|
|
|
|
})
|
|
|
|
const availableUsecases = computed(() => {
|
|
|
|
if (selectedCategoryId.value === 'all')
|
|
|
|
return usecases.value
|
|
|
|
return usecases.value.filter(u => selectedCategory.value?.usecases?.includes(u.id))
|
|
|
|
})
|
2024-09-03 17:13:23 +02:00
|
|
|
|
2024-09-12 11:56:16 +02:00
|
|
|
const categoryOptions = ref<InputOption[]>(categories.value ? [{ label: 'Category', value: 'all' }, ...categories.value.map(c => ({ label: c.name, value: c.id, count: c.projectsCount }))] : [])
|
2024-09-17 08:12:43 +02:00
|
|
|
const usecaseOptions = computed<InputOption[]>(() => availableUsecases.value.length ? [{ label: 'Usecase', value: 'all' }, ...availableUsecases.value.map(u => ({ label: u.name, value: u.id }))] : [])
|
2024-09-12 11:56:16 +02:00
|
|
|
const ecosystemOptions = ref<InputOption[]>(ecosystems.value ? [{ label: 'Ecosystem', value: 'all' }, ...ecosystems.value.map(e => ({ label: e.name, value: e.id }))] : [])
|
2024-09-17 08:12:43 +02:00
|
|
|
const assetOptions = ref<InputOption[]>(assets.value ? [{ label: 'Asset used', value: 'all' }, ...assets.value.map(a => ({ label: `${a.id.toUpperCase()} (${a.name})`, value: a.id }))] : [])
|
2024-09-12 11:56:16 +02:00
|
|
|
const featureOptions = ref<InputOption[]>(features.value ? [{ label: 'Feature', value: 'all' }, ...features.value.map(f => ({ label: f.name, value: f.id }))] : [])
|
2023-12-19 18:43:42 +01:00
|
|
|
|
|
|
|
const { showBar } = storeToRefs(useNavigaiton())
|
|
|
|
const swipeEl = ref()
|
|
|
|
const { y } = useWindowScroll()
|
|
|
|
const scrollEl = ref()
|
|
|
|
const { y: scrollY } = useScroll(scrollEl)
|
|
|
|
const { top } = useElementBounding(scrollEl)
|
|
|
|
|
|
|
|
watch(y, (newY, oldY) => {
|
|
|
|
if (newY > oldY && newY > 32)
|
|
|
|
showBar.value = false
|
|
|
|
else
|
|
|
|
showBar.value = true
|
|
|
|
})
|
|
|
|
|
|
|
|
watch([scrollY, top, y], (newValues, oldValues) => {
|
|
|
|
if (top.value <= 32)
|
|
|
|
scrollY.value += newValues[2] - oldValues[2]
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-09-02 15:13:43 +02:00
|
|
|
<div
|
|
|
|
ref="swipeEl"
|
|
|
|
flex
|
|
|
|
flex-col
|
|
|
|
min-h-100vh
|
|
|
|
h-full
|
|
|
|
w-full
|
|
|
|
>
|
2023-12-19 18:43:42 +01:00
|
|
|
<Navigation />
|
2024-09-02 15:13:43 +02:00
|
|
|
<div
|
|
|
|
app-container
|
|
|
|
mt-32px
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
flex
|
|
|
|
w-full
|
|
|
|
xl:gap-32px
|
|
|
|
>
|
2024-09-03 17:13:23 +02:00
|
|
|
<div
|
|
|
|
flex
|
|
|
|
flex-col
|
|
|
|
w-full
|
|
|
|
>
|
2024-09-02 15:13:43 +02:00
|
|
|
<div
|
|
|
|
flex
|
|
|
|
flex-col
|
2024-09-03 17:13:23 +02:00
|
|
|
md:flex-row
|
|
|
|
md:justify-between
|
|
|
|
md:items-center
|
2024-09-02 15:13:43 +02:00
|
|
|
gap-16px
|
2024-09-03 17:13:23 +02:00
|
|
|
mb="16px md:32px"
|
2024-09-02 15:13:43 +02:00
|
|
|
>
|
2024-09-03 17:13:23 +02:00
|
|
|
<SearchBox
|
|
|
|
flex-1
|
2024-09-12 08:42:37 +02:00
|
|
|
placeholder:text-app-text-grey
|
2024-09-03 17:13:23 +02:00
|
|
|
:placeholder="`Search in ${filteredProjectsCount} Projects`"
|
|
|
|
/>
|
2024-09-02 15:13:43 +02:00
|
|
|
<div
|
2024-09-03 17:13:23 +02:00
|
|
|
md:flex-2
|
|
|
|
flex
|
|
|
|
items-center
|
|
|
|
gap-16px
|
2024-09-18 21:20:39 +02:00
|
|
|
overflow-x-auto
|
2024-09-19 17:55:34 +02:00
|
|
|
pb-274px
|
|
|
|
mb--250px
|
|
|
|
md="overflow-x-visible pb-0 mb-0"
|
|
|
|
class="no-scrollbar"
|
2024-09-02 15:13:43 +02:00
|
|
|
>
|
|
|
|
<CategorySelectBox
|
|
|
|
v-model="selectedCategoryId"
|
2024-09-12 08:42:37 +02:00
|
|
|
:options="categoryOptions"
|
|
|
|
name="categorySelect"
|
2024-09-02 15:13:43 +02:00
|
|
|
w-full
|
|
|
|
@selected="selectedCategoryId === 'all' ? navigateTo(`/`) : navigateTo(`/category/${selectedCategoryId}`)"
|
|
|
|
/>
|
2024-09-03 17:13:23 +02:00
|
|
|
<CategorySelectBox
|
2024-09-17 08:12:43 +02:00
|
|
|
v-if="usecases?.length"
|
2024-09-03 17:13:23 +02:00
|
|
|
v-model="selectedUsecaseId"
|
2024-09-12 08:42:37 +02:00
|
|
|
name="usecaseSelect"
|
|
|
|
:options="usecaseOptions"
|
2024-09-03 17:13:23 +02:00
|
|
|
w-full
|
|
|
|
/>
|
|
|
|
<CategorySelectBox
|
2024-09-17 08:12:43 +02:00
|
|
|
v-if="ecosystems?.length"
|
2024-09-03 17:13:23 +02:00
|
|
|
v-model="selectedEcosystemId"
|
2024-09-12 08:42:37 +02:00
|
|
|
name="ecosystemSelect"
|
|
|
|
:options="ecosystemOptions"
|
2024-09-03 17:13:23 +02:00
|
|
|
w-full
|
|
|
|
/>
|
|
|
|
<CategorySelectBox
|
2024-09-17 08:12:43 +02:00
|
|
|
v-if="assets?.length"
|
2024-09-03 17:13:23 +02:00
|
|
|
v-model="selectedAssetsUsedId"
|
2024-09-12 08:42:37 +02:00
|
|
|
name="assetsUsedSelect"
|
|
|
|
:options="assetOptions"
|
2024-09-03 17:13:23 +02:00
|
|
|
w-full
|
|
|
|
/>
|
|
|
|
<CategorySelectBox
|
2024-09-17 08:12:43 +02:00
|
|
|
v-if="features?.length"
|
2024-09-03 17:13:23 +02:00
|
|
|
v-model="selectedFeaturesId"
|
2024-09-12 08:42:37 +02:00
|
|
|
name="featuresSelect"
|
|
|
|
:options="featureOptions"
|
2024-09-03 17:13:23 +02:00
|
|
|
w-full
|
|
|
|
/>
|
2023-12-19 18:43:42 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<slot />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<Footer justify-self-end />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.no-scrollbar::-webkit-scrollbar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.no-scrollbar {
|
|
|
|
-ms-overflow-style: none; /* IE and Edge */
|
|
|
|
scrollbar-width: none; /* Firefox */
|
|
|
|
}
|
|
|
|
</style>
|