mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
fix: unify toast notifications and improve visual/behavior
- Solid opaque background with colored left border instead of translucent gradient - Max 3 visible toasts with oldest eviction - Telegram safe area support via env(safe-area-inset-*) - Dismiss by clicking anywhere on toast, removed X button - Adaptive width: full-width on mobile, fixed on desktop - AdminEmailTemplates: removed local toast, migrated to useNotify - AdminUsers: migrated from useToast to useNotify
This commit is contained in:
@@ -2,9 +2,9 @@ import { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useCurrency } from '../hooks/useCurrency';
|
||||
import { useToast } from '../components/Toast';
|
||||
import { adminUsersApi, type UserListItem, type UsersStatsResponse } from '../api/adminUsers';
|
||||
import { usePlatform } from '../platform/hooks/usePlatform';
|
||||
import { useNotify } from '../platform/hooks/useNotify';
|
||||
|
||||
// ============ Icons ============
|
||||
|
||||
@@ -394,7 +394,7 @@ export default function AdminUsers() {
|
||||
const { t } = useTranslation();
|
||||
const { formatWithCurrency } = useCurrency();
|
||||
const navigate = useNavigate();
|
||||
const { showToast } = useToast();
|
||||
const notify = useNotify();
|
||||
const { capabilities } = usePlatform();
|
||||
|
||||
const [users, setUsers] = useState<UserListItem[]>([]);
|
||||
@@ -492,27 +492,15 @@ export default function AdminUsers() {
|
||||
}
|
||||
|
||||
if (result.success) {
|
||||
showToast({
|
||||
type: 'success',
|
||||
title: t('common.success'),
|
||||
message: t(`admin.users.userActions.success.${action}`),
|
||||
});
|
||||
notify.success(t(`admin.users.userActions.success.${action}`), t('common.success'));
|
||||
loadUsers();
|
||||
loadStats();
|
||||
} else {
|
||||
showToast({
|
||||
type: 'error',
|
||||
title: t('common.error'),
|
||||
message: result.message || t('admin.users.userActions.error'),
|
||||
});
|
||||
notify.error(result.message || t('admin.users.userActions.error'), t('common.error'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Action failed:', error);
|
||||
showToast({
|
||||
type: 'error',
|
||||
title: t('common.error'),
|
||||
message: t('admin.users.userActions.error'),
|
||||
});
|
||||
notify.error(t('admin.users.userActions.error'), t('common.error'));
|
||||
} finally {
|
||||
setActionLoading(false);
|
||||
closeConfirmModal();
|
||||
|
||||
Reference in New Issue
Block a user