Fix title string break up

This commit is contained in:
saltrafael 2021-07-30 10:07:00 -03:00
parent 3df47c607c
commit 7fd1849e3d
No known key found for this signature in database
GPG key ID: 9C7F1DC0B0F54515

View file

@ -107,13 +107,26 @@ export default function Notification(props: Props) {
const notificationTitle = notification_parameters.device.title;
const titleSplit = notificationTitle.split(' ');
const title = titleSplit.map((message) => {
let fullTitle = [' '];
let uriIndicator;
const title = titleSplit.map((message, index) => {
if (channelName === message) {
return (
uriIndicator = (
<UriIndicator uri={channelUrl} link />
);
fullTitle.push(' ');
const resultTitle = fullTitle;
fullTitle = [' '];
return [resultTitle.join(' '), uriIndicator];
} else {
return <LbcMessage>{__(' %message% ', { message })}</LbcMessage>;
fullTitle.push(message);
if (index === (titleSplit.length - 1)) {
return (
<LbcMessage>{fullTitle.join(' ')}</LbcMessage>
);
}
}
});