Skip to content

Commit 1bbe3a5

Browse files
committed
fix: remove documentation card when no usable doc info
1 parent 7b90026 commit 1bbe3a5

2 files changed

Lines changed: 36 additions & 12 deletions

File tree

components/Tools/ToolEntry/Documentation/DocumentationContent.vue

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<v-container class="mt-0 pt-0 pl-8">
33
<!-- Documents -->
44
<v-row
5-
v-if="tool.documentation && tool.documentation.length"
5+
v-if="documents.length"
66
class="mt-0 pt-0 mb-0 section-row"
77
align="center"
88
>
@@ -11,9 +11,7 @@
1111
</v-col>
1212
<v-col cols="9" class="pt-3 pb-3 d-flex flex-wrap" style="gap: 14px">
1313
<v-chip
14-
v-for="(item, i) in tool.documentation.filter(
15-
(d) => d.term && d.term.url
16-
)"
14+
v-for="(item, i) in documents"
1715
:key="i"
1816
label
1917
color="grey lighten-3"
@@ -28,12 +26,12 @@
2826
</v-col>
2927
</v-row>
3028

31-
<v-divider v-if="tool.documentation && tool.documentation.length" />
29+
<v-divider v-if="documents.length" />
3230

3331
<!-- Related topics -->
3432
<!-- Vocabulary EDAM si lleva los 3 puntitos sino no. -->
3533
<v-row
36-
v-if="tool.topics && tool.topics.length"
34+
v-if="topics.length"
3735
class="mt-0 pt-0 mb-0 section-row"
3836
align="center"
3937
>
@@ -42,7 +40,7 @@
4240
</v-col>
4341
<v-col cols="9" class="pt-3 pb-3 d-flex flex-wrap" style="gap: 14px">
4442
<ItemChipMenu
45-
v-for="item in tool.topics.filter((t) => t.term && t.term.term)"
43+
v-for="item in topics"
4644
:key="item.id"
4745
:text="item.term.term"
4846
:edam-id="item.term.uri"
@@ -53,11 +51,11 @@
5351
</v-col>
5452
</v-row>
5553

56-
<v-divider v-if="tool.topics && tool.topics.length" />
54+
<v-divider v-if="topics.length" />
5755

5856
<!-- Operations -->
5957
<v-row
60-
v-if="tool.operations && tool.operations.length"
58+
v-if="operations.length"
6159
class="mt-0 pt-0 mb-0 section-row"
6260
align="center"
6361
>
@@ -66,7 +64,7 @@
6664
</v-col>
6765
<v-col cols="9" class="pt-3 pb-3 d-flex flex-wrap" style="gap: 14px">
6866
<ItemChipMenu
69-
v-for="item in tool.operations"
67+
v-for="item in operations"
7068
:key="item.id"
7169
:text="item.term.term"
7270
:edam-id="item.term.uri"
@@ -101,6 +99,19 @@ export default {
10199
tool: 'tool',
102100
loading: 'loading',
103101
}),
102+
// Documentation entries that carry a link; entries with only inline
103+
// `content` (no URL) render no chip, so they are excluded here.
104+
documents() {
105+
return (this.tool?.documentation || []).filter(
106+
(d) => d.term && d.term.url
107+
);
108+
},
109+
topics() {
110+
return (this.tool?.topics || []).filter((t) => t.term && t.term.term);
111+
},
112+
operations() {
113+
return (this.tool?.operations || []).filter((o) => o.term && o.term.term);
114+
},
104115
},
105116
};
106117
</script>

pages/tool/_id.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,22 @@ export default {
226226
hasSimilarSoftware() {
227227
return this.loadingSimilar || this.similarTools.length > 0;
228228
},
229-
// Whether the documentation section should be shown
229+
// Whether the documentation section should be shown. The card renders
230+
// Documents (documentation entries with a URL), Related topics and
231+
// Function (operations); a documentation entry that only carries inline
232+
// `content` (no URL) renders nothing, so it must not, on its own, show
233+
// the card.
230234
hasDocumentation() {
231-
return (this.tool?.documentation || []).length > 0;
235+
const hasDocuments = (this.tool?.documentation || []).some(
236+
(doc) => doc.term?.url
237+
);
238+
const hasTopics = (this.tool?.topics || []).some(
239+
(topic) => topic.term?.term
240+
);
241+
const hasOperations = (this.tool?.operations || []).some(
242+
(operation) => operation.term?.term
243+
);
244+
return hasDocuments || hasTopics || hasOperations;
232245
},
233246
// Sections to render, hiding cards that have no information
234247
items() {

0 commit comments

Comments
 (0)