mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-02 21:16:07 +02:00
replace ElNotification
This commit is contained in:
+8
-11
@@ -1,5 +1,4 @@
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { ElNotification } from 'element-plus';
|
||||
import { defineStore } from 'pinia';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -58,18 +57,16 @@ export const useChartsStore = defineStore('Charts', () => {
|
||||
!mutualGraphStatus.completionNotified
|
||||
) {
|
||||
mutualGraphStatus.completionNotified = true;
|
||||
ElNotification({
|
||||
title: t(
|
||||
toast.success(
|
||||
t(
|
||||
'view.charts.mutual_friend.notifications.mutual_friend_graph_ready_title'
|
||||
),
|
||||
message: t(
|
||||
'view.charts.mutual_friend.notifications.mutual_friend_graph_ready_message'
|
||||
),
|
||||
type: 'success',
|
||||
position: 'top-right',
|
||||
duration: 5000,
|
||||
showClose: true
|
||||
});
|
||||
{
|
||||
description: t(
|
||||
'view.charts.mutual_friend.notifications.mutual_friend_graph_ready_message'
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
+23
-19
@@ -1,6 +1,6 @@
|
||||
import { computed, ref } from 'vue';
|
||||
import { ElNotification } from 'element-plus';
|
||||
import { defineStore } from 'pinia';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { formatDateFilter, openExternalLink } from '../shared/utils';
|
||||
@@ -26,6 +26,14 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
|
||||
return lastStatus.value;
|
||||
});
|
||||
|
||||
function dismissAlert() {
|
||||
if (!alertRef.value) {
|
||||
return;
|
||||
}
|
||||
toast.dismiss(alertRef.value);
|
||||
alertRef.value = null;
|
||||
}
|
||||
|
||||
function updateAlert() {
|
||||
if (lastStatusText.value === statusText.value) {
|
||||
return;
|
||||
@@ -34,32 +42,28 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
|
||||
|
||||
if (!statusText.value) {
|
||||
if (alertRef.value) {
|
||||
alertRef.value.close();
|
||||
alertRef.value = ElNotification({
|
||||
title: t('status.title'),
|
||||
message: `${formatDateFilter(lastStatusTime.value, 'short')}: All Systems Operational`,
|
||||
type: 'success',
|
||||
duration: 5000,
|
||||
showClose: true,
|
||||
dismissAlert();
|
||||
alertRef.value = toast.success(t('status.title'), {
|
||||
description: `${formatDateFilter(lastStatusTime.value, 'short')}: All Systems Operational`,
|
||||
position: 'bottom-right',
|
||||
onClick: () => {
|
||||
openStatusPage();
|
||||
action: {
|
||||
label: 'Open',
|
||||
onClick: () => openStatusPage()
|
||||
}
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
alertRef.value?.close();
|
||||
alertRef.value = ElNotification({
|
||||
title: t('status.title'),
|
||||
message: `${formatDateFilter(lastStatusTime.value, 'short')}: ${statusText.value}`,
|
||||
type: 'warning',
|
||||
duration: 0,
|
||||
showClose: true,
|
||||
dismissAlert();
|
||||
alertRef.value = toast.warning(t('status.title'), {
|
||||
description: `${formatDateFilter(lastStatusTime.value, 'short')}: ${statusText.value}`,
|
||||
duration: Infinity,
|
||||
closeButton: true,
|
||||
position: 'bottom-right',
|
||||
onClick: () => {
|
||||
openStatusPage();
|
||||
action: {
|
||||
label: 'Open',
|
||||
onClick: () => openStatusPage()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user