2023-12-19 18:43:42 +01:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import type { ProjectShallow } from '~/types'
|
|
|
|
|
|
|
|
const props = defineProps<{
|
2024-09-12 08:42:37 +02:00
|
|
|
projects: { title: string, projects: ProjectShallow[] }[]
|
2023-12-19 18:43:42 +01:00
|
|
|
}>()
|
2024-09-17 08:12:43 +02:00
|
|
|
const { switcher, filter } = storeToRefs(useData())
|
2023-12-19 18:43:42 +01:00
|
|
|
|
2024-09-17 08:12:43 +02:00
|
|
|
const totalProjectsCount = props.projects.map(g => g.projects.length).reduce((a, b) => a + b, 0)
|
|
|
|
|
|
|
|
function onChangeSort(sortKey: string) {
|
|
|
|
if (filter.value.sortby === sortKey) {
|
|
|
|
if (filter.value.sortDirection === 'desc' && filter.value.sortby !== 'score') {
|
|
|
|
filter.value.sortby = 'score'
|
|
|
|
filter.value.sortDirection = 'desc'
|
|
|
|
return
|
|
|
|
}
|
|
|
|
filter.value.sortDirection = filter.value.sortDirection === 'asc' ? 'desc' : 'asc'
|
|
|
|
return
|
|
|
|
}
|
|
|
|
filter.value.sortby = sortKey
|
|
|
|
filter.value.sortDirection = sortKey === 'score' ? 'desc' : 'asc'
|
2023-12-19 18:43:42 +01:00
|
|
|
}
|
2024-09-03 17:13:23 +02:00
|
|
|
|
2024-09-17 08:12:43 +02:00
|
|
|
const cardTitles = ref< { label: string, sortKey: string, togglable?: boolean }[]>([
|
|
|
|
{ label: 'Usecase', sortKey: 'usecase' },
|
|
|
|
{ label: 'Openess', sortKey: 'openess', togglable: true },
|
|
|
|
{ label: 'Technology', sortKey: 'technology', togglable: true },
|
|
|
|
{ label: 'Privacy', sortKey: 'privacy', togglable: true },
|
|
|
|
{ label: 'Ecosystem', sortKey: 'ecosystem' },
|
|
|
|
{ label: 'Links', sortKey: 'links' },
|
|
|
|
{ label: 'W3PN Score', sortKey: 'score', togglable: true },
|
2024-09-03 17:13:23 +02:00
|
|
|
])
|
2023-12-19 18:43:42 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-09-02 15:13:43 +02:00
|
|
|
<div
|
|
|
|
flex
|
|
|
|
flex-col
|
|
|
|
items-start
|
|
|
|
>
|
2024-09-12 08:42:37 +02:00
|
|
|
<template
|
|
|
|
v-for="group in projects"
|
|
|
|
:key="group.title"
|
2024-09-03 17:13:23 +02:00
|
|
|
>
|
|
|
|
<div
|
2024-09-12 08:42:37 +02:00
|
|
|
|
2024-09-03 17:13:23 +02:00
|
|
|
flex
|
|
|
|
items-center
|
2024-09-12 08:42:37 +02:00
|
|
|
gap-x-12px
|
|
|
|
w-full
|
|
|
|
mb="8px lg:16px"
|
|
|
|
mt-22px
|
2024-09-03 17:13:23 +02:00
|
|
|
>
|
2024-09-12 08:42:37 +02:00
|
|
|
<h2
|
|
|
|
text="app-white 16px lg:24px"
|
|
|
|
font-700
|
|
|
|
leading="24px lg:32px"
|
2024-09-03 17:13:23 +02:00
|
|
|
whitespace-nowrap
|
|
|
|
>
|
2024-09-12 08:42:37 +02:00
|
|
|
{{ group.projects.length }} {{ group.title }}
|
|
|
|
</h2>
|
|
|
|
<div
|
|
|
|
h-2px
|
|
|
|
w-full
|
|
|
|
bg-app-text-grey
|
|
|
|
/>
|
2024-09-03 17:13:23 +02:00
|
|
|
<button
|
|
|
|
type="button"
|
2024-09-12 08:42:37 +02:00
|
|
|
i-ic-baseline-arrow-drop-down
|
|
|
|
text="app-text-grey 24px"
|
2024-09-03 17:13:23 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div
|
2024-09-12 08:42:37 +02:00
|
|
|
grid
|
|
|
|
grid-cols="2 lg:10"
|
2024-09-03 17:13:23 +02:00
|
|
|
w-full
|
2024-09-12 08:42:37 +02:00
|
|
|
mb-16px
|
2024-09-03 17:13:23 +02:00
|
|
|
>
|
2024-09-12 08:42:37 +02:00
|
|
|
<div
|
|
|
|
flex
|
|
|
|
items-center
|
|
|
|
gap-4px
|
2024-09-17 08:12:43 +02:00
|
|
|
col-span="1 lg:2"
|
|
|
|
:class="['title' === filter.sortby ? 'text-app-white' : 'text-app-text-grey', 'cursor-pointer']"
|
|
|
|
@click="onChangeSort('title')"
|
2024-09-12 08:42:37 +02:00
|
|
|
>
|
|
|
|
<p
|
2024-09-17 08:12:43 +02:00
|
|
|
text="12px lg:14px"
|
2024-09-12 08:42:37 +02:00
|
|
|
leading="16px lg:24px"
|
|
|
|
whitespace-nowrap
|
|
|
|
>
|
|
|
|
Project name
|
|
|
|
</p>
|
|
|
|
<button
|
2024-09-18 20:46:47 +02:00
|
|
|
hidden
|
|
|
|
lg:block
|
2024-09-12 08:42:37 +02:00
|
|
|
type="button"
|
2024-09-17 08:12:43 +02:00
|
|
|
:class="['title' === filter.sortby ? filter.sortDirection === 'desc' ? 'i-ic-baseline-arrow-drop-up'
|
|
|
|
: 'i-ic-baseline-arrow-drop-down'
|
|
|
|
: 'i-ic-baseline-arrow-drop-down']"
|
|
|
|
text="20px"
|
2024-09-12 08:42:37 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
flex
|
|
|
|
items-center
|
|
|
|
justify-end
|
|
|
|
gap-4px
|
|
|
|
lg:hidden
|
|
|
|
>
|
2024-09-18 20:46:47 +02:00
|
|
|
<SortSelectBox
|
|
|
|
v-model="filter.sortby"
|
|
|
|
:options="['title', 'openess', 'technology', 'privacy', 'score'].map((o) => ({ label: capitalize(o), value: o }))"
|
2024-09-12 08:42:37 +02:00
|
|
|
/>
|
|
|
|
</div>
|
2024-09-03 17:13:23 +02:00
|
|
|
<div
|
2024-09-17 08:12:43 +02:00
|
|
|
v-for="(title, index) in cardTitles"
|
2024-09-03 17:13:23 +02:00
|
|
|
:key="title.label"
|
2024-09-12 08:42:37 +02:00
|
|
|
lg:flex
|
2024-09-03 17:13:23 +02:00
|
|
|
items-center
|
2024-09-12 08:42:37 +02:00
|
|
|
justify-start
|
|
|
|
last:justify-end
|
2024-09-03 17:13:23 +02:00
|
|
|
gap-4px
|
2024-09-12 08:42:37 +02:00
|
|
|
hidden
|
2024-09-17 08:12:43 +02:00
|
|
|
:class="[title.sortKey === filter.sortby ? 'text-app-white' : 'text-app-text-grey', { 'cursor-pointer': title.togglable, 'col-span-1 lg:col-span-2': index === 0 }]"
|
|
|
|
@click="onChangeSort(title.sortKey)"
|
2024-09-03 17:13:23 +02:00
|
|
|
>
|
|
|
|
<p
|
2024-09-17 08:12:43 +02:00
|
|
|
text="12px lg:14px "
|
2024-09-12 08:42:37 +02:00
|
|
|
leading="16px lg:24px"
|
2024-09-03 17:13:23 +02:00
|
|
|
whitespace-nowrap
|
|
|
|
>
|
|
|
|
{{ title.label }}
|
|
|
|
</p>
|
|
|
|
<button
|
|
|
|
v-if="title.togglable"
|
|
|
|
type="button"
|
2024-09-17 08:12:43 +02:00
|
|
|
:class="[title.sortKey === filter.sortby ? filter.sortDirection === 'desc' ? 'i-ic-baseline-arrow-drop-up'
|
|
|
|
: 'i-ic-baseline-arrow-drop-down'
|
2024-09-12 08:42:37 +02:00
|
|
|
: 'i-ic-baseline-arrow-drop-down']"
|
2024-09-17 08:12:43 +02:00
|
|
|
text=" 20px"
|
2024-09-03 17:13:23 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div
|
2024-09-12 08:42:37 +02:00
|
|
|
grid
|
|
|
|
:class="switcher ? 'grid-cols-1 lg:grid-cols-1' : 'xl:grid-cols-3 lg:grid-cols-3 sm:grid-cols-2 grid-cols-1'"
|
|
|
|
gap-16px
|
|
|
|
text-white
|
|
|
|
w-full
|
2024-09-03 17:13:23 +02:00
|
|
|
>
|
2024-09-12 12:02:42 +02:00
|
|
|
<Card
|
2024-09-12 08:42:37 +02:00
|
|
|
v-for="project in group.projects"
|
|
|
|
:key="project.id"
|
|
|
|
:project="project"
|
2024-09-03 17:13:23 +02:00
|
|
|
/>
|
|
|
|
</div>
|
2024-09-12 08:42:37 +02:00
|
|
|
</template>
|
2024-09-17 08:12:43 +02:00
|
|
|
<div v-if="totalProjectsCount === 0">
|
|
|
|
<h3>No Projects found...</h3>
|
|
|
|
</div>
|
2023-12-19 18:43:42 +01:00
|
|
|
</div>
|
|
|
|
</template>
|