feat(detail): fix some detail issues

This commit is contained in:
Daniel Klein 2024-09-17 08:13:11 +02:00
parent 14291d18e6
commit e70109576b
4 changed files with 398 additions and 270 deletions

View file

@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { Project, ProjectIndexable } from '~/types'
import type { Project } from '~/types'
const props = defineProps<{
project: Project
@ -21,54 +21,6 @@ const props = defineProps<{
- team: anon / public
- audit: yes / no
*/
const calculateScore = computed(() => {
const criterias: { value: keyof ProjectIndexable, key: keyof ProjectIndexable | '' }[] = [
{ value: 'product_readiness', key: '' },
{ value: 'github', key: 'links' },
{ value: 'docs', key: 'links' },
{ value: 'team', key: '' },
{ value: 'audits', key: '' },
]
let matched = 0
for (let i = 0; i < criterias.length; i++) {
let value
// value = ((criterias[i].key ?? props.project[criterias[i].value as keyof typeof props.project]) ?? null === null) ? null : (props.project as ProjectIndexable)[criterias[i].key][criterias[i].value]
const indexableProject = props.project as ProjectIndexable
if (criterias[i].key !== '')
value = (indexableProject[criterias[i].key] as any)?.[criterias[i].value]
else
value = indexableProject?.[criterias[i].value]
// console.log(props.project?.links?.github);
// console.log(Object.keys(props.indexableProject["team"]).length);
if (value === null || value === undefined)
continue
if (fulfilled(value))
matched++
}
return 100 / criterias.length * matched
})
function fulfilled(value: any): boolean {
const type = typeof value
switch (type) {
case 'string':
if (value !== '')
return true
break
case 'object':
if (Object.keys(value!).length > 0)
return true
break
default:
return false
}
return false
}
const logo = props.project?.logos?.at(0)?.url
</script>
@ -215,6 +167,8 @@ const logo = props.project?.logos?.at(0)?.url
col-span-3
>
<div
v-for="rating of project.ratings"
:key="rating.name"
flex
flex-col
lg:flex-row
@ -224,50 +178,11 @@ const logo = props.project?.logos?.at(0)?.url
text="12px lg:16px"
leading="16px lg:24px"
>
Openess:
{{ rating.name }}:
</p>
<ProjectRating
:rating="project.ratings.openess"
type="openess"
:score="1"
compact
/>
</div>
<div
flex
flex-col
lg:flex-row
items-center
>
<p
text="12px lg:16px"
leading="16px lg:24px"
>
Technology:
</p>
<ProjectRating
:rating="project.ratings.technology"
type="technology"
:score="2"
compact
/>
</div>
<div
flex
flex-col
lg:flex-row
items-center
>
<p
text="12px lg:16px"
leading="16px lg:24px"
>
Privacy:
</p>
<ProjectRating
:rating="project.ratings.privacy"
type="privacy"
:score="3"
:rating="rating"
:percentage="rating.points"
compact
/>
</div>
@ -303,7 +218,7 @@ const logo = props.project?.logos?.at(0)?.url
py="2px lg:8px"
lg:py-4px
>
{{ calculateScore }} %
{{ calculateScore(project) }} %
</div>
</div>
</div>

View file

@ -9,7 +9,7 @@ onMounted(() => {
selectedCategoryId.value = route.params.id as string
})
const group = [{ title: categories.value.find(c => c.id === selectedCategoryId.value)!.name, projects: filteredProjects.value }]
const group = computed(() => [{ title: categories.value.find(c => c.id === selectedCategoryId.value)?.name || '', projects: filteredProjects.value }])
</script>
<template>

View file

@ -50,8 +50,6 @@ useSeoMeta({
<ProjectPrivacy :project="project" />
<ProjectSecurity :project="project" />
<ProjectHistory :project="project" />
<!-- <ProjectActivity :project="project" />
<ProjectMarket /> -->
</div>
</div>
</div>

View file

@ -1,4 +1,77 @@
{
"categories": [
{
"id": "infrastructure",
"name": "Infrastructure",
"usecases": [
"node",
"rpc-provider",
"infrastructure",
"eth-layer-2",
"research-and-development",
"computing",
"storage",
"data-management",
"other"
]
},
{
"id": "social-and-communications",
"name": "Social & Communications",
"usecases": [
"dao",
"nft-community",
"alliances",
"messaging",
"events",
"other"
]
},
{
"id": "hardware",
"name": "Hardware",
"usecases": [
"wallets",
"node",
"other"
]
},
{
"id": "applications",
"name": "Applications",
"usecases": [
"browser",
"vpn",
"did",
"operation-systems",
"dapps",
"wallets",
"ai",
"kyc-solution",
"other"
]
},
{
"id": "defi",
"name": "Defi",
"usecases": [
"bridge",
"defi",
"mixing-service",
"mixing-management",
"currency",
"other"
]
},
{
"id": "archived-projects",
"name": "Archived projects",
"usecases": [
"legacy-projects",
"deprecated-systems"
]
}
],
"projects": [
{
"id": "01-labs",
@ -15885,181 +15958,6 @@
]
}
],
"assets": [
{
"id": "eth",
"name": "Ethereum"
},
{
"id": "btc",
"name": "Bitcoin"
},
{
"id": "usdc",
"name": "Coinbase stable"
},
{
"id": "usdt",
"name": "Tether"
},
{
"id": "dai",
"name": "MakerDAO stable"
},
{
"id": "atom",
"name": "Cosmos"
},
{
"id": "scrt",
"name": "Secret Network"
},
{
"id": "dot",
"name": "Polkadot"
},
{
"id": "sol",
"name": "Solana"
},
{
"id": "zcash",
"name": "Zcash"
},
{
"id": "xmr",
"name": "Monero"
},
{
"id": "other",
"name": "Other"
}
],
"categories": [
{
"id": "infrastructure",
"name": "Infrastructure",
"usecases": [
"node",
"rpc-provider",
"infrastructure",
"eth-layer-2",
"research-and-development",
"computing",
"storage",
"data-management",
"other"
]
},
{
"id": "social-and-communications",
"name": "Social & Communications",
"usecases": [
"dao",
"nft-community",
"alliances",
"messaging",
"events",
"other"
]
},
{
"id": "hardware",
"name": "Hardware",
"usecases": [
"wallets",
"node",
"other"
]
},
{
"id": "applications",
"name": "Applications",
"usecases": [
"browser",
"vpn",
"did",
"operation-systems",
"dapps",
"wallets",
"ai",
"kyc-solution",
"other"
]
},
{
"id": "defi",
"name": "Defi",
"usecases": [
"bridge",
"defi",
"mixing-service",
"mixing-management",
"currency",
"other"
]
},
{
"id": "archived-projects",
"name": "Archived projects",
"usecases": [
"legacy-projects",
"deprecated-systems"
]
}
],
"ecosystems": [
{
"id": "ethereum",
"name": "Ethereum"
},
{
"id": "bitcoin",
"name": "Bitcoin"
},
{
"id": "solana",
"name": "Solana"
},
{
"id": "cosmos",
"name": "Cosmos"
},
{
"id": "monero",
"name": "Monero"
},
{
"id": "other",
"name": "Other"
}
],
"features": [
{
"id": "no-compliance",
"name": "No compliance"
},
{
"id": "non-kyc",
"name": "Non-KYC"
},
{
"id": "private-by-default",
"name": "Private by default"
},
{
"id": "non-custodial",
"name": "Non custodial"
},
{
"id": "opensource",
"name": "Opensource"
},
{
"id": "live-on-mainnet",
"name": "Live on Mainnet"
}
],
"usecases": [
{
"id": "wallets",
@ -16185,5 +16083,322 @@
"id": "other",
"name": "Other"
}
],
"assets": [
{
"id": "eth",
"name": "Ethereum"
},
{
"id": "btc",
"name": "Bitcoin"
},
{
"id": "usdc",
"name": "Coinbase stable"
},
{
"id": "usdt",
"name": "Tether"
},
{
"id": "dai",
"name": "MakerDAO stable"
},
{
"id": "atom",
"name": "Cosmos"
},
{
"id": "scrt",
"name": "Secret Network"
},
{
"id": "dot",
"name": "Polkadot"
},
{
"id": "sol",
"name": "Solana"
},
{
"id": "zcash",
"name": "Zcash"
},
{
"id": "xmr",
"name": "Monero"
},
{
"id": "other",
"name": "Other"
}
],
"features": [
{
"id": "no-compliance",
"name": "No compliance"
},
{
"id": "non-kyc",
"name": "Non-KYC"
},
{
"id": "private-by-default",
"name": "Private by default"
},
{
"id": "non-custodial",
"name": "Non custodial"
},
{
"id": "opensource",
"name": "Opensource"
},
{
"id": "live-on-mainnet",
"name": "Live on Mainnet"
}
],
"ecosystems": [
{
"id": "ethereum",
"name": "Ethereum",
"icon": "https://assets.coingecko.com/coins/images/279/standard/ethereum.png?1696501628"
},
{
"id": "bitcoin",
"name": "Bitcoin",
"icon": "https://assets.coingecko.com/coins/images/1/standard/bitcoin.png?1696501400"
},
{
"id": "solana",
"name": "Solana",
"icon": "https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"
},
{
"id": "cosmos",
"name": "Cosmos",
"icon": "https://assets.coingecko.com/coins/images/1481/standard/cosmos_hub.png?1696502525"
},
{
"id": "monero",
"name": "Monero",
"icon": "https://assets.coingecko.com/coins/images/69/standard/monero_logo.png?1696501460"
},
{
"id": "other",
"name": "Other"
}
],
"ranks": [
{
"id": "openess",
"name": "Openess",
"references": [
{
"field": "team.teammembers",
"label": "Team",
"positive": "Member",
"negative": "Anonymous",
"condition": {
"minLength": 1
},
"points": 10
},
{
"field": "links.docs",
"label": "Documentation",
"positive": "Link",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 10
},
{
"field": "links.github",
"label": "Github",
"positive": "Link",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 10
},
{
"field": "links.twitter",
"label": "Twitter",
"positive": "Link",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 1
},
{
"field": "links.telegram",
"label": "Telegram",
"positive": "Link",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 1
},
{
"field": "links.discord",
"label": "Discord",
"positive": "Link",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 1
},
{
"field": "links.lens",
"label": "Lens",
"positive": "Link",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 1
},
{
"field": "links.farcaster",
"label": "Farcaster",
"positive": "Link",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 1
},
{
"field": "links.whitepaper",
"label": "Whitepaper",
"positive": "Link",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 10
},
{
"field": "funding.value",
"label": "Funding",
"positive": "Investment",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 10
}
]
},
{
"id": "technology",
"name": "Technology",
"references": [
{
"field": "project_status.mainnet",
"label": "Mainnet",
"positive": "Yes",
"negative": "No",
"condition": {
"exists": true
},
"points": 10
},
{
"field": "blockchain_features.opensource",
"label": "Open Source",
"positive": "Yes",
"negative": "No",
"condition": {
"equals": true
},
"points": 20
},
{
"field": "blockchain_features.asset_custody_type",
"label": "Non Custody",
"positive": "None",
"negative": "Custodial",
"condition": {
"equals": "non-custody"
},
"points": 10
},
{
"field": "blockchain_features.upgradability.enabled",
"label": "Upgradability",
"positive": "Disabled",
"negative": "Enabled",
"condition": {
"equals": false
},
"points": 10
},
{
"field": "audits",
"label": "Audits",
"positive": "Audit",
"negative": "None",
"condition": {
"minLength": 1
},
"points": 10
}
]
},
{
"id": "privacy",
"name": "Privacy",
"references": [
{
"field": "privacy_policy.link",
"label": "Privacy Policy",
"positive": "Link",
"negative": "Not available",
"condition": {
"exists": true
},
"points": 10
},
{
"field": "traceability.kyc",
"label": "KYC",
"positive": "No",
"negative": "Yes",
"condition": {
"equals": false
},
"points": 10
},
{
"field": "compliance",
"label": "Compliance",
"positive": "No",
"negative": "OFAC",
"condition": {
"equals": true
},
"points": 5
},
{
"field": "default_privacy",
"label": "Default Privacy",
"positive": "YES",
"negative": "No",
"condition": {
"equals": true
},
"points": 10
}
]
}
]
}