Add better UI for warnings allowing you to accept without chatting

This commit is contained in:
Ajay
2022-07-20 18:48:53 -04:00
parent 31cc4b4960
commit 2cc1dcc6fd
10 changed files with 127 additions and 86 deletions

View File

@@ -36,12 +36,31 @@ class NoticeTextSelectionComponent extends React.Component<NoticeTextSelectionPr
: null}
<span>
{this.props.text}
{this.getTextElements(this.props.text)}
</span>
</td>
</tr>
);
}
private getTextElements(text: string): Array<string | React.ReactElement> {
const elements: Array<string | React.ReactElement> = [];
const textParts = text.split(/(?=\s+)/);
for (const textPart of textParts) {
if (textPart.match(/^\s*http/)) {
elements.push(
<a href={textPart} target="_blank" rel="noreferrer">
{textPart}
</a>
);
} else {
elements.push(textPart);
}
}
return elements;
}
}
export default NoticeTextSelectionComponent;