Commit f6db947345
f6db947345a9b6a0960138e05f79412ee18b1279
parent: b39613b6eb
Unsigned
Duck <57977673+woducku@users.noreply.github.com> · 2026-10-22 13:02 UTC
ext count
Layout: unified · split
docs/.vitepress/theme/components/extrepo/RepoRow.vue
+26
| @@ -1,6 +1,7 @@ |
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { computed, ref } from 'vue' |
| 3 | 3 | import { NOT_EXPANDABLE_REPOS } from './constants' |
| 4 | import { groupSites } from './groupSites' |
| 4 | 5 | import { stripHtml } from './helpers' |
| 5 | 6 | import { |
| 6 | 7 | copyValue, |
| @@ -37,6 +38,26 @@ const sites = computed(() => { |
| 37 | 38 | const all = repoData.value[dataUrl]?.sites ?? [] |
| 38 | 39 | return props.showBroken ? all : all.filter(site => !site.isBroken) |
| 39 | 40 | }) |
| 41 | const siteCount = computed(() => { |
| 42 | const countFor = (url: string | null | undefined) => { |
| 43 | const all = url ? repoData.value[url]?.sites ?? [] : [] |
| 44 | const visible = props.showBroken |
| 45 | ? all |
| 46 | : all.filter(site => !site.isBroken) |
| 47 | return groupSites(visible).length |
| 48 | } |
| 49 | if (props.repo.variants?.length) { |
| 50 | return props.repo.variants.reduce( |
| 51 | (total, variant) => total + countFor(mangayomiCopyValue(variant)), |
| 52 | 0 |
| 53 | ) |
| 54 | } |
| 55 | return countFor(props.repo.data ?? props.repo.indexUrl) |
| 56 | }) |
| 57 | const siteCountTitle = computed( |
| 58 | () => |
| 59 | `${siteCount.value} extension${siteCount.value === 1 ? '' : 's'} available` |
| 60 | ) |
| 40 | 61 | const repoName = computed(() => stripHtml(props.repo.name)) |
| 41 | 62 | const isExpandable = computed(() => !NOT_EXPANDABLE_REPOS.has(repoName.value)) |
| 42 | 63 | const installUrl = computed(() => |
| @@ -83,6 +104,11 @@ async function copyHeaderVariantUrl() { |
| 83 | 104 | <div class="ext-repo-row"> |
| 84 | 105 | <div class="ext-repo-name"> |
| 85 | 106 | <span v-html="repo.name" /> |
| 107 | <span |
| 108 | v-if="siteCount" |
| 109 | class="ext-repo-count" |
| 110 | :title="siteCountTitle" |
| 111 | >{{ siteCount }}</span> |
| 86 | 112 | <VTooltip v-if="repo.note" theme="vp-tooltip"> |
| 87 | 113 | <button type="button" class="ext-note-btn" aria-label="Note"> |
| 88 | 114 | <span class="i-lucide:lightbulb" /> |
docs/.vitepress/theme/components/extrepo/RepoVariantRow.vue
+17 −1
| @@ -1,5 +1,6 @@ |
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { computed, ref } from 'vue' |
| 3 | import { groupSites } from './groupSites' |
| 3 | 4 | import { |
| 4 | 5 | mangayomiCopyValue, |
| 5 | 6 | mangayomiHref, |
| @@ -37,6 +38,11 @@ const sites = computed(() => { |
| 37 | 38 | const all = url ? repoData.value[url]?.sites ?? [] : [] |
| 38 | 39 | return props.showBroken ? all : all.filter(site => !site.isBroken) |
| 39 | 40 | }) |
| 41 | const siteCount = computed(() => groupSites(sites.value).length) |
| 42 | const siteCountTitle = computed( |
| 43 | () => |
| 44 | `${siteCount.value} extension${siteCount.value === 1 ? '' : 's'} available` |
| 45 | ) |
| 40 | 46 | |
| 41 | 47 | async function copyVariantUrl() { |
| 42 | 48 | if (!copyValue.value) return |
| @@ -47,7 +53,14 @@ async function copyVariantUrl() { |
| 47 | 53 | <template> |
| 48 | 54 | <div class="ext-repo-variant"> |
| 49 | 55 | <div class="ext-repo-variant-row"> |
| 50 | | <span class="ext-repo-variant-label">{{ variant.label }}</span> |
| 56 | <span class="ext-repo-variant-label"> |
| 57 | {{ variant.label }} |
| 58 | <span |
| 59 | v-if="siteCount" |
| 60 | class="ext-repo-count" |
| 61 | :title="siteCountTitle" |
| 62 | >{{ siteCount }}</span> |
| 63 | </span> |
| 51 | 64 | <div class="ext-repo-actions"> |
| 52 | 65 | <template v-if="showActions"> |
| 53 | 66 | <a class="ext-btn ext-btn-install" :href="installUrl"> |
| @@ -115,6 +128,9 @@ async function copyVariantUrl() { |
| 115 | 128 | border-top: 1px solid var(--vp-c-divider); |
| 116 | 129 | } |
| 117 | 130 | .ext-repo-variant-label { |
| 131 | display: inline-flex; |
| 132 | align-items: center; |
| 133 | gap: 6px; |
| 118 | 134 | font-size: 13px; |
| 119 | 135 | color: var(--vp-c-text-2); |
| 120 | 136 | } |
docs/.vitepress/theme/components/extrepo/repoRowShared.css
+16
| @@ -4,6 +4,22 @@ |
| 4 | 4 | gap: 6px; |
| 5 | 5 | flex-shrink: 0; |
| 6 | 6 | } |
| 7 | .ext-repo-count { |
| 8 | display: inline-flex; |
| 9 | align-items: center; |
| 10 | justify-content: center; |
| 11 | min-width: 20px; |
| 12 | padding: 1px 6px; |
| 13 | border-radius: 6px; |
| 14 | border: 1px solid var(--vp-c-divider); |
| 15 | background-color: var(--vp-c-bg); |
| 16 | color: var(--vp-c-text-2); |
| 17 | font-size: 11px; |
| 18 | font-weight: 600; |
| 19 | line-height: 16px; |
| 20 | font-variant-numeric: tabular-nums; |
| 21 | flex-shrink: 0; |
| 22 | } |
| 7 | 23 | .ext-btn { |
| 8 | 24 | display: inline-flex; |
| 9 | 25 | align-items: center; |