summaryrefslogtreecommitdiffstats
path: root/ui/src/utils.ts
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-03-20 16:13:54 -0400
committerDessalines <tyhou13@gmx.com>2020-03-20 16:13:54 -0400
commit522649d9d3c21c15cb00740fb8c86a51a64468a4 (patch)
tree358394402647682fa2c055f760215a62e9329edb /ui/src/utils.ts
parentb3066db08b2c71b882f03228fd280a236c19eeef (diff)
Notification improvements.
- Adding a navbar notification icon for mobile. - Adding an in-app notification toast. To be improved later. - Fixes #607
Diffstat (limited to 'ui/src/utils.ts')
-rw-r--r--ui/src/utils.ts24
1 files changed, 23 insertions, 1 deletions
diff --git a/ui/src/utils.ts b/ui/src/utils.ts
index 89fbe51c..cab1fd5b 100644
--- a/ui/src/utils.ts
+++ b/ui/src/utils.ts
@@ -218,7 +218,7 @@ export function validURL(str: string) {
}
export function validEmail(email: string) {
- let re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
+ let re = /^(([^\s"(),.:;<>@[\\\]]+(\.[^\s"(),.:;<>@[\\\]]+)*)|(".+"))@((\[(?:\d{1,3}\.){3}\d{1,3}])|(([\dA-Za-z\-]+\.)+[A-Za-z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
@@ -436,6 +436,28 @@ export function toast(text: string, background: string = 'success') {
}).showToast();
}
+export function messageToastify(
+ creator: string,
+ avatar: string,
+ body: string,
+ link: string,
+ router: any
+) {
+ let backgroundColor = `var(--light)`;
+ Toastify({
+ text: `${body}<br />${creator}`,
+ avatar: avatar,
+ backgroundColor: backgroundColor,
+ close: true,
+ gravity: 'top',
+ position: 'right',
+ duration: 0,
+ onClick: () => {
+ router.history.push(link);
+ },
+ }).showToast();
+}
+
export function setupTribute(): Tribute {
return new Tribute({
collection: [