Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature decreis directives page #178

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/decreis-directives/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import NotificationsPage from 'widgets/notifications'

const DecreisDirectivesPage = () => {
return <NotificationsPage type="docs" title={'Приказы и распоряжения'} />
return <NotificationsPage docsOnly title={'Приказы и распоряжения'} />
}

export default DecreisDirectivesPage
2 changes: 1 addition & 1 deletion src/pages/personal-notifications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import NotificationsPage from '../../widgets/notifications'

const PersonalNotificationsPage = () => {
return <NotificationsPage type="notifications" title={'Кадровые уведомления'} />
return <NotificationsPage title={'Кадровые уведомления'} />
}

export default PersonalNotificationsPage
15 changes: 11 additions & 4 deletions src/widgets/notifications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ const ElementsControlNotification = styled.div`

interface Props {
title: string
type: 'notifications' | 'docs'
docsOnly?: boolean
}

const NotificationsPage = ({ title, type }: Props) => {
const NotificationsPage = ({ title, docsOnly }: Props) => {
const { data: notifications, error } = personalNotificationModel.selectors.usePersonalNotifications()
const [foundNotification, setFoundNotification] = useState<Notifications>()
const [searchValue, setSearchValue] = useState<string>('')
Expand All @@ -47,7 +47,7 @@ const NotificationsPage = ({ title, type }: Props) => {
return (
<Wrapper
load={() => {
personalNotificationModel.effects.setNotificationsType(type)
personalNotificationModel.effects.setNotificationsType(docsOnly ? 'docs' : 'notifications')
personalNotificationModel.effects.getPersonalNotificationsFx()
}}
error={error}
Expand All @@ -67,7 +67,7 @@ const NotificationsPage = ({ title, type }: Props) => {
/>
<Select items={items} selected={selected} setSelected={setSelected} />
</ElementsControlNotification>
{type === 'docs' && foundNotification?.docs ? (
{docsOnly && foundNotification?.docs ? (
<ListNotification listNotification={foundNotification?.docs} typeList="docs" />
) : (
<SliderPage
Expand Down Expand Up @@ -99,6 +99,13 @@ const NotificationsPage = ({ title, type }: Props) => {
/>
),
},
{
title: '',
condition: !docsOnly,
content: foundNotification?.docs && (
<ListNotification listNotification={foundNotification?.docs} typeList="docs" />
),
},
]}
className="slider-list-notification"
/>
Expand Down