From 3b8bd7b44bd44dab8f8f6066d993a098e084165d Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Fri, 1 Mar 2024 18:04:06 +0000 Subject: [PATCH] Improved additional info to display for each listing --- .../things/PrivacyPolicyDetails.astro | 20 ++- web/src/pages/[...listing].astro | 167 ++++++++++++++++-- web/src/utils/fetch-privacy-policy.ts | 2 +- 3 files changed, 173 insertions(+), 16 deletions(-) diff --git a/web/src/components/things/PrivacyPolicyDetails.astro b/web/src/components/things/PrivacyPolicyDetails.astro index 1dad121..67e984c 100644 --- a/web/src/components/things/PrivacyPolicyDetails.astro +++ b/web/src/components/things/PrivacyPolicyDetails.astro @@ -28,7 +28,7 @@ const getIconName = (clasification: string) => { {(priv.points && priv.points.length) > 0 && (

Privacy Policy Summary

-
@@ -111,6 +114,7 @@ h4 { li { :global(svg) { width: 1rem; + margin-right: 0.2rem; } &.clasification { &.good :global(svg) { color: #35b969; } @@ -137,6 +141,10 @@ h4 { opacity: 0.7; } } + &.no-point { + list-style: none; + padding-left: 0.25rem; + } } .rating { @@ -158,4 +166,10 @@ h4 { color: var(--rating-color); border-color: var(--rating-color); } + + .about-tosdr { + display: inline; + font-size: 0.8rem; + opacity: 0.7; + } diff --git a/web/src/pages/[...listing].astro b/web/src/pages/[...listing].astro index 73150e2..4a25234 100644 --- a/web/src/pages/[...listing].astro +++ b/web/src/pages/[...listing].astro @@ -12,6 +12,8 @@ import { fetchGitHubStats } from '@utils/fetch-repo-info'; import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy'; import { fetchWebsiteInfo } from '@utils/fetch-website-info'; import { parseMarkdown, formatLink } from '@utils/parse-markdown'; +import FontAwesome from '@components/form/FontAwesome.svelte'; +import Button from '@components/form/Button.astro'; interface Props extends Service { slug: string; @@ -27,9 +29,9 @@ const { tosdrId, icon, followWith, - // securityAudited, - // openSource, - // acceptsCrypto, + securityAudited, + openSource, + acceptsCrypto, parentSection, categoryName, } = Astro.props; @@ -103,14 +105,15 @@ export async function getStaticPaths() { }); } -// const makePaginationLinks = () => { -// const index = otherSections.findIndex(section => section.name === title); -// const previousSection = index > 0 ? otherSections[index - 1].name : null; -// const nextSection = index < otherSections.length - 1 ? otherSections[index + 1].name : null; -// return { previous: previousSection, next: nextSection }; -// }; +const makePaginationLinks = () => { + const allServices = parentSection.services || []; + const index = allServices.findIndex(item => item.name === name); + const previousItem = index > 0 ? allServices[index - 1].name : null; + const nextItem = index < allServices.length - 1 ? allServices[index + 1].name : null; + return { previous: previousItem, next: nextItem }; +}; -// const { previous, next } = makePaginationLinks(); +const { previous, next } = makePaginationLinks(); const ignoredSites = ['github.gom', 'wikipedia.']; @@ -151,7 +154,63 @@ const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignor data-service-url={formatLink(url)} src={icon || `https://icon.horse/icon/${formatLink(url)}`} /> +

+ +
+ +
+ { securityAudited && ( + + Security Audited + + )} + { acceptsCrypto && ( + + Crypto Payments Accepted + + )} + { securityAudited === false && ( + + No Security Audit + + )} + { (openSource === false) && ( + + + Not Open Source + + )} + { openSource || (github && openSource !== false) ? ( + + Open Source + + ) : null }
{ privacyData && ( @@ -188,6 +247,24 @@ const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignor sectionName={parentSection.name} /> + +
+ { previous ? ( + + ) :

} + + View {parentSection.name} ({(parentSection.services || []).length}) + + { next && ( + + )} +
@@ -261,10 +338,29 @@ h3 { .intro { font-size: 1.2rem; font-style: italic; - opacity: 0.7; + opacity: 0.9; display: flex; - align-items: center; gap: 0.5rem; + .service-icon { + border-radius: var(--curve-md); + margin-top: 1rem; + } + h4 { + margin-bottom: 0; + } + ul { + padding-left: 1rem; + list-style: circle; + font-style: normal; + font-size: 1rem; + margin-top: 0; + b { + font-size: 1rem; + font-weight: 400; + min-width: 85px; + display: inline-block; + } + } } .pagination-navigation { @@ -343,4 +439,51 @@ h3 { } } +.highlights { + display: flex; + gap: 1rem; + flex-wrap: wrap; + align-items: center; + justify-content: end; + + .meta-item, .warning { + display: flex; + align-items: center; + // justify-content: center; + gap: 0.25rem; + opacity: 0.6; + font-size: 0.9rem; + padding: 0.5rem 0; + :global(svg) { + color: var(--foreground); + width: 1.2rem; + height: 1.2rem; + } + a { + text-decoration: none; + color: var(--foreground); + display: flex; + gap: 0.25rem; + &:hover { + color: var(--accent-3); + :global(svg) { + color: var(--accent-3); + } + } + } + } + .warning { + color: var(--danger); + :global(svg) { + color: var(--danger); + } + } + .great { + color: #007930; // var(--success); + :global(svg) { + color: #007930; // var(--success); + } + } +} + diff --git a/web/src/utils/fetch-privacy-policy.ts b/web/src/utils/fetch-privacy-policy.ts index 9b1cc29..2cff5a1 100644 --- a/web/src/utils/fetch-privacy-policy.ts +++ b/web/src/utils/fetch-privacy-policy.ts @@ -1,6 +1,6 @@ export const fetchTosdrPrivacy = async (serviceId: string): Promise => { - const endpoint = `https://api.tosdr.org/service/v2?id=${serviceId}`; + const endpoint = `https://privacy-policies.as93.workers.dev/${serviceId}`; try { return await fetch(endpoint).then((res) => res.json()); } catch (error) {