diff --git a/dashboard/app.vue b/dashboard/app.vue index ed99862..b37898e 100644 --- a/dashboard/app.vue +++ b/dashboard/app.vue @@ -6,6 +6,8 @@ Lit.init('6643cd08a1854e3b81722ab5'); const debugMode = process.dev; +const { alerts, closeAlert } = useAlert(); + const { showDialog, closeDialog, dialogComponent, dialogParams } = useCustomDialog(); @@ -13,6 +15,25 @@ const { showDialog, closeDialog, dialogComponent, dialogParams } = useCustomDial
+
+
+
+
+
+
{{ alert.title }}
+
+ {{ alert.text }} +
+
+
+ +
+
+ +
+
+
XS
diff --git a/dashboard/components/CVerticalNavigation.vue b/dashboard/components/CVerticalNavigation.vue index 87be36b..0a1bd08 100644 --- a/dashboard/components/CVerticalNavigation.vue +++ b/dashboard/components/CVerticalNavigation.vue @@ -59,26 +59,34 @@ const snapshotsItems = computed(() => {
+
Snapshots
+ -
-
{{ new Date(snapshot.from).toLocaleString('it-IT') }}
-
{{ new Date(snapshot.to).toLocaleString('it-IT') }}
+
+
+
From:
+
{{ new Date(snapshot.from).toLocaleString('it-IT') }}
+
+
+
To:
+
{{ new Date(snapshot.to).toLocaleString('it-IT') }}
+
diff --git a/dashboard/components/dashboard/CountCard.vue b/dashboard/components/dashboard/CountCard.vue index 57a2c5e..32e24b1 100644 --- a/dashboard/components/dashboard/CountCard.vue +++ b/dashboard/components/dashboard/CountCard.vue @@ -40,32 +40,16 @@ const props = defineProps<{
-
+
+
+ +
- \ No newline at end of file diff --git a/dashboard/components/dashboard/TopSection.vue b/dashboard/components/dashboard/TopSection.vue index 4b7ef50..e44ba0f 100644 --- a/dashboard/components/dashboard/TopSection.vue +++ b/dashboard/components/dashboard/TopSection.vue @@ -6,10 +6,12 @@ onMounted(() => startWatching()); onUnmounted(() => stopWatching()); +const { createAlert } = useAlert(); + function copyProjectId() { if (!navigator.clipboard) alert('NON PUOI COPIARE IN HTTP'); navigator.clipboard.writeText((activeProject.value?._id || 0).toString()); - alert('Copiato !'); + createAlert('Success', 'Project id copied successfully.', 'far fa-circle-check', 5000); } diff --git a/dashboard/composables/useAlert.ts b/dashboard/composables/useAlert.ts new file mode 100644 index 0000000..5f2ff4f --- /dev/null +++ b/dashboard/composables/useAlert.ts @@ -0,0 +1,34 @@ + + +export type Alert = { + title: string, + text: string, + icon: string, + ms: number, + id: number +} + +const alerts = ref([]); + +const idPool = { + id: 0, + getId() { + return idPool.id++; + } +} + +function createAlert(title: string, text: string, icon: string, ms: number) { + const alert: Alert = { title, text, icon, ms, id: idPool.getId() } + alerts.value.push(alert); + setTimeout(() => { + closeAlert(alert.id); + }, ms) +} + +function closeAlert(id: number) { + alerts.value = alerts.value.filter(e => e.id != id); +} + +export function useAlert() { + return { alerts, createAlert, closeAlert } +} \ No newline at end of file diff --git a/dashboard/pages/index.vue b/dashboard/pages/index.vue index 71073c2..e42c0a5 100644 --- a/dashboard/pages/index.vue +++ b/dashboard/pages/index.vue @@ -27,10 +27,13 @@ onMounted(async () => { }); +const { createAlert } = useAlert(); + + function copyProjectId() { if (!navigator.clipboard) alert('NON PUOI COPIARE IN HTTP'); navigator.clipboard.writeText(activeProject.value?._id?.toString() || ''); - alert('Copiato !'); + createAlert('Success', 'Project id copied successfully.', 'far fa-circle-check', 5000); } @@ -48,7 +51,7 @@ function copyScript() { } navigator.clipboard.writeText(createScriptText()); - alert('Copiato !'); + createAlert('Success', 'Script copied successfully.', 'far fa-circle-check', 5000); } const { data: firstInteraction, pending, refresh } = useFirstInteractionData(); @@ -165,10 +168,10 @@ const selectLabels = [
-
+
-
+
Waiting for your first Visit or Event
@@ -199,7 +202,11 @@ const selectLabels = [
-
+ +
+
Go to docs
+