diff --git a/components/Project/ProjectHeading.vue b/components/Project/ProjectHeading.vue index 1e438d0..537fd74 100644 --- a/components/Project/ProjectHeading.vue +++ b/components/Project/ProjectHeading.vue @@ -13,7 +13,6 @@ const availableSupport = computed(() => { return 0 }) - /** * From data points - product readiness @@ -22,52 +21,53 @@ const availableSupport = computed(() => { - team: anon / public - audit: yes / no */ -const calculateScore = computed(() => { - const criterias: { value: string, key?: string }[] = [ +const calculateScore: number = computed(() => { + const criterias: { value: string; key?: string }[] = [ { value: 'product_readiness' }, - { value: "github", key: 'links' }, - { value: "docs", key: 'links' }, + { value: 'github', key: 'links' }, + { value: 'docs', key: 'links' }, { value: 'team' }, - { value: 'audits' } - ]; + { value: 'audits' }, + ] - let matched = 0; + let matched = 0 for (let i = 0; i < criterias.length; i++) { - let value; + let value if (criterias[i].key) { - if(props.project[criterias[i].key] === null || props.project[criterias[i].key] === undefined) continue; - value = props.project[criterias[i].key][criterias[i].value]; - // console.log(props.project[criterias[i].key] == null); - } else { - value = props.project[criterias[i].value]; + if (props.project[criterias[i].key] === null || props.project[criterias[i].key] === undefined) + continue + value = props.project[criterias[i].key][criterias[i].value] + } + else { + if (props.project[criterias[i].value] === null || props.project[criterias[i].value] === undefined) + continue + value = props.project[criterias[i].value] } // console.log(value); + // console.log(Object.keys(props.project["team"]).length); - if (fulfilled(value)) { - matched++; + if (fulfilled(value)) + matched++ // console.log('matched', matched); - } } - return 100 / criterias.length * matched; + return 100 / criterias.length * matched }) function fulfilled(value: any): boolean { - const type = typeof value; + const type = typeof value switch (type) { case 'string': - if (value !== '') return true; - break; - case 'array': - if (value.length > 0) return true; - break; + if (value !== '') + return true + break case 'object': - if (Object.keys(value).length > 0) return true; - break; + if (Object.keys(value).length > 0) + return true + break default: - return false; - break; + return false } } @@ -76,13 +76,17 @@ const logo = props.project?.logos?.at(0)?.url {{ project.links?.github ? 'YES' : 'NO' }} - + @@ -137,8 +145,10 @@ const logo = props.project?.logos?.at(0)?.url
- + {{ project.blockchain_features?.network }}