@@ -48,7 +48,6 @@ export const PreviewTab = (props: Props) => {
4848 softwareDateCurrentVersion,
4949 softwareDescription,
5050 registerDate,
51- minimalVersionRequired,
5251 license,
5352 hasDesktopApp,
5453 isAvailableAsMobileApp,
@@ -70,15 +69,34 @@ export const PreviewTab = (props: Props) => {
7069 const { t } = useTranslation ( ) ;
7170 const { lang } = useLang ( ) ;
7271
73- const usefulLinks = identifiers . filter ( identifier => {
74- const identifierURLString = identifier ?. url ?. toString ( ) ;
75- return (
76- ! officialWebsiteUrl ||
77- ( officialWebsiteUrl &&
78- identifierURLString &&
79- ! officialWebsiteUrl . startsWith ( identifierURLString ) )
80- ) ;
81- } ) ;
72+ const usefulLinks = identifiers
73+ . filter ( identifier => {
74+ const identifierURLString = identifier ?. url ?. toString ( ) ;
75+ return (
76+ ! officialWebsiteUrl ||
77+ ( officialWebsiteUrl &&
78+ identifierURLString &&
79+ ! officialWebsiteUrl . startsWith ( identifierURLString ) )
80+ ) ;
81+ } )
82+ . reduce ( ( acc , identifier ) => {
83+ // make sure we don't have duplicate links
84+ const url = identifier . url ?? identifier . subjectOf ?. url ;
85+ if ( ! url ) return acc ;
86+ const domain = new URL ( url ) . hostname . replace ( "www." , "" ) ;
87+ if (
88+ acc . some ( i => {
89+ const iUrl = i . url ?? i . subjectOf ?. url ;
90+ if ( ! iUrl ) return false ;
91+ const iDomain = new URL ( iUrl ) . hostname . replace ( "www." , "" ) ;
92+ return iDomain === domain ;
93+ } )
94+ ) {
95+ return acc ;
96+ }
97+ acc . push ( identifier ) ;
98+ return acc ;
99+ } , [ ] as Identifier [ ] ) ;
82100
83101 return (
84102 < >
0 commit comments