|
1 | 1 | <script setup> |
2 | 2 | import { toFormattedFileSize } from "../../helper/toFormattedFileSize"; |
| 3 | +import { useData } from "vitepress"; |
3 | 4 | import VPLink from "../vite/VPLink.vue"; |
4 | 5 |
|
5 | | -defineProps(["module", "params"]); |
| 6 | +const props = defineProps(["module", "params"]); |
| 7 | +
|
| 8 | +const { lang } = useData(); |
| 9 | +
|
| 10 | +const timestamp = props.module.timestamp; |
| 11 | +const params = props.params; |
| 12 | +const module = props.module; |
| 13 | +
|
| 14 | +const getLastUpdated = () => { |
| 15 | + if (!timestamp) { |
| 16 | + return "Invalid date"; |
| 17 | + } |
| 18 | +
|
| 19 | + return Intl.DateTimeFormat(lang, { |
| 20 | + year: "numeric", |
| 21 | + day: "2-digit", |
| 22 | + month: "short", |
| 23 | + hour12: true, |
| 24 | + }).format(new Date(timestamp * 1000)); |
| 25 | +}; |
6 | 26 | </script> |
7 | 27 |
|
8 | 28 | <template> |
9 | 29 | <VPLink decoration="none" :href="'repository/' + params.name + '/' + module.id"> |
10 | 30 | <div :class="$style.feature"> |
11 | | - <article :class="$style.box"> |
12 | | - <h2 :class="$style.title" :id="module.id">{{ module.name }}</h2> |
13 | | - <span :class="$style.author">{{ module.version }} ({{ module.versionCode }}) by {{ module.author }}</span> |
14 | | - <span :class="$style.details">{{ module.description }}</span> |
15 | | - <div :class="$style.actionsContainer"> |
16 | | - <Badge v-if="module.size" type="info" :text="toFormattedFileSize(module.size)" /> |
17 | | - <Badge v-if="module.categories" type="info" :text="module.categories[0]" /> |
18 | | - <Badge v-if="module.track.antifeatures" type="danger" text="Anti-Features" /> |
19 | | - </div> |
| 31 | + <article> |
| 32 | + <img v-if="module.cover" :style="{ borderRadius: '12px 12px 0px 0px' }" :src="module.cover" /> |
| 33 | + <article :class="$style.box"> |
| 34 | + <h2 :class="$style.title" :id="module.id">{{ module.name }}</h2> |
| 35 | + <span :class="$style.author">{{ module.version }} ({{ module.versionCode }}) by {{ module.author }}</span> |
| 36 | + <span :class="$style.details">{{ module.description }}</span> |
| 37 | + <ul :class="$style.moduleMetaContainer"> |
| 38 | + <li :class="$style.moduleMeta" v-if="module.size"> |
| 39 | + <svg :class="$style.moduleMetaIcon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> |
| 40 | + <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"> |
| 41 | + <path d="M6 20.735A2 2 0 0 1 5 19V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2h-1" /> |
| 42 | + <path |
| 43 | + d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2m0-12h-1m3 2h-1m-1 2h-1m3 2h-1m-1 2h-1m3 2h-1" |
| 44 | + /> |
| 45 | + </g> |
| 46 | + </svg> |
| 47 | + {{ toFormattedFileSize(module.size) }} |
| 48 | + </li> |
| 49 | + <li :class="$style.moduleMeta" v-if="module.categories"> |
| 50 | + <svg :class="$style.moduleMetaIcon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> |
| 51 | + <path |
| 52 | + fill="none" |
| 53 | + stroke="currentColor" |
| 54 | + stroke-linecap="round" |
| 55 | + stroke-linejoin="round" |
| 56 | + stroke-width="2" |
| 57 | + d="M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 3a3 3 0 1 0 6 0a3 3 0 1 0-6 0" |
| 58 | + /> |
| 59 | + </svg> |
| 60 | + {{ module.categories[0] }} |
| 61 | + </li> |
| 62 | + <li :class="$style.moduleMeta" v-if="module.track.antifeatures"> |
| 63 | + <svg :class="$style.moduleMetaIcon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> |
| 64 | + <path |
| 65 | + fill="none" |
| 66 | + stroke="currentColor" |
| 67 | + stroke-linecap="round" |
| 68 | + stroke-linejoin="round" |
| 69 | + stroke-width="2" |
| 70 | + d="M12 9v4m-1.637-9.409L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0zM12 16h.01" |
| 71 | + /> |
| 72 | + </svg> |
| 73 | + Anti-Features |
| 74 | + </li> |
| 75 | + <li :class="$style.moduleMeta" v-if="module.timestamp"> |
| 76 | + <svg :class="$style.moduleMetaIcon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> |
| 77 | + <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"> |
| 78 | + <path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0" /> |
| 79 | + <path d="M12 7v5l3 3" /> |
| 80 | + </g> |
| 81 | + </svg> |
| 82 | + {{ getLastUpdated() }} |
| 83 | + </li> |
| 84 | + </ul> |
| 85 | + </article> |
20 | 86 | </article> |
21 | 87 | </div> |
22 | 88 | </VPLink> |
@@ -69,11 +135,26 @@ defineProps(["module", "params"]); |
69 | 135 | color: var(--vp-c-text-2); |
70 | 136 | } |
71 | 137 |
|
72 | | -.actionsContainer { |
| 138 | +.moduleMeta { |
| 139 | + align-items: center; |
| 140 | + align-self: end; |
73 | 141 | display: flex; |
74 | | - flex-wrap: wrap; |
75 | | - margin: -8px; |
76 | | - padding-top: 20px; |
77 | | - gap: 4px; |
| 142 | + line-height: 20px; |
| 143 | + word-break: break-word; |
| 144 | +} |
| 145 | +
|
| 146 | +.moduleMetaIcon { |
| 147 | + flex-shrink: 0; |
| 148 | + width: 20px; |
| 149 | + line-height: 20px; |
| 150 | + margin-right: 4px; |
| 151 | + height: 20px; |
| 152 | +} |
| 153 | +
|
| 154 | +.moduleMetaContainer { |
| 155 | + color: var(--vp-c-text-3); |
| 156 | + margin: 0px !important; |
| 157 | + padding: 0px !important; |
| 158 | + padding-top: 20px !important; |
78 | 159 | } |
79 | 160 | </style> |
0 commit comments