Skip to content

Commit e89f174

Browse files
authored
Add a "Browse" link to /packages that points to the conda-metadata-app (#2086)
1 parent be37654 commit e89f174

File tree

1 file changed

+37
-27
lines changed

1 file changed

+37
-27
lines changed

src/components/Packages/index.jsx

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,36 @@ const Packages = () => {
138138
setSearchTerm(event.target.value);
139139
};
140140

141+
const feedstockCell = (pkgName) => {
142+
return (
143+
(allPackages[pkgName.toLowerCase()] || []).map((repo, index) => (
144+
<span key={`${pkgName}-${index}-${repo}`}>
145+
<a
146+
href={`https://github.com/conda-forge/${repo}-feedstock`}
147+
target="_blank"
148+
rel="noopener noreferrer"
149+
title={`View ${repo}-feedstock on GitHub`}
150+
>
151+
{repo}-feedstock
152+
</a>
153+
<br />
154+
</span>
155+
)) || <span>No feedstock found</span>
156+
);
157+
};
158+
const metadataCell = (pkgName) => {
159+
return (
160+
<a
161+
href={`https://conda-metadata-app.streamlit.app/?q=conda-forge/${pkgName}`}
162+
target="_blank"
163+
rel="noopener noreferrer"
164+
title={`Explore ${pkgName} metadata`}
165+
>
166+
Browse
167+
</a>
168+
);
169+
};
170+
141171
var renderResultsBlock;
142172
var resultsPill;
143173
if (searchTerm.length) {
@@ -148,6 +178,7 @@ const Packages = () => {
148178
<tr>
149179
<th>Package</th>
150180
<th>Feedstock(s)</th>
181+
<th>Metadata</th>
151182
</tr>
152183
</thead>
153184
<tbody>
@@ -163,25 +194,14 @@ const Packages = () => {
163194
{highlightSubstring(pkg, searchTermLower)}
164195
</a>
165196
</td>
197+
<td>{feedstockCell(pkg)}</td>
166198
<td>
167-
{allPackages[pkg].map((repo) => (
168-
<span key={`${pkg}-${repo}`}>
169-
<a
170-
href={`https://github.com/conda-forge/${repo}-feedstock`}
171-
target="_blank"
172-
title={`View ${repo}-feedstock on GitHub`}
173-
>
174-
{repo}-feedstock
175-
</a>
176-
177-
<br />
178-
</span>
179-
))}
199+
<center>{metadataCell(pkg)}</center>
180200
</td>
181201
</tr>
182202
))) || (
183203
<tr>
184-
<td colSpan="2">No packages found</td>
204+
<td colSpan="3">No packages found</td>
185205
</tr>
186206
)}
187207
</tbody>
@@ -223,6 +243,7 @@ const Packages = () => {
223243
<th>#</th>
224244
<th>Package</th>
225245
<th>Feedstock(s)</th>
246+
<th>Metadata</th>
226247
<th>Last updated</th>
227248
</tr>
228249
</thead>
@@ -239,20 +260,9 @@ const Packages = () => {
239260
{item.name}
240261
</a>
241262
</td>
263+
<td>{feedstockCell(item.name)}</td>
242264
<td>
243-
{(allPackages[item.name.toLowerCase()] || []).map((repo) => (
244-
<span key={`${item.name}-${index}-${repo}`}>
245-
<a
246-
href={`https://github.com/conda-forge/${repo}-feedstock`}
247-
target="_blank"
248-
rel="noopener noreferrer"
249-
title={`View ${repo}-feedstock on GitHub`}
250-
>
251-
{repo}-feedstock
252-
</a>
253-
<br />
254-
</span>
255-
))}
265+
<center>{metadataCell(item.name)}</center>
256266
</td>
257267
<td>{item.date}</td>
258268
</tr>

0 commit comments

Comments
 (0)