mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 07:55:52 +01:00
✨ Add notifications when chaning configs
This commit is contained in:
@@ -5,6 +5,8 @@ import { setCookie } from 'cookies-next';
|
|||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { notifications } from '@mantine/notifications';
|
||||||
|
import { IconCheck } from '@tabler/icons';
|
||||||
import { useConfigContext } from '../../config/provider';
|
import { useConfigContext } from '../../config/provider';
|
||||||
|
|
||||||
export default function ConfigChanger() {
|
export default function ConfigChanger() {
|
||||||
@@ -23,10 +25,33 @@ export default function ConfigChanger() {
|
|||||||
sameSite: 'strict',
|
sameSite: 'strict',
|
||||||
});
|
});
|
||||||
setActiveConfig(value);
|
setActiveConfig(value);
|
||||||
toggle();
|
|
||||||
|
|
||||||
router.push(`/${value}`);
|
notifications.show({
|
||||||
setConfigName(value);
|
id: 'load-data',
|
||||||
|
loading: true,
|
||||||
|
title: t('configSelect.loadingNew'),
|
||||||
|
radius: 'md',
|
||||||
|
withCloseButton: false,
|
||||||
|
message: t('configSelect.pleaseWait'),
|
||||||
|
autoClose: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
notifications.update({
|
||||||
|
id: 'load-data',
|
||||||
|
color: 'teal',
|
||||||
|
radius: 'md',
|
||||||
|
withCloseButton: false,
|
||||||
|
title: t('configSelect.loadingNew'),
|
||||||
|
message: t('configSelect.pleaseWait'),
|
||||||
|
icon: <IconCheck size="1rem" />,
|
||||||
|
autoClose: 2000,
|
||||||
|
});
|
||||||
|
}, 3000);
|
||||||
|
setTimeout(() => {
|
||||||
|
router.push(`/${value}`);
|
||||||
|
setConfigName(value);
|
||||||
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
// If configlist is empty, return a loading indicator
|
// If configlist is empty, return a loading indicator
|
||||||
|
|||||||
Reference in New Issue
Block a user