aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/socket.js2
-rw-r--r--src/lib/utils.js45
2 files changed, 45 insertions, 2 deletions
diff --git a/src/lib/socket.js b/src/lib/socket.js
index 66091d76..53adfe7c 100644
--- a/src/lib/socket.js
+++ b/src/lib/socket.js
@@ -25,7 +25,7 @@ export const messages = (data) => ({
login() {
user.set(data);
- preferredCurrency.set(data.currency);
+ preferredCurrency.set('USD');
}
});
diff --git a/src/lib/utils.js b/src/lib/utils.js
index db8a490a..6b728152 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -1,4 +1,5 @@
import { browser } from '$app/env';
+import { toast } from '@zerodevx/svelte-toast';
export function scroll(section) {
section.scrollIntoView({ behavior: 'smooth' });
@@ -26,6 +27,7 @@ export const post = (url, body) =>
export const copy = (text) => {
navigator.clipboard.writeText(text);
+ success('Copied!');
};
export function reverseFormat(val, locale) {
@@ -37,4 +39,45 @@ export function reverseFormat(val, locale) {
return Number.isNaN(reversedVal) ? 0 : +reversedVal;
}
-export let protectedRoutes = [/receive/, /customers/, /dashboard/, /settings/, /transactions/];
+export let protectedRoutes = [
+ /receive/,
+ /customers/,
+ /dashboard/,
+ /settings/,
+ /transactions/,
+ /support/
+];
+
+export const success = (m) => {
+ toast.pop();
+ toast.push(m, {
+ theme: {
+ '--toastBarBackground': '#16A34A'
+ }
+ });
+};
+
+export const warning = (m) => {
+ toast.pop();
+ toast.push(m, {
+ theme: {
+ '--toastBarBackground': '#FFCE22'
+ }
+ });
+};
+export const failure = (m) => {
+ toast.pop();
+ toast.push(m, {
+ theme: {
+ '--toastBarBackground': '#E93535'
+ }
+ });
+};
+export const info = (m) => {
+ toast.pop();
+ toast.push(m, {
+ theme: {
+ '--toastBarBackground': '#1C69FF'
+ }
+ });
+};