Commit 7197fab9da

7197fab9da11aacf5545f6d07cf2b49dae99d38f

parent: 444d2426f8

Unsigned

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

Show iOS app data for a given listing

Layout: unified · split

web/src/components/form/FontAwesome.svelte +3
@@ -75,6 +75,9 @@
75 website: solidIcons.faGlobe, 75 website: solidIcons.faGlobe,
76 sourceCode: solidIcons.faCodeBranch, 76 sourceCode: solidIcons.faCodeBranch,
77 viewReport: solidIcons.faShieldHalved, 77 viewReport: solidIcons.faShieldHalved,
78
79 //Misc
80 ratingStar: solidIcons.faStar,
78 }; 81 };
79 82
80 export let iconName: string; 83 export let iconName: string;
web/src/components/things/IosAppDetailedInfo.astro added +249
@@ -0,0 +1,249 @@
1---
2
3import type { IoSApiResponse } from '@utils/fetch-ios-info';
4import { formatDate, timeAgo } from '@utils/dates-n-stuff';
5import FontAwesome from "@components/form/FontAwesome.svelte"
6
7
8interface Props {
9 iosData: IoSApiResponse;
10 url: string;
11};
12
13const { iosData, url } = Astro.props;
14
15const bytesToMb = (bytes: number) => (bytes / 1024 / 1024).toFixed(2);
16
17const makeRatingPercentage = (rating: number) => (rating / 5) * 100;
18
19const roundRatings = (rating: number) => Math.round(rating * 100) / 100;
20
21const putCommaInNumber = (num: number) => num.toLocaleString();
22
23---
24
25<div class="website-info-wrapper">
26 <div class="left">
27 <h4>App Info</h4>
28 <p class="website-title">
29 <img src={iosData.artworkUrl60} width="16" />
30 {iosData.trackName}
31 </p>
32 <p class="website-description">{iosData.description}</p>
33
34 <h4>Rating</h4>
35 <div class="star-rating">
36 <div class="back-stars">
37 <FontAwesome iconName="ratingStar" />
38 <FontAwesome iconName="ratingStar" />
39 <FontAwesome iconName="ratingStar" />
40 <FontAwesome iconName="ratingStar" />
41 <FontAwesome iconName="ratingStar" />
42 <div class="front-stars" style={`width: ${makeRatingPercentage(iosData.averageUserRating)}%`}>
43 <FontAwesome iconName="ratingStar" />
44 <FontAwesome iconName="ratingStar" />
45 <FontAwesome iconName="ratingStar" />
46 <FontAwesome iconName="ratingStar" />
47 <FontAwesome iconName="ratingStar" />
48 </div>
49 </div>
50 </div>
51 <p class="rating-description">
52 Rated {roundRatings(iosData.averageUserRating)} out of 5 stars by {putCommaInNumber(iosData.userRatingCount)} users
53 </p>
54
55 <h4>Version Info</h4>
56 <ul class="list-table">
57 <li title={iosData.releaseNotes}>
58 <span class="lbl">Current Version</span>
59 <span class="val">{iosData.version}</span>
60 </li>
61 <li>
62 <span class="lbl">Last Updated</span>
63 <span class="val">{formatDate(iosData.currentVersionReleaseDate)}</span>
64 </li>
65 <li>
66 <span class="lbl">First Released</span>
67 <span class="val">{formatDate(iosData.releaseDate)}</span>
68 </li>
69 <li>
70 <span class="lbl">Minimum iOS Version</span>
71 <span class="val">{iosData.minimumOsVersion}</span>
72 </li>
73 <li>
74 <span class="lbl">Device Models Supported</span>
75 <span class="val">{iosData.supportedDevices.length}</span>
76 </li>
77 </ul>
78 </div>
79 <div class="right">
80
81 <h4>App Details</h4>
82 <ul class="list-table">
83 <li>
84 <span class="lbl">IPA Size</span>
85 <span class="val">{bytesToMb(iosData.fileSizeBytes)} Mb</span>
86 </li>
87 <li>
88 <span class="lbl">Price</span>
89 <span class="val">{iosData.formattedPrice} ({iosData.currency})</span>
90 </li>
91 <li>
92 <span class="lbl">Age Advisory</span>
93 <span class="val">{iosData.contentAdvisoryRating}</span>
94 </li>
95 <li>
96 <span class="lbl">Supported Languages</span>
97 <span class="val" title={iosData.languageCodesISO2A.join(', ')}>{iosData.languageCodesISO2A.length}</span>
98 </li>
99 <li>
100 <span class="lbl">Developer</span>
101 <span class="val"><a href={iosData.artistViewUrl}>{iosData.sellerName}</a></span>
102 </li>
103 <li>
104 <span class="lbl">Bundle ID</span>
105 <span class="val">{iosData.bundleId}</span>
106 </li>
107 </ul>
108
109 <h4>Screenshots</h4>
110 <ul class="screenshots">
111 {iosData.screenshotUrls.map((url) => (
112 <li>
113 <img src={url} width="100" />
114 </li>
115 ))}
116 </ul>
117
118 </div>
119</div>
120
121
122<style lang="scss">
123.website-info-wrapper {
124 display: flex;
125 flex-wrap: wrap;
126 justify-content: space-between;
127 gap: 1rem;
128 .left, .right {
129 width: calc(50% - 1rem);
130 @media screen and (max-width: 768px){
131 width: 100%;
132 }
133 }
134}
135
136h4 {
137 margin: 1rem 0 0 0;
138 font-size: 1.2rem;
139}
140p {
141 margin: 0;
142 display: flex;
143 align-items: center;
144 gap: 0.25rem;
145 :global(svg) {
146 width: 1rem;
147 }
148 img {
149 border-radius: var(--curve-sm);
150 }
151}
152
153ul {
154 padding-left: 0;
155 list-style: none;
156 max-height: 300px;
157 overflow-y: auto;
158 overflow-x: hidden;
159 img {
160 border-radius: var(--curve-sm);
161 }
162 .list-item {
163 display: flex;
164 flex-direction: column;
165 margin-bottom: 0.5rem;
166 }
167 &.list-table {
168 font-size: 0.9rem;
169 padding-left: 0;
170 li {
171 display: flex;
172 justify-content: space-between;
173 padding: 0.1rem 0;
174 .lbl {
175 font-weight: 400;
176 }
177 &:not(:last-child) {
178 border-bottom: 1px solid #5f53f440;
179 }
180 }
181 }
182}
183
184.website-title, .website-description {
185 font-size: 0.9rem;
186 opacity: 0.8;
187 display: -webkit-box;
188 -webkit-line-clamp: 1;
189 -webkit-box-orient: vertical;
190 overflow: hidden;
191 border-left: 2px solid var(--accent-3);
192 padding-left: 0.5rem;
193}
194.website-title {
195 font-weight: 500;
196}
197.website-description {
198 font-style: italic;
199 -webkit-line-clamp: 3;
200}
201.explainer {
202 font-size: 0.8rem;
203 opacity: 0.8;
204 font-style: italic;
205}
206
207.star-rating {
208 position: relative;
209 display: inline-block;
210 margin: 1rem 0;
211 :global(svg) {
212 font-size: 2rem;
213 gap: 0;
214 margin: 0;
215 padding: 0;
216 }
217 .back-stars {
218 display: flex;
219 :global(svg) {
220 color: #ddddd8;
221 }
222 .front-stars {
223 position: absolute;
224 top: 0;
225 left: 0;
226 white-space: nowrap;
227 overflow: hidden;
228 width: 0;
229 display: flex;
230 :global(svg) {
231 color: #e8e800;
232 }
233 }
234 }
235}
236
237.rating-description {
238 font-size: 0.8rem;
239 opacity: 0.8;
240 font-style: italic;
241}
242
243.screenshots {
244 display: flex;
245 gap: 0.5rem;
246 overflow-x: auto;
247}
248
249</style>
web/src/components/things/ServiceCard.astro +4 −6
@@ -1,14 +1,10 @@
1--- 1---
2 2
3import Button from '@components/form/Button.astro'; 3import { formatLink } from '@utils/parse-markdown';
4import { parseMarkdown, formatLink } from '@utils/parse-markdown';
5import type { Service } from 'src/types/Service'; 4import type { Service } from 'src/types/Service';
6import FontAwesome from '@components/form/FontAwesome.svelte'; 5import FontAwesome from '@components/form/FontAwesome.svelte';
7import DeleteListing from '@components/things/DeleteListing.svelte';
8import { slugify } from '@utils/fetch-data'; 6import { slugify } from '@utils/fetch-data';
9 7
10import GitHubMetrics from '@components/things/ItemGitHubMetrics.astro';
11
12interface Props { 8interface Props {
13 service: Service; 9 service: Service;
14 categoryName: string; 10 categoryName: string;
@@ -77,7 +73,7 @@ const {
77 </a> 73 </a>
78 } 74 }
79 <a href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`}> 75 <a href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`}>
80 <FontAwesome iconName="viewReport" /> View Report 76 <FontAwesome iconName="viewReport" /> View Report ➔
81 </a> 77 </a>
82 78
83 </div> 79 </div>
@@ -146,6 +142,8 @@ const {
146 -webkit-box-orient: vertical; 142 -webkit-box-orient: vertical;
147 overflow: hidden; 143 overflow: hidden;
148 margin: 0.5rem 0; 144 margin: 0.5rem 0;
145 width: calc(100% - 2rem);
146 overflow-x: hidden;
149 } 147 }
150 } 148 }
151 149
web/src/pages/[...listing].astro +10 −1
@@ -7,6 +7,7 @@ import GitHubDetailedInfo from '@components/things/GitHubDetailedInfo.astro';
7import PrivacyPolicyDetails from '@components/things/PrivacyPolicyDetails.astro'; 7import PrivacyPolicyDetails from '@components/things/PrivacyPolicyDetails.astro';
8import WebsiteDetailedInfo from '@components/things/WebsiteDetailedInfo.astro'; 8import WebsiteDetailedInfo from '@components/things/WebsiteDetailedInfo.astro';
9import DockerDetailedInfo from '@components/things/DockerDetailedInfo.astro'; 9import DockerDetailedInfo from '@components/things/DockerDetailedInfo.astro';
10import IosAppDetailedInfo from '@components/things/IosAppDetailedInfo.astro';
10import SocialShare from '@components/form/Social.astro'; 11import SocialShare from '@components/form/Social.astro';
11import DataActions from '@components/things/DataActions.svelte'; 12import DataActions from '@components/things/DataActions.svelte';
12import type { AwesomePrivacy, Section, Service } from '../types/Service'; 13import type { AwesomePrivacy, Section, Service } from '../types/Service';
@@ -15,6 +16,7 @@ import { fetchGitHubStats } from '@utils/fetch-repo-info';
15import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy'; 16import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy';
16import { fetchWebsiteInfo } from '@utils/fetch-website-info'; 17import { fetchWebsiteInfo } from '@utils/fetch-website-info';
17import { fetchDockerData } from '@utils/fetch-docker-instructions'; 18import { fetchDockerData } from '@utils/fetch-docker-instructions';
19import { fetchIosInfo } from '@utils/fetch-ios-info';
18import { parseMarkdown, formatLink } from '@utils/parse-markdown'; 20import { parseMarkdown, formatLink } from '@utils/parse-markdown';
19import { site } from '@utils/config'; 21import { site } from '@utils/config';
20import FontAwesome from '@components/form/FontAwesome.svelte'; 22import FontAwesome from '@components/form/FontAwesome.svelte';
@@ -32,6 +34,7 @@ const {
32 url, 34 url,
33 github, 35 github,
34 tosdrId, 36 tosdrId,
37 iosApp,
35 icon, 38 icon,
36 followWith, 39 followWith,
37 securityAudited, 40 securityAudited,
@@ -134,6 +137,7 @@ const ignoredSites = ['github.gom', 'wikipedia.'];
134// Fetch detailed data about the services GitHub repo, privacy policy and website 137// Fetch detailed data about the services GitHub repo, privacy policy and website
135const githubData = github ? await fetchGitHubStats(github) : null; 138const githubData = github ? await fetchGitHubStats(github) : null;
136const privacyData = tosdrId ? await fetchTosdrPrivacy(tosdrId) : null; 139const privacyData = tosdrId ? await fetchTosdrPrivacy(tosdrId) : null;
140const iosData = iosApp ? await fetchIosInfo(iosApp) : null;
137const dockerData = await fetchDockerData(name); 141const dockerData = await fetchDockerData(name);
138const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignoredSite))) ? await fetchWebsiteInfo(url) : null; 142const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignoredSite))) ? await fetchWebsiteInfo(url) : null;
139 143
@@ -243,13 +247,18 @@ const getApiEndpoint = () => {
243 <GitHubDetailedInfo gitHubData={githubData} repo={github} /> 247 <GitHubDetailedInfo gitHubData={githubData} repo={github} />
244 </section> 248 </section>
245 )} 249 )}
246
247 { websiteData && ( 250 { websiteData && (
248 <section> 251 <section>
249 <h3>{name} Website</h3> 252 <h3>{name} Website</h3>
250 <WebsiteDetailedInfo url={url} websiteInfo={websiteData} /> 253 <WebsiteDetailedInfo url={url} websiteInfo={websiteData} />
251 </section> 254 </section>
252 )} 255 )}
256 { iosData && (
257 <section>
258 <h3>{name} iOS App</h3>
259 <IosAppDetailedInfo url={url} iosData={iosData} />
260 </section>
261 )}
253 { dockerData && dockerData.found && ( 262 { dockerData && dockerData.found && (
254 <section> 263 <section>
255 <h3>{name} Docker</h3> 264 <h3>{name} Docker</h3>
web/src/types/Service.ts +1
@@ -17,6 +17,7 @@ export interface Service {
17 openSource?: boolean; 17 openSource?: boolean;
18 acceptsCrypto?: boolean; 18 acceptsCrypto?: boolean;
19 tosdrId?: string; 19 tosdrId?: string;
20 iosApp?: string;
20} 21}
21 22
22export interface Section { 23export interface Section {