(refactor)(design) simplify links handling

This commit is contained in:
Valentyne Stigloher 2025-07-12 20:24:11 +02:00
parent 979fe5ecf3
commit c9aa146f7c

View File

@ -38,7 +38,7 @@ const rgbToHex = (rgb: string): string => {
interface Image {
label: string;
links: string | Record<string, string>;
links: Record<string, string>;
warning?: string;
}
@ -74,15 +74,7 @@ useSimpleHead({
title: translator.translate('contact.contribute.design.header'),
}, translator);
const getLinks = (rawLinks: string | Record<string, string>) => {
if (typeof rawLinks === 'string') {
return Object.fromEntries([[rawLinks, translator.translate('crud.download')]]);
}
return rawLinks;
};
const getPrimaryUri = (links: string | Record<string, string>) => {
links = getLinks(links);
const getPrimaryUri = (links: Record<string, string>) => {
return Object.entries(links)[0][0];
};
</script>
@ -182,7 +174,7 @@ const getPrimaryUri = (links: string | Record<string, string>) => {
{{ label }}
</p>
<a
v-for="(linkLabel, uri) in getLinks(links)"
v-for="(linkLabel, uri) in links"
:key="linkLabel"
:href="uri"
target="_blank"