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<script setup lang="ts"> 1<script setup lang="ts">
2import { computed, ref } from 'vue' 2import { computed, ref } from 'vue'
3import { NOT_EXPANDABLE_REPOS } from './constants' 3import { NOT_EXPANDABLE_REPOS } from './constants'
4import { groupSites } from './groupSites'
4import { stripHtml } from './helpers' 5import { stripHtml } from './helpers'
5import { 6import {
6 copyValue, 7 copyValue,
@@ -37,6 +38,26 @@ const sites = computed(() => {
37 const all = repoData.value[dataUrl]?.sites ?? [] 38 const all = repoData.value[dataUrl]?.sites ?? []
38 return props.showBroken ? all : all.filter(site => !site.isBroken) 39 return props.showBroken ? all : all.filter(site => !site.isBroken)
39}) 40})
41const 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})
57const siteCountTitle = computed(
58 () =>
59 `${siteCount.value} extension${siteCount.value === 1 ? '' : 's'} available`
60)
40const repoName = computed(() => stripHtml(props.repo.name)) 61const repoName = computed(() => stripHtml(props.repo.name))
41const isExpandable = computed(() => !NOT_EXPANDABLE_REPOS.has(repoName.value)) 62const isExpandable = computed(() => !NOT_EXPANDABLE_REPOS.has(repoName.value))
42const installUrl = computed(() => 63const installUrl = computed(() =>
@@ -83,6 +104,11 @@ async function copyHeaderVariantUrl() {
83 <div class="ext-repo-row"> 104 <div class="ext-repo-row">
84 <div class="ext-repo-name"> 105 <div class="ext-repo-name">
85 <span v-html="repo.name" /> 106 <span v-html="repo.name" />
107 <span
108 v-if="siteCount"
109 class="ext-repo-count"
110 :title="siteCountTitle"
111 >{{ siteCount }}</span>
86 <VTooltip v-if="repo.note" theme="vp-tooltip"> 112 <VTooltip v-if="repo.note" theme="vp-tooltip">
87 <button type="button" class="ext-note-btn" aria-label="Note"> 113 <button type="button" class="ext-note-btn" aria-label="Note">
88 <span class="i-lucide:lightbulb" /> 114 <span class="i-lucide:lightbulb" />
docs/.vitepress/theme/components/extrepo/RepoVariantRow.vue +17 −1
@@ -1,5 +1,6 @@
1<script setup lang="ts"> 1<script setup lang="ts">
2import { computed, ref } from 'vue' 2import { computed, ref } from 'vue'
3import { groupSites } from './groupSites'
3import { 4import {
4 mangayomiCopyValue, 5 mangayomiCopyValue,
5 mangayomiHref, 6 mangayomiHref,
@@ -37,6 +38,11 @@ const sites = computed(() => {
37 const all = url ? repoData.value[url]?.sites ?? [] : [] 38 const all = url ? repoData.value[url]?.sites ?? [] : []
38 return props.showBroken ? all : all.filter(site => !site.isBroken) 39 return props.showBroken ? all : all.filter(site => !site.isBroken)
39}) 40})
41const siteCount = computed(() => groupSites(sites.value).length)
42const siteCountTitle = computed(
43 () =>
44 `${siteCount.value} extension${siteCount.value === 1 ? '' : 's'} available`
45)
40 46
41async function copyVariantUrl() { 47async function copyVariantUrl() {
42 if (!copyValue.value) return 48 if (!copyValue.value) return
@@ -47,7 +53,14 @@ async function copyVariantUrl() {
47<template> 53<template>
48 <div class="ext-repo-variant"> 54 <div class="ext-repo-variant">
49 <div class="ext-repo-variant-row"> 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 <div class="ext-repo-actions"> 64 <div class="ext-repo-actions">
52 <template v-if="showActions"> 65 <template v-if="showActions">
53 <a class="ext-btn ext-btn-install" :href="installUrl"> 66 <a class="ext-btn ext-btn-install" :href="installUrl">
@@ -115,6 +128,9 @@ async function copyVariantUrl() {
115 border-top: 1px solid var(--vp-c-divider); 128 border-top: 1px solid var(--vp-c-divider);
116} 129}
117.ext-repo-variant-label { 130.ext-repo-variant-label {
131 display: inline-flex;
132 align-items: center;
133 gap: 6px;
118 font-size: 13px; 134 font-size: 13px;
119 color: var(--vp-c-text-2); 135 color: var(--vp-c-text-2);
120} 136}
docs/.vitepress/theme/components/extrepo/repoRowShared.css +16
@@ -4,6 +4,22 @@
4 gap: 6px; 4 gap: 6px;
5 flex-shrink: 0; 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.ext-btn { 23.ext-btn {
8 display: inline-flex; 24 display: inline-flex;
9 align-items: center; 25 align-items: center;