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 @@
7070 email: solidIcons.faEnvelope,
7171 copy: solidIcons.faCopy,
7272 print: solidIcons.faPrint,
73
74 // Service link types
75 website: solidIcons.faGlobe,
76 sourceCode: solidIcons.faCodeBranch,
77 viewReport: solidIcons.faShieldHalved,
7378 };
7479
7580 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 @@
22
33
44import Layout from '@layouts/Layout.astro';
5import ServiceList from '@components/things/ServiceList.astro';
6import type { AwesomePrivacy, Section } from '../types/Service';
5import ServiceCard from '@components/things/ServiceCard.astro';
6import type { AwesomePrivacy, Section, Service } from '../types/Service';
77import { fetchData, slugify } from '@utils/fetch-data';
88import FontAwesome from '@components/form/FontAwesome.svelte';
99
@@ -14,10 +14,10 @@ const categories = (await fetchData() as AwesomePrivacy)?.categories || [];
1414<script>
1515
1616const toggleSidebar = () => {
17 const mainContent = document.querySelector('#content');
18 mainContent && mainContent.classList.toggle('narrow');
17 const intro = document.querySelector('#welcome-to-all');
1918 const sidebar = document.querySelector('.sidebar');
2019 sidebar && sidebar.classList.toggle('hidden');
20 intro && intro.classList.toggle('hidden');
2121 const button = document.querySelector('#toggle-sidebar');
2222 if (button) {
2323 button.textContent = (button.textContent === "Show Contents" ? "Hide Contents" : "Show Contents");
@@ -34,31 +34,24 @@ const toggleSidebar = () => {
3434 <main>
3535 <div id="content">
3636 <button id="toggle-sidebar">Show Contents</button>
37 {categories.map((category) => (
38 <h2 id={`${slugify(category.name)}`}>
39 <FontAwesome iconName={slugify(category.name)} />
40 <a href={`/${slugify(category.name)}`}>{category.name}</a>
41 </h2>
42
43 <article>
44 {category.sections.map((section: Section) => (
45 <section class="card">
46 <h3 id={`${slugify(category.name)}-${slugify(section.name)}`}>
47 <a href={`/${slugify(category.name)}/${slugify(section.name)}`}>{section.name}</a>
48 </h3>
49 <ServiceList
50 services={section.services}
51 subHeading={true}
52 buttonLink={`/${slugify(category.name)}/${slugify(section.name)}`}
53 noGitHubMetrics={true}
54 sectionName={section.name}
55 categoryName={category.name}
56 />
57 </section>
58 ))}
59 </article>
60
61 ))}
37 <div id="welcome-to-all" class="hidden">
38 <p>
39 Welcome to <a href="/">Awesome Privacy</a>!
40 Here you'll find a summerized collection of all verified services we have listed.
41 <br /><br />
42 Click a section or category heading, to view more listings and privacy tips in that group,
43 or a service title to view it's complete privacy report
44 <br /><br />
45 Looking for something specific? Try the <a href="/search">Search</a> page, or take a
46 scroll through the <a href="/sitemap">Sitemap</a>
47 <br /><br />
48 If you want to make an edit, removal or submit an addition, then either click
49 the Edit button within any sub-page, or visit our <a href="/about">About</a> page
50 <br /><br />
51 This project, all it's data as well as source code is freely availible
52 on <a href="https://github.com/lissy93/awesome-privacy">GitHub</a>,
53 licensed under MIT, (C) <a href="https://aliciasykes.com">Alicia Sykes</a> 2024
54 </p>
6255 </div>
6356 <div class="sidebar hidden">
6457 <p class="sidebar-title">Contents</p>
@@ -79,6 +72,37 @@ const toggleSidebar = () => {
7972 ))}
8073 </ul>
8174 </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>
82106 </main>
83107
84108</Layout>
@@ -86,23 +110,36 @@ const toggleSidebar = () => {
86110<style lang="scss">
87111
88112main {
89 margin: 2rem auto;
113 margin: 0 auto 2rem auto;
90114 padding: 1rem;
91 width: 1000px;
115 width: 1200px;
92116 max-width: calc(100% - 5rem);
93117
94118 display: flex;
95119 justify-content: space-between;
96120}
97121
98.narrow {
99 width: 70%;
100}
122// .narrow {
123// width: 70%;
124// }
101125
102126.hidden {
103127 display: none;
104128}
105129
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
106143#toggle-sidebar {
107144 // float: right;
108145 background: none;
@@ -114,31 +151,26 @@ main {
114151 }
115152}
116153
154
117155.sidebar {
118 width: 25%;
119 height: 87vh;
120 overflow: scroll;
121 position: fixed;
122 right: 1rem;
123156 border-radius: var(--curve-md);
124157 .sidebar-title {
125 text-align: center;
126158 font-size: 1.6rem;
127 margin: 0;
128159 background: var(--accent-3);
129160 color: var(--accent-fg);
130161 border: 2px solid var(--foreground);
131162 box-shadow: 6px 6px 0 var(--foreground);
132163 border-radius: var(--curve-sm);
133 margin: 0 1rem;
164 margin: 1rem auto;
165 text-align: center;
134166 }
135167 ul {
136168 list-style: none;
137169 padding-left: 1.6rem;
170 column-width: 16rem;
138171 a {
139172 text-decoration: none;
140173 color: var(--foreground);
141 opacity: 0.6;
142174 transition: all 0.18s ease-in-out;
143175 &:hover {
144176 color: var(--accent);
@@ -158,6 +190,13 @@ main {
158190 }
159191}
160192
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}
161200
162201.card {
163202 margin: 2rem auto 5rem auto;
@@ -168,7 +207,7 @@ main {
168207}
169208
170209h2 {
171 margin: 0;
210 margin: 2rem auto 0 auto;
172211 font-size: 3rem;
173212 text-align: center;
174213 opacity: 0.6;
@@ -189,7 +228,7 @@ h2 {
189228
190229h3 {
191230 font-size: 2rem;
192 margin: -2rem 0 2rem -4rem;
231 margin: 2rem 0 1rem 0;
193232 box-shadow: 6px 6px 0 var(--foreground);
194233 background: var(--accent);
195234 color: var(--accent-fg);
@@ -202,5 +241,25 @@ h3 {
202241 }
203242 }
204243
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
205264
206265</style>
web/src/pages/api/line-numbers.json.ts +3 −3
@@ -57,11 +57,11 @@ const convertJsonIntoYaml = (service: Service): string => {
5757 */
5858const makeResults = (yamlObject: AwesomePrivacy, yamlLines: string[]): LineNumberData => {
5959 const organizedData: LineNumberData = {};
60 yamlObject.categories.forEach((category) => {
60 (yamlObject.categories || []).forEach((category) => {
6161 organizedData[category.name] = {};
62 category.sections.forEach((section) => {
62 (category.sections || []).forEach((section) => {
6363 organizedData[category.name][section.name] = {};
64 section.services.forEach((service) => {
64 (section.services || []).forEach((service) => {
6565 organizedData[category.name][section.name][service.name] = {
6666 lineNumbers: calculateServiceRange(service, category, yamlLines),
6767 yaml: convertJsonIntoYaml(service),
web/src/pages/browse.astro +1 −1
@@ -19,7 +19,7 @@ const categories: Category[] = (await fetchData())?.categories;
1919 <p id="press-enter-msg" class="press-enter">Press enter for deep search</p>
2020 </span>
2121</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>
2323
2424<ul class="categories">
2525 {categories.map((category) => (