feat: show synthetic email warning in NotificationsPage
This commit is contained in:
@@ -6,11 +6,14 @@ import Stack from '@mui/material/Stack'
|
|||||||
import Switch from '@mui/material/Switch'
|
import Switch from '@mui/material/Switch'
|
||||||
import Typography from '@mui/material/Typography'
|
import Typography from '@mui/material/Typography'
|
||||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||||
|
import { useUnit } from 'effector-react'
|
||||||
import {
|
import {
|
||||||
fetchUserNotificationSettings,
|
fetchUserNotificationSettings,
|
||||||
updateUserNotificationSettings,
|
updateUserNotificationSettings,
|
||||||
} from '@/entities/notification/api/notifications-api'
|
} from '@/entities/notification/api/notifications-api'
|
||||||
import type { UserNotificationSettings } from '@/entities/notification/api/notifications-api'
|
import type { UserNotificationSettings } from '@/entities/notification/api/notifications-api'
|
||||||
|
import { isSyntheticEmail } from '@/shared/lib/is-synthetic-email'
|
||||||
|
import { $user } from '@/shared/model/auth'
|
||||||
|
|
||||||
function isOrderStatusChangesOn(s: UserNotificationSettings): boolean {
|
function isOrderStatusChangesOn(s: UserNotificationSettings): boolean {
|
||||||
return s.orderCreated && s.orderStatusChanged && s.paymentStatusChanged && s.deliveryFeeAdjusted
|
return s.orderCreated && s.orderStatusChanged && s.paymentStatusChanged && s.deliveryFeeAdjusted
|
||||||
@@ -26,6 +29,7 @@ const orderStatusChangesPayload = (on: boolean) => ({
|
|||||||
export function NotificationsPage() {
|
export function NotificationsPage() {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
|
const user = useUnit($user)
|
||||||
|
|
||||||
const { data, isLoading } = useQuery({
|
const { data, isLoading } = useQuery({
|
||||||
queryKey: ['me', 'notifications', 'settings'],
|
queryKey: ['me', 'notifications', 'settings'],
|
||||||
@@ -63,6 +67,12 @@ export function NotificationsPage() {
|
|||||||
Настройте, какие уведомления вы хотите получать на почту.
|
Настройте, какие уведомления вы хотите получать на почту.
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
|
{user && isSyntheticEmail(user.email) && (
|
||||||
|
<Alert severity="info" sx={{ mb: 2 }}>
|
||||||
|
Ваша почта сгенерирована автоматически. Для получения уведомлений укажите реальную почту в настройках профиля.
|
||||||
|
</Alert>
|
||||||
|
)}
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<Alert severity="error" sx={{ mb: 2 }}>
|
<Alert severity="error" sx={{ mb: 2 }}>
|
||||||
{error}
|
{error}
|
||||||
|
|||||||
Reference in New Issue
Block a user