Commit 653d2bc6db

653d2bc6db56b7ddd00186cc191fe6320121b6ff

parent: 2d7fdcfc82

Unsigned

Alicia Sykes <alicia@omg.lol> · 2024-03-23 00:40 UTC

Built new View All page

Layout: unified · split

web/src/components/form/FontAwesome.svelte +5
@@ -70,6 +70,11 @@
70 email: solidIcons.faEnvelope, 70 email: solidIcons.faEnvelope,
71 copy: solidIcons.faCopy, 71 copy: solidIcons.faCopy,
72 print: solidIcons.faPrint, 72 print: solidIcons.faPrint,
73
74 // Service link types
75 website: solidIcons.faGlobe,
76 sourceCode: solidIcons.faCodeBranch,
77 viewReport: solidIcons.faShieldHalved,
73 }; 78 };
74 79
75 export let iconName: string; 80 export let iconName: string;
web/src/components/things/ServiceCard.astro added +187
@@ -0,0 +1,187 @@
1---
2
3import Button from '@components/form/Button.astro';
4import { parseMarkdown, formatLink } from '@utils/parse-markdown';
5import type { Service } from 'src/types/Service';
6import FontAwesome from '@components/form/FontAwesome.svelte';
7import DeleteListing from '@components/things/DeleteListing.svelte';
8import { slugify } from '@utils/fetch-data';
9
10import GitHubMetrics from '@components/things/ItemGitHubMetrics.astro';
11
12interface Props {
13 service: Service;
14 categoryName: string;
15 sectionName: string;
16}
17
18const {
19 service,
20 sectionName,
21 categoryName,
22} = Astro.props;
23
24---
25
26<script>
27 document.addEventListener('DOMContentLoaded', () => {
28 const serviceIcons = document.querySelectorAll<HTMLImageElement>('.service-icon');
29 const broke = '/broken-image.png';
30
31 serviceIcons.forEach(function(icon) {
32 icon.onerror = function() {
33 const imgElement = this as HTMLImageElement;
34 const serviceUrl = imgElement.getAttribute('data-service-url');
35 const newSrcAttribute = (imgElement.src.includes('on.ho') ? broke : `https://icon.horse/icon/${serviceUrl}`);
36 imgElement.src = imgElement.src !== newSrcAttribute ? newSrcAttribute : broke;
37 imgElement.onerror = null;
38 };
39 });
40});
41</script>
42
43
44
45<div class="service" id={slugify(service.name)}>
46 <!-- <DeleteListing client:load categoryName={categoryName} sectionName={sectionName} serviceName={service.name} /> -->
47 <div class="service-head">
48 <a class="service-title" href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`}>
49 <h4>{service.name}</h4>
50 </a>
51 {service.followWith && <p class="follow-with">({service.followWith})</p> }
52 </div>
53
54 <div class="service-body">
55 <img
56 width="40"
57 height="40"
58 loading="lazy"
59 decoding="async"
60 class="service-icon"
61 alt={`${service.name} Icon`}
62 data-service-url={formatLink(service.url)}
63 src={service.icon || `https://icon.horse/icon/${formatLink(service.url)}`}
64 />
65 <div class="service-body">
66 <p set:html={service.description}></p>
67 </div>
68 </div>
69
70 <div class="service-links">
71 <a class="link" href={service.url}>
72 <FontAwesome iconName="website"/> <span>{formatLink(service.url)}</span>
73 </a>
74 {service.github &&
75 <a class="link" href={`https://github.com/${service.github}`}>
76 <FontAwesome iconName="sourceCode"/> GitHub
77 </a>
78 }
79 <a href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`}>
80 <FontAwesome iconName="viewReport" /> View Report
81 </a>
82
83 </div>
84 </div>
85
86
87<style lang="scss">
88.service {
89 display: flex;
90 flex-direction: column;
91 padding: 1rem;
92 border: 2px solid var(--foreground);
93 box-shadow: 6px 6px 0 var(--foreground);
94 background: var(--accent-fg);
95 border-radius: var(--curve-sm);
96
97 .service-head {
98 display: flex;
99 align-items: center;
100 gap: 0.5rem;
101 h4 {
102 margin: 0;
103 font-size: 1.4rem;
104 color: var(--foreground);
105 }
106 p {
107 margin: 0;
108 font-size: 1rem;
109 opacity: 0.7;
110 }
111 a {
112 text-decoration: none;
113 }
114 h4 {
115 text-decoration: none;
116 position: relative;
117 &:after {
118 background: none repeat scroll 0 0 transparent;
119 bottom: 0;
120 content: "";
121 display: block;
122 height: 3px;
123 left: 50%;
124 position: absolute;
125 background: var(--accent-3);
126 transition: width 0.2s ease 0s, left 0.2s ease 0s;
127 width: 0;
128 }
129 &:hover:after {
130 width: 100%;
131 left: 0;
132 }
133 }
134 }
135
136 .service-body {
137 display: flex;
138 align-items: center;
139 gap: 0.5rem;
140 img {
141 border-radius: var(--curve-sm);
142 }
143 :global(p) {
144 display: -webkit-box;
145 -webkit-line-clamp: 3;
146 -webkit-box-orient: vertical;
147 overflow: hidden;
148 margin: 0.5rem 0;
149 }
150 }
151
152 .service-links {
153 display: flex;
154 gap: 0.5rem;
155 justify-content: space-between;
156 a {
157 color: var(--accent-3);
158 font-size: 0.8rem;
159 display: inline-flex;
160 align-items: center;
161 gap: 0.25rem;
162 opacity: 0.7;
163 text-decoration: none;
164 max-width: 50%;
165 min-width: 25%;
166 &:not(:last-child) {
167 margin-right: 0.5rem;
168 }
169 &:hover {
170 text-decoration: underline;
171 opacity: 0.8;
172 }
173 :global(svg) {
174 width: 1rem;
175 height: 1rem;
176 }
177 span {
178 max-width: calc(100% - 1rem);
179 text-overflow: ellipsis;
180 white-space: nowrap;
181 overflow: hidden;
182 }
183 }
184 }
185}
186
187</style>
web/src/pages/all.astro +104 −45
@@ -2,8 +2,8 @@
2 2
3 3
4import Layout from '@layouts/Layout.astro'; 4import Layout from '@layouts/Layout.astro';
5import ServiceList from '@components/things/ServiceList.astro'; 5import ServiceCard from '@components/things/ServiceCard.astro';
6import type { AwesomePrivacy, Section } from '../types/Service'; 6import type { AwesomePrivacy, Section, Service } from '../types/Service';
7import { fetchData, slugify } from '@utils/fetch-data'; 7import { fetchData, slugify } from '@utils/fetch-data';
8import FontAwesome from '@components/form/FontAwesome.svelte'; 8import FontAwesome from '@components/form/FontAwesome.svelte';
9 9
@@ -14,10 +14,10 @@ const categories = (await fetchData() as AwesomePrivacy)?.categories || [];
14<script> 14<script>
15 15
16const toggleSidebar = () => { 16const toggleSidebar = () => {
17 const mainContent = document.querySelector('#content'); 17 const intro = document.querySelector('#welcome-to-all');
18 mainContent && mainContent.classList.toggle('narrow');
19 const sidebar = document.querySelector('.sidebar'); 18 const sidebar = document.querySelector('.sidebar');
20 sidebar && sidebar.classList.toggle('hidden'); 19 sidebar && sidebar.classList.toggle('hidden');
20 intro && intro.classList.toggle('hidden');
21 const button = document.querySelector('#toggle-sidebar'); 21 const button = document.querySelector('#toggle-sidebar');
22 if (button) { 22 if (button) {
23 button.textContent = (button.textContent === "Show Contents" ? "Hide Contents" : "Show Contents"); 23 button.textContent = (button.textContent === "Show Contents" ? "Hide Contents" : "Show Contents");
@@ -34,31 +34,24 @@ const toggleSidebar = () => {
34 <main> 34 <main>
35 <div id="content"> 35 <div id="content">
36 <button id="toggle-sidebar">Show Contents</button> 36 <button id="toggle-sidebar">Show Contents</button>
37 {categories.map((category) => ( 37 <div id="welcome-to-all" class="hidden">
38 <h2 id={`${slugify(category.name)}`}> 38 <p>
39 <FontAwesome iconName={slugify(category.name)} /> 39 Welcome to <a href="/">Awesome Privacy</a>!
40 <a href={`/${slugify(category.name)}`}>{category.name}</a> 40 Here you'll find a summerized collection of all verified services we have listed.
41 </h2> 41 <br /><br />
42 42 Click a section or category heading, to view more listings and privacy tips in that group,
43 <article> 43 or a service title to view it's complete privacy report
44 {category.sections.map((section: Section) => ( 44 <br /><br />
45 <section class="card"> 45 Looking for something specific? Try the <a href="/search">Search</a> page, or take a
46 <h3 id={`${slugify(category.name)}-${slugify(section.name)}`}> 46 scroll through the <a href="/sitemap">Sitemap</a>
47 <a href={`/${slugify(category.name)}/${slugify(section.name)}`}>{section.name}</a> 47 <br /><br />
48 </h3> 48 If you want to make an edit, removal or submit an addition, then either click
49 <ServiceList 49 the Edit button within any sub-page, or visit our <a href="/about">About</a> page
50 services={section.services} 50 <br /><br />
51 subHeading={true} 51 This project, all it's data as well as source code is freely availible
52 buttonLink={`/${slugify(category.name)}/${slugify(section.name)}`} 52 on <a href="https://github.com/lissy93/awesome-privacy">GitHub</a>,
53 noGitHubMetrics={true} 53 licensed under MIT, (C) <a href="https://aliciasykes.com">Alicia Sykes</a> 2024
54 sectionName={section.name} 54 </p>
55 categoryName={category.name}
56 />
57 </section>
58 ))}
59 </article>
60
61 ))}
62 </div> 55 </div>
63 <div class="sidebar hidden"> 56 <div class="sidebar hidden">
64 <p class="sidebar-title">Contents</p> 57 <p class="sidebar-title">Contents</p>
@@ -79,6 +72,37 @@ const toggleSidebar = () => {
79 ))} 72 ))}
80 </ul> 73 </ul>
81 </div> 74 </div>
75 {categories.map((category) => (
76 <h2 id={`${slugify(category.name)}`}>
77 <FontAwesome iconName={slugify(category.name)} />
78 <a href={`/${slugify(category.name)}`}>{category.name}</a>
79 </h2>
80
81 <article>
82 {category.sections.map((section: Section) => (
83 <h3 id={`${slugify(category.name)}-${slugify(section.name)}`}>
84 <a href={`/${slugify(category.name)}/${slugify(section.name)}`}>{section.name}</a>
85 </h3>
86 <section class="section">
87 { section.services.map((service: Service) => (
88 <ServiceCard service={service} sectionName={section.name} categoryName={category.name}/>
89 ))}
90 </section>
91 <div>
92 {!section || !section.services || section.services.length === 0 ? (
93 <div class="nothing-yet">
94 <p>
95 <strong>⚠️ This section is still a work in progress ⚠️</strong><br />
96 Check back soon, or help us complete it by submiting a pull request on GitHub.
97 </p>
98 </div>
99 ) : null}
100 </div>
101 ))}
102 </article>
103
104 ))}
105 </div>
82 </main> 106 </main>
83 107
84</Layout> 108</Layout>
@@ -86,23 +110,36 @@ const toggleSidebar = () => {
86<style lang="scss"> 110<style lang="scss">
87 111
88main { 112main {
89 margin: 2rem auto; 113 margin: 0 auto 2rem auto;
90 padding: 1rem; 114 padding: 1rem;
91 width: 1000px; 115 width: 1200px;
92 max-width: calc(100% - 5rem); 116 max-width: calc(100% - 5rem);
93 117
94 display: flex; 118 display: flex;
95 justify-content: space-between; 119 justify-content: space-between;
96} 120}
97 121
98.narrow { 122// .narrow {
99 width: 70%; 123// width: 70%;
100} 124// }
101 125
102.hidden { 126.hidden {
103 display: none; 127 display: none;
104} 128}
105 129
130#content {
131 margin: 0 auto;
132}
133
134#welcome-to-all {
135 text-align: justify;
136 width: 600px;
137 margin: 0 auto;
138 background: #ffffff4d;
139 padding: 1rem;
140 border-radius: var(--curve-sm);
141}
142
106#toggle-sidebar { 143#toggle-sidebar {
107 // float: right; 144 // float: right;
108 background: none; 145 background: none;
@@ -114,31 +151,26 @@ main {
114 } 151 }
115} 152}
116 153
154
117.sidebar { 155.sidebar {
118 width: 25%;
119 height: 87vh;
120 overflow: scroll;
121 position: fixed;
122 right: 1rem;
123 border-radius: var(--curve-md); 156 border-radius: var(--curve-md);
124 .sidebar-title { 157 .sidebar-title {
125 text-align: center;
126 font-size: 1.6rem; 158 font-size: 1.6rem;
127 margin: 0;
128 background: var(--accent-3); 159 background: var(--accent-3);
129 color: var(--accent-fg); 160 color: var(--accent-fg);
130 border: 2px solid var(--foreground); 161 border: 2px solid var(--foreground);
131 box-shadow: 6px 6px 0 var(--foreground); 162 box-shadow: 6px 6px 0 var(--foreground);
132 border-radius: var(--curve-sm); 163 border-radius: var(--curve-sm);
133 margin: 0 1rem; 164 margin: 1rem auto;
165 text-align: center;
134 } 166 }
135 ul { 167 ul {
136 list-style: none; 168 list-style: none;
137 padding-left: 1.6rem; 169 padding-left: 1.6rem;
170 column-width: 16rem;
138 a { 171 a {
139 text-decoration: none; 172 text-decoration: none;
140 color: var(--foreground); 173 color: var(--foreground);
141 opacity: 0.6;
142 transition: all 0.18s ease-in-out; 174 transition: all 0.18s ease-in-out;
143 &:hover { 175 &:hover {
144 color: var(--accent); 176 color: var(--accent);
@@ -158,6 +190,13 @@ main {
158 } 190 }
159} 191}
160 192
193.section {
194 display: grid;
195 grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
196 gap: 1rem;
197 width: 100%;
198 margin: 0 auto;
199}
161 200
162.card { 201.card {
163 margin: 2rem auto 5rem auto; 202 margin: 2rem auto 5rem auto;
@@ -168,7 +207,7 @@ main {
168} 207}
169 208
170h2 { 209h2 {
171 margin: 0; 210 margin: 2rem auto 0 auto;
172 font-size: 3rem; 211 font-size: 3rem;
173 text-align: center; 212 text-align: center;
174 opacity: 0.6; 213 opacity: 0.6;
@@ -189,7 +228,7 @@ h2 {
189 228
190h3 { 229h3 {
191 font-size: 2rem; 230 font-size: 2rem;
192 margin: -2rem 0 2rem -4rem; 231 margin: 2rem 0 1rem 0;
193 box-shadow: 6px 6px 0 var(--foreground); 232 box-shadow: 6px 6px 0 var(--foreground);
194 background: var(--accent); 233 background: var(--accent);
195 color: var(--accent-fg); 234 color: var(--accent-fg);
@@ -202,5 +241,25 @@ h3 {
202 } 241 }
203 } 242 }
204 243
244 .nothing-yet {
245 width: 80vw;
246 margin: 0 auto;
247 background: var(--accent-fg);
248 border: 2px solid var(--foreground);
249 box-shadow: 6px 6px 0 var(--foreground);
250 border-radius: var(--curve-sm);
251
252 display: flex;
253 width: 80vw;
254 max-width: 28rem;
255 p {
256 font-size: 1.2rem;
257 opacity: 0.8;
258 font-style: italic;
259 text-align: center;
260 margin-bottom: 3rem;
261 }
262 }
263
205 264
206</style> 265</style>
web/src/pages/api/line-numbers.json.ts +3 −3
@@ -57,11 +57,11 @@ const convertJsonIntoYaml = (service: Service): string => {
57 */ 57 */
58const makeResults = (yamlObject: AwesomePrivacy, yamlLines: string[]): LineNumberData => { 58const makeResults = (yamlObject: AwesomePrivacy, yamlLines: string[]): LineNumberData => {
59 const organizedData: LineNumberData = {}; 59 const organizedData: LineNumberData = {};
60 yamlObject.categories.forEach((category) => { 60 (yamlObject.categories || []).forEach((category) => {
61 organizedData[category.name] = {}; 61 organizedData[category.name] = {};
62 category.sections.forEach((section) => { 62 (category.sections || []).forEach((section) => {
63 organizedData[category.name][section.name] = {}; 63 organizedData[category.name][section.name] = {};
64 section.services.forEach((service) => { 64 (section.services || []).forEach((service) => {
65 organizedData[category.name][section.name][service.name] = { 65 organizedData[category.name][section.name][service.name] = {
66 lineNumbers: calculateServiceRange(service, category, yamlLines), 66 lineNumbers: calculateServiceRange(service, category, yamlLines),
67 yaml: convertJsonIntoYaml(service), 67 yaml: convertJsonIntoYaml(service),
web/src/pages/browse.astro +1 −1
@@ -19,7 +19,7 @@ const categories: Category[] = (await fetchData())?.categories;
19 <p id="press-enter-msg" class="press-enter">Press enter for deep search</p> 19 <p id="press-enter-msg" class="press-enter">Press enter for deep search</p>
20 </span> 20 </span>
21</div> 21</div>
22<p class="sitemap-link">Or, <a href="/sitemap">view all pages</a></p> 22<p class="sitemap-link">You can also view <a href="/sitemap">all pages</a> or <a href="/all">all listings</a></p>
23 23
24<ul class="categories"> 24<ul class="categories">
25 {categories.map((category) => ( 25 {categories.map((category) => (