Commit a799fab9b0
Unsigned
Layout: unified · split
web/src/components/things/PrivacyPolicyDetails.astro added +148
| @@ -0,0 +1,148 @@ | |||
| 1 | --- | ||
| 2 | import type { PrivacyPolicyResponse } from '@utils/fetch-privacy-policy'; | ||
| 3 | |||
| 4 | import { formatDate, timeAgo } from '@utils/dates-n-stuff'; | ||
| 5 | import FontAwesome from "@components/form/FontAwesome.svelte" | ||
| 6 | |||
| 7 | |||
| 8 | interface Props { | ||
| 9 | privacyData: PrivacyPolicyResponse; | ||
| 10 | } | ||
| 11 | |||
| 12 | const { privacyData } = Astro.props; | ||
| 13 | |||
| 14 | const priv = privacyData.parameters; | ||
| 15 | |||
| 16 | const getIconName = (clasification: string) => { | ||
| 17 | if (clasification === 'good') return 'faceGood'; | ||
| 18 | if (clasification === 'neutral') return 'faceMeh'; | ||
| 19 | if (clasification === 'bad') return 'faceBad'; | ||
| 20 | return ''; | ||
| 21 | } | ||
| 22 | |||
| 23 | --- | ||
| 24 | |||
| 25 | <div class="privacy-policy-wrapper"> | ||
| 26 | <div class="left"> | ||
| 27 | <h4>Privacy Policy Summary</h4> | ||
| 28 | <ul> | ||
| 29 | {priv.points.map((point) => ( | ||
| 30 | <li class={`clasification ${point.case.classification}`}> | ||
| 31 | <FontAwesome iconName={getIconName(point.case.classification)} /> | ||
| 32 | {point.title} | ||
| 33 | </li> | ||
| 34 | ))} | ||
| 35 | </ul> | ||
| 36 | </div> | ||
| 37 | <div class="right"> | ||
| 38 | <h4>Score</h4> | ||
| 39 | <div class={`rating rating-${priv.rating}`}> | ||
| 40 | <p>{priv.rating}</p> | ||
| 41 | </div> | ||
| 42 | <h4>Documents</h4> | ||
| 43 | <ul> | ||
| 44 | {priv.documents.map((document) => ( | ||
| 45 | <li class="list-item"> | ||
| 46 | <a href={document.url} target="_blank">{document.name}</a> | ||
| 47 | <div class="date-block"> | ||
| 48 | Created {formatDate(document.created_at)}, | ||
| 49 | Last modified {timeAgo(document.updated_at)} | ||
| 50 | </div> | ||
| 51 | </li> | ||
| 52 | ))} | ||
| 53 | </ul> | ||
| 54 | <h4>Domains Covered by Policy</h4> | ||
| 55 | <ul> | ||
| 56 | {priv.urls.map((url) => ( | ||
| 57 | <li>{url}</li> | ||
| 58 | ))} | ||
| 59 | </ul> | ||
| 60 | <h4>About the Data</h4> | ||
| 61 | <p>This data is kindly provided by <a href="https://tosdr.org/">tosdr.org</a></p> | ||
| 62 | <p>View the full report at: <a href={`https://tosdr.org/en/service/${priv.id}`}>tosdr.org/en/service/{priv.id}</a></p> | ||
| 63 | </div> | ||
| 64 | </div> | ||
| 65 | |||
| 66 | |||
| 67 | <style lang="scss"> | ||
| 68 | |||
| 69 | .privacy-policy-wrapper { | ||
| 70 | display: flex; | ||
| 71 | flex-wrap: wrap; | ||
| 72 | justify-content: space-between; | ||
| 73 | gap: 1rem; | ||
| 74 | .left, .right { | ||
| 75 | width: calc(50% - 1rem); | ||
| 76 | @media screen and (max-width: 768px){ | ||
| 77 | width: 100%; | ||
| 78 | } | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | h4 { | ||
| 83 | margin: 1rem 0 0 0; | ||
| 84 | font-size: 1.2rem; | ||
| 85 | } | ||
| 86 | p { | ||
| 87 | margin: 0; | ||
| 88 | display: flex; | ||
| 89 | align-items: center; | ||
| 90 | gap: 0.25rem; | ||
| 91 | :global(svg) { | ||
| 92 | width: 1rem; | ||
| 93 | } | ||
| 94 | img { | ||
| 95 | border-radius: var(--curve-sm); | ||
| 96 | } | ||
| 97 | } | ||
| 98 | li { | ||
| 99 | :global(svg) { | ||
| 100 | width: 1rem; | ||
| 101 | } | ||
| 102 | &.clasification { | ||
| 103 | &.good :global(svg) { color: #35b969; } | ||
| 104 | &.neutral :global(svg) { color: #ecd40f; } | ||
| 105 | &.bad :global(svg) { color: #e3154f; } | ||
| 106 | } | ||
| 107 | } | ||
| 108 | ul { | ||
| 109 | padding-left: 1rem; | ||
| 110 | list-style: circle; | ||
| 111 | max-height: 700px; | ||
| 112 | overflow-y: auto; | ||
| 113 | overflow-x: hidden; | ||
| 114 | img { | ||
| 115 | border-radius: var(--curve-sm); | ||
| 116 | } | ||
| 117 | .list-item { | ||
| 118 | display: flex; | ||
| 119 | flex-direction: column; | ||
| 120 | margin-bottom: 0.5rem; | ||
| 121 | .date-block { | ||
| 122 | |||
| 123 | font-size: 0.8rem; | ||
| 124 | opacity: 0.7; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | .rating { | ||
| 130 | font-size: 4rem; | ||
| 131 | width: fit-content; | ||
| 132 | padding: 0.5rem 1.5rem; | ||
| 133 | border-radius: var(--curve-lg); | ||
| 134 | border: 4px solid; | ||
| 135 | margin: 0 auto; | ||
| 136 | font-weight: bold; | ||
| 137 | |||
| 138 | &.rating-A { --rating-color: #35b969; } | ||
| 139 | &.rating-B { --rating-color: #6bb935; } | ||
| 140 | &.rating-C { --rating-color: #c7cc22; } | ||
| 141 | &.rating-D { --rating-color: #e1bb23; } | ||
| 142 | &.rating-E { --rating-color: #df8b1e; } | ||
| 143 | &.rating-F { --rating-color: #df541e; } | ||
| 144 | &.rating-G { --rating-color: #df1e1e; } | ||
| 145 | color: var(--rating-color); | ||
| 146 | border-color: var(--rating-color); | ||
| 147 | } | ||
| 148 | </style> | ||