From 16da3585bfe08fcb963d225fa646be4dc5623b55 Mon Sep 17 00:00:00 2001 From: algafur Date: Tue, 24 Sep 2024 11:54:26 +0500 Subject: [PATCH] fix: project --- src/app/providers/app.tsx | 19 +++++++++++++++++-- .../ui/dashboard-charts/dashboard-charts.tsx | 10 +++++++--- .../dashboard-payment/dashboard-payment.tsx | 3 +++ src/pages/settings/settings.tsx | 2 +- src/pages/settings/ui/posts/posts.tsx | 9 +++++---- src/pages/settings/ui/users/users.tsx | 9 +++++---- 6 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/app/providers/app.tsx b/src/app/providers/app.tsx index c6195b5..c08b17c 100644 --- a/src/app/providers/app.tsx +++ b/src/app/providers/app.tsx @@ -1,7 +1,7 @@ import { notification, NotificationArgsProps } from 'antd' import { INotificationType, INotifyContextType } from 'app/providers/model/interface' import { StoreProvider } from 'app/providers/ui/store-provider' -import React, { createContext, useContext, useMemo } from 'react' +import React, { createContext, useContext, useMemo, useState } from 'react' import { RouterProvider } from '@/app/providers/ui/router-provider' import { ThemeProvider } from '@/app/providers/ui/theme-provider' @@ -18,20 +18,35 @@ export const useNotify = () => { } export const App = () => { + const [notificationActive, setNotificationActive] = useState(false) + const openNotification = ( title: string, type?: INotificationType, subtitle?: string, placement?: NotificationArgsProps['placement'], ) => { + if (notificationActive) { + return + } + + setNotificationActive(true) + notification[type || 'error']({ message: title, description: subtitle, placement, + onClose: () => { + setNotificationActive(false) + }, }) } - const notifyContextValue = useMemo(() => ({ openNotification }), []) + notification.config({ + maxCount: 1, + }) + + const notifyContextValue = useMemo(() => ({ openNotification }), [notificationActive]) return ( diff --git a/src/pages/dashboard/ui/dashboard-charts/dashboard-charts.tsx b/src/pages/dashboard/ui/dashboard-charts/dashboard-charts.tsx index 83ddc6f..98e5e9f 100644 --- a/src/pages/dashboard/ui/dashboard-charts/dashboard-charts.tsx +++ b/src/pages/dashboard/ui/dashboard-charts/dashboard-charts.tsx @@ -57,9 +57,13 @@ export const DashboardCharts: FC = () => { alignItems: 'center', }} > - {postsData.map((item) => ( - - ))} + {postsData.length ? ( + postsData.map((item) => ( + + )) + ) : ( +
Нет данных
+ )} ) diff --git a/src/pages/dashboard/ui/dashboard-payment/dashboard-payment.tsx b/src/pages/dashboard/ui/dashboard-payment/dashboard-payment.tsx index f1fa3cc..075b070 100644 --- a/src/pages/dashboard/ui/dashboard-payment/dashboard-payment.tsx +++ b/src/pages/dashboard/ui/dashboard-payment/dashboard-payment.tsx @@ -14,6 +14,9 @@ export const DashboardPayment: FC = ({ total, sum, colum pagination={{ total: total, }} + scroll={{ + x: 'max-content', + }} />
{'Итого: ' + sum} diff --git a/src/pages/settings/settings.tsx b/src/pages/settings/settings.tsx index fb06c3d..7d6c4f7 100644 --- a/src/pages/settings/settings.tsx +++ b/src/pages/settings/settings.tsx @@ -5,7 +5,7 @@ import { FC } from 'react' export const Settings: FC = () => { return ( - + diff --git a/src/pages/settings/ui/posts/posts.tsx b/src/pages/settings/ui/posts/posts.tsx index 4b0deef..db78ea2 100644 --- a/src/pages/settings/ui/posts/posts.tsx +++ b/src/pages/settings/ui/posts/posts.tsx @@ -16,7 +16,7 @@ export const Posts: FC = () => { } = usePostsTable() return ( - <> +
Посты