Skip to content

Commit

Permalink
Merge pull request #211 from GeoWerkstatt/sort-catalogs
Browse files Browse the repository at this point in the history
Sort catalogs in Detail page
  • Loading branch information
patrickackermann authored Jul 17, 2024
2 parents 9e3653f + b6024b6 commit c846f0d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/ClientApp/src/components/Detail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,20 @@ export function Detail() {
<AutoStoriesIcon sx={{ mb: -0.5, mr: 0.5 }} />
{t("catalogue-files")}:{" "}
{model.catalogueFiles &&
model.catalogueFiles.map((f) => (
<Box sx={{ ml: 4 }}>
<Typography variant="body" sx={{ mr: 1, fontSize: 14 }}>
<a href={f} target="_blank" rel="noreferrer">
{f}
</a>
</Typography>
</Box>
))}
model.catalogueFiles
.sort((a, b) => {
const result = (a.match(/\//g) || []).length - (b.match(/\//g) || []).length;
return result === 0 ? a.localeCompare(b, undefined, { sensitivity: "base" }) : result;
})
.map((f) => (
<Box sx={{ ml: 4 }}>
<Typography variant="body" sx={{ mr: 1, fontSize: 14 }}>
<a href={f} target="_blank" rel="noreferrer">
{f}
</a>
</Typography>
</Box>
))}
</Box>
)}
{model.technicalContact && (
Expand Down

0 comments on commit c846f0d

Please sign in to comment.