mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +00:00
feat: add useNotify hook for unified notifications
- Created useNotify hook (src/platform/hooks/useNotify.ts): - In Telegram Mini App: uses native showPopup - In browser: uses beautiful Toast component - Methods: notify(), success(), error(), warning(), info() - AdminTariffs: improved deletion UX - Uses useNotify.warning when tariff has subscriptions - Uses useDestructiveConfirm for delete confirmation - Shows success toast after deletion - Removed custom modal dialog - AdminEmailTemplates: unified notification style - Replaced dialog.alert with useNotify.warning - Now shows beautiful Toast on mobile browser - Added deleteSuccess i18n translations (ru, en, zh, fa)
This commit is contained in:
@@ -9,7 +9,8 @@ import {
|
||||
EmailTemplateLanguageData,
|
||||
} from '../api/adminEmailTemplates';
|
||||
import { AdminBackButton, BackIcon } from '../components/admin';
|
||||
import { useIsTelegram, usePlatform } from '../platform/hooks/usePlatform';
|
||||
import { useIsTelegram } from '../platform/hooks/usePlatform';
|
||||
import { useNotify } from '@/platform';
|
||||
|
||||
// Hook to check if on mobile
|
||||
function useIsMobile() {
|
||||
@@ -159,7 +160,7 @@ function TemplateEditor({
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
const { dialog } = usePlatform();
|
||||
const notify = useNotify();
|
||||
const isTelegram = useIsTelegram();
|
||||
const isMobile = useIsMobile();
|
||||
const isPreviewDisabled = isTelegram || isMobile;
|
||||
@@ -401,7 +402,7 @@ function TemplateEditor({
|
||||
<button
|
||||
onClick={() => {
|
||||
if (isPreviewDisabled) {
|
||||
dialog.alert(
|
||||
notify.warning(
|
||||
t('admin.emailTemplates.previewDesktopOnly'),
|
||||
t('admin.emailTemplates.previewNotAvailable'),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user