Skip to content

Commit 041a0d5

Browse files
Merge pull request #109 from geoCML/no-drgon-results
Do not show recommendations table if there are no results from DRGON
2 parents fd8f75f + 808b6cd commit 041a0d5

File tree

1 file changed

+44
-40
lines changed

1 file changed

+44
-40
lines changed

build-resources/geocml-server/portal/src/components/Recommendations.js

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,50 @@ export function Recommendations() {
3131
}, [])
3232

3333
return (
34-
<div>
35-
<h3 className="row justify-content-center pt-5">Explore Similar Datasets</h3>
36-
<i className="row justify-content-center pb-2">Results powered by DRGON</i>
37-
<table id="drgon-recommendations" className="table table-responsive" style={{ width: "100%" }}>
38-
<thead>
39-
<tr>
40-
<th>Title</th>
41-
<th>Description</th>
42-
<th>Owner</th>
43-
<th>URL</th>
44-
<th>Tags</th>
45-
</tr>
46-
</thead>
47-
<tbody>
48-
{recommendations.map((recommendation, i) => {
49-
return (
50-
<tr>
51-
<td>
52-
{recommendation[i].title}
53-
</td>
54-
<td>
55-
{recommendation[i].description}
56-
</td>
57-
<td>
58-
{recommendation[i].owner}
59-
</td>
60-
<td>
61-
<a href={recommendation[i].url}>{recommendation[i].url}</a>
62-
</td>
63-
<td>{recommendation[i].tags.split(",").map((tag) => {
64-
return (
65-
<span className="rounded bg-info p-2 mx-2">{tag}</span>
66-
)
67-
})}</td>
68-
</tr>
69-
)
70-
})}
71-
</tbody>
72-
</table>
73-
</div>
34+
recommendations.length > 0 ? (
35+
<div>
36+
<h3 className="row justify-content-center pt-5">Explore Similar Datasets</h3>
37+
<i className="row justify-content-center pb-2">Results powered by DRGON</i>
38+
<table id="drgon-recommendations" className="table table-responsive" style={{ width: "100%" }}>
39+
<thead>
40+
<tr>
41+
<th>Title</th>
42+
<th>Description</th>
43+
<th>Owner</th>
44+
<th>URL</th>
45+
<th>Tags</th>
46+
</tr>
47+
</thead>
48+
<tbody>
49+
{ recommendations.map((recommendation, i) => {
50+
return (
51+
<tr>
52+
<td>
53+
{recommendation[i].title}
54+
</td>
55+
<td>
56+
{recommendation[i].description}
57+
</td>
58+
<td>
59+
{recommendation[i].owner}
60+
</td>
61+
<td>
62+
<a href={recommendation[i].url}>{recommendation[i].url}</a>
63+
</td>
64+
<td>{recommendation[i].tags.split(",").map((tag) => {
65+
return (
66+
<span className="rounded bg-info p-2 mx-2">{tag}</span>
67+
)
68+
})}</td>
69+
</tr>
70+
)
71+
}) }
72+
</tbody>
73+
</table>
74+
</div>
75+
) : (
76+
<div></div>
77+
)
7478
)
7579
}
7680

0 commit comments

Comments
 (0)