Skip to content

Commit 78a21e8

Browse files
metadata add
1 parent f39a4e7 commit 78a21e8

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/components/plugins/PluginIndex.vue

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<SubgroupCard
99
:id="slugify(subGroupName(subGroupWrapper))"
1010
:icon-b64-svg="'data:image/svg+xml;base64,' + (icons[subGroupWrapper.subGroup] ?? icons[subGroupWrapper.group])"
11-
:text="subGroupName(subGroupWrapper)"
12-
:description="subGroupWrapper.description"
11+
:text="getSubgroupTitle(subGroupWrapper)"
12+
:description="getSubgroupDescription(subGroupWrapper)"
1313
:href="`${routePath}/${slugify(subGroupName(subGroupWrapper))}`"
1414
:route-path="routePath"
1515
:plugin-group="subGroupWrapper.group ?? subGroupWrapper.name"
@@ -73,7 +73,7 @@
7373
import {computed, ref} from "vue";
7474
import {useElementSize} from "@vueuse/core";
7575
import {slugify} from "../../utils/url";
76-
import type {Plugin} from "../../utils/plugins";
76+
import type {Plugin, PluginMetadata} from "../../utils/plugins";
7777
import {subGroupName, extractPluginElements} from "../../utils/plugins";
7878
import {usePluginElementCounts} from "../../composables/usePluginElementCounts";
7979
@@ -89,9 +89,22 @@
8989
icons: Record<string, string>
9090
subGroup?: string | undefined,
9191
activeId?: string | undefined
92-
subgroupBlueprintCounts?: Record<string, number>
92+
subgroupBlueprintCounts?: Record<string, number>,
93+
metadataMap?: Record<string, PluginMetadata>
9394
}>();
9495
96+
const getSubgroupMetadata = (subGroupWrapper: Plugin) => {
97+
return props.metadataMap?.[subGroupWrapper.subGroup ?? subGroupWrapper.group];
98+
};
99+
100+
const getSubgroupDescription = (subGroupWrapper: Plugin) => {
101+
return getSubgroupMetadata(subGroupWrapper)?.description ?? subGroupWrapper.description;
102+
};
103+
104+
const getSubgroupTitle = (subGroupWrapper: Plugin) => {
105+
return getSubgroupMetadata(subGroupWrapper)?.title ?? subGroupWrapper.title ?? subGroupName(subGroupWrapper);
106+
};
107+
95108
const plugin = computed(() => props.plugins.find(p => props.subGroup === undefined ? true : (slugify(subGroupName(p)) === props.subGroup)) as Plugin);
96109
97110
const description = computed(() => {

0 commit comments

Comments
 (0)