| @@ -0,0 +1,249 @@ |
| 1 | --- |
| 2 | |
| 3 | import type { IoSApiResponse } from '@utils/fetch-ios-info'; |
| 4 | import { formatDate, timeAgo } from '@utils/dates-n-stuff'; |
| 5 | import FontAwesome from "@components/form/FontAwesome.svelte" |
| 6 | |
| 7 | |
| 8 | interface Props { |
| 9 | iosData: IoSApiResponse; |
| 10 | url: string; |
| 11 | }; |
| 12 | |
| 13 | const { iosData, url } = Astro.props; |
| 14 | |
| 15 | const bytesToMb = (bytes: number) => (bytes / 1024 / 1024).toFixed(2); |
| 16 | |
| 17 | const makeRatingPercentage = (rating: number) => (rating / 5) * 100; |
| 18 | |
| 19 | const roundRatings = (rating: number) => Math.round(rating * 100) / 100; |
| 20 | |
| 21 | const 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 | |
| 136 | h4 { |
| 137 | margin: 1rem 0 0 0; |
| 138 | font-size: 1.2rem; |
| 139 | } |
| 140 | p { |
| 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 | |
| 153 | ul { |
| 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> |