Skip to content

Commit 5ca8621

Browse files
committed
fix: make CNLL links look good in preview
1 parent dd32569 commit 5ca8621

File tree

3 files changed

+40
-9
lines changed

3 files changed

+40
-9
lines changed

api/src/types/Catalogi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ export namespace Catalogi {
1313
| "GitHub"
1414
| "ComptoirDuLibre"
1515
| "FramaLibre"
16+
| "CNLL"
1617
| "Zenodo";
1718
}

web/src/ui/pages/softwareDetails/PreviewTab.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,22 @@ export const PreviewTab = (props: Props) => {
339339
))
340340
);
341341
})
342-
.map(identifier => (
343-
<LogoURLButton
344-
key={identifier.url?.toString()}
345-
className={cx(fr.cx("fr-ml-4v", "fr-my-2v"))}
346-
priority="secondary"
347-
url={identifier.url}
348-
labelFromURL={true}
349-
/>
350-
))}
342+
.map(identifier => {
343+
const url =
344+
identifier.url ?? identifier.subjectOf?.url;
345+
346+
return (
347+
<LogoURLButton
348+
key={url?.toString()}
349+
className={cx(
350+
fr.cx("fr-ml-4v", "fr-my-2v")
351+
)}
352+
priority="secondary"
353+
url={url}
354+
labelFromURL={true}
355+
/>
356+
);
357+
})}
351358
</>
352359
)}
353360
</div>

web/src/ui/shared/LogoURLButton.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ const resolveLogoFromURL = (
6262
return resolveLogoFromType("Zenodo");
6363
}
6464

65+
if (urlString.includes("cnll")) {
66+
return resolveLogoFromType("CNLL");
67+
}
68+
6569
return {
6670
URLlogo: undefined,
6771
textFromURL: undefined
@@ -137,6 +141,12 @@ const resolveLogoFromType = (
137141
),
138142
textFromURL: "Zenodo"
139143
};
144+
case "CNLL":
145+
return {
146+
URLlogo: new URL("https://cnll.fr/static/img/logo-cnll.svg"),
147+
textFromURL: "CNLL"
148+
};
149+
140150
default:
141151
sourceType satisfies never;
142152
return {
@@ -201,3 +211,16 @@ const useStyles = tss.withName({ LogoURLButton }).create({
201211
marginLeft: "7px"
202212
}
203213
});
214+
215+
const yo = [
216+
{
217+
"@type": "PropertyValue",
218+
value: "93",
219+
subjectOf: {
220+
url: "https://cnll.fr/",
221+
name: "Union des entreprises du logiciel libre et du numérique ouvert",
222+
"@type": "Website",
223+
additionalType: "cnll"
224+
}
225+
}
226+
];

0 commit comments

Comments
 (0)