Skip to content

Commit 81244f7

Browse files
committed
fix: links not working in empty list component
1 parent 76b0a20 commit 81244f7

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

src/components/Extensibility/ExtensibilityList.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useGetCRbyPath } from './useGetCRbyPath';
1313
import ExtensibilityCreate from './ExtensibilityCreate';
1414
import {
1515
applyFormula,
16-
getResourceDescAndUrl,
16+
getResourceUrl,
1717
getTextSearchProperties,
1818
TranslationBundleContext,
1919
useCreateResourceDescription,
@@ -123,7 +123,7 @@ export const ExtensibilityListCore = ({
123123
defaultSearch: true,
124124
});
125125

126-
const { url: emptyListUrl } = getResourceDescAndUrl(description);
126+
const { url: emptyListUrl } = getResourceUrl(description);
127127

128128
return (
129129
<ResourcesList
@@ -142,7 +142,7 @@ export const ExtensibilityListCore = ({
142142
textSearchProperties(defaultSearchProperties),
143143
}}
144144
emptyListProps={{
145-
subtitleText: newListProps?.description?.props?.i18nKey,
145+
subtitleText: newListProps?.description,
146146
url: emptyListUrl,
147147
}}
148148
/>

src/components/Extensibility/helpers/index.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,9 @@ export const useCreateResourceDescription = (descID) => {
168168
}
169169
};
170170

171-
export const getResourceDescAndUrl = (descID) => {
171+
export const getResourceUrl = (descID) => {
172172
if (!descID)
173173
return {
174-
description: null,
175174
url: null,
176175
};
177176

@@ -183,17 +182,11 @@ export const getResourceDescAndUrl = (descID) => {
183182

184183
if (links?.length >= 1) {
185184
const matchedLink = links[0];
186-
const processedTrans = trans.replace(
187-
matchedLink.matchedText,
188-
`<0>${matchedLink.urlText}</0>`,
189-
);
190185
return {
191-
description: processedTrans,
192186
url: matchedLink.url,
193187
};
194188
} else {
195189
return {
196-
description: trans,
197190
url: null,
198191
};
199192
}

src/shared/components/EmptyListComponent/EmptyListComponent.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ReactNode } from 'react';
2-
import { Trans, useTranslation } from 'react-i18next';
2+
import { useTranslation } from 'react-i18next';
33
import { Button, IllustratedMessage, Title } from '@ui5/webcomponents-react';
44
import '@ui5/webcomponents-fiori/dist/illustrations/AllIllustrations';
55
import { ExternalLink } from 'shared/components/ExternalLink/ExternalLink';
@@ -28,15 +28,6 @@ export const EmptyListComponent = ({
2828
image = 'NoEntries',
2929
}: EmptyListComponentProps) => {
3030
const { t } = useTranslation();
31-
const subtitle = subtitleText ? (
32-
<Trans
33-
i18nKey={subtitleText}
34-
defaults={subtitleText}
35-
components={[<ExternalLink key={subtitleText} url={url} />]}
36-
/>
37-
) : (
38-
''
39-
);
4031

4132
if (showButton === undefined) {
4233
showButton = typeof onClick === 'function';
@@ -57,7 +48,9 @@ export const EmptyListComponent = ({
5748
{titleText}
5849
</Title>
5950
}
60-
subtitle={<span className="sap-margin-top-small">{subtitle}</span>}
51+
subtitle={
52+
<span className="sap-margin-top-small">{subtitleText ?? ''}</span>
53+
}
6154
>
6255
<div className="emptyListComponent__buttons">
6356
{showButton && <Button onClick={onClick}>{buttonText}</Button>}

0 commit comments

Comments
 (0)