Skip to content

Commit

Permalink
fix: project
Browse files Browse the repository at this point in the history
  • Loading branch information
baynt1 committed Sep 24, 2024
1 parent 90d9dc2 commit 16da358
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 14 deletions.
19 changes: 17 additions & 2 deletions src/app/providers/app.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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 (
<RouterProvider>
Expand Down
10 changes: 7 additions & 3 deletions src/pages/dashboard/ui/dashboard-charts/dashboard-charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ export const DashboardCharts: FC = () => {
alignItems: 'center',
}}
>
{postsData.map((item) => (
<PostCard key={item.value} value={item.value} name={item.label} />
))}
{postsData.length ? (
postsData.map((item) => (
<PostCard key={item.value} value={item.value} name={item.label} />
))
) : (
<div>Нет данных</div>
)}
</div>
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export const DashboardPayment: FC<IDashboardPaymentProps> = ({ total, sum, colum
pagination={{
total: total,
}}
scroll={{
x: 'max-content',
}}
/>
<div style={{ display: 'flex', alignItems: 'end', justifyContent: 'end' }}>
{'Итого: ' + sum}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FC } from 'react'

export const Settings: FC = () => {
return (
<Flex gap={'10px'} style={{ flexDirection: 'column' }}>
<Flex style={{ flexDirection: 'column' }} justify={'space-between'}>
<Users />
<Posts />
</Flex>
Expand Down
9 changes: 5 additions & 4 deletions src/pages/settings/ui/posts/posts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const Posts: FC = () => {
} = usePostsTable()

return (
<>
<div style={{ minHeight: 350 }}>
<Flex gap={'10px'} align={'center'} style={{ marginBottom: '10px' }}>
<div style={{ fontSize: '28px' }}>Посты</div>
<Button
Expand All @@ -31,8 +31,9 @@ export const Posts: FC = () => {
</Flex>

<Table
style={{ minHeight: '500px' }}
scroll={{ y: 500 }}
scroll={{
x: 'max-content',
}}
columns={columns}
dataSource={posts}
bordered={true}
Expand All @@ -49,6 +50,6 @@ export const Posts: FC = () => {
refetch={fetchData}
item={currentPost}
/>
</>
</div>
)
}
9 changes: 5 additions & 4 deletions src/pages/settings/ui/users/users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const Users: FC = () => {
} = usersTable()

return (
<>
<div style={{ minHeight: 350 }}>
<Flex gap={'10px'} align={'center'} style={{ marginBottom: '10px' }}>
<div style={{ fontSize: '28px' }}>Пользователи</div>
<Button
Expand All @@ -31,8 +31,9 @@ export const Users: FC = () => {
</Flex>

<Table
style={{ minHeight: '500px' }}
scroll={{ y: 500 }}
scroll={{
x: 'max-content',
}}
columns={columns}
dataSource={users}
bordered={true}
Expand All @@ -49,6 +50,6 @@ export const Users: FC = () => {
item={currentUser}
refetch={fetchData}
/>
</>
</div>
)
}

0 comments on commit 16da358

Please sign in to comment.