-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e340f43
commit 755f8a9
Showing
11 changed files
with
74 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"Произошла ошибка при загрезке статей": "An error occurred while uploading articles" | ||
"Произошла ошибка при загрезке статей": "An error occurred while uploading articles", | ||
"Добро пожаловать на страницу статей!": "Welcome to the articles page!", | ||
"Здесь вы можете просматривать и искать статьи на различные темы.": "Here you can browse and search for articles on various topics." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"Произошла ошибка при загрезке статей": "Произошла ошибка при загрезке статей" | ||
"Произошла ошибка при загрезке статей": "Произошла ошибка при загрезке статей", | ||
"Добро пожаловать на страницу статей!": "Добро пожаловать на страницу статей!", | ||
"Здесь вы можете просматривать и искать статьи на различные темы.": "Здесь вы можете просматривать и искать статьи на различные темы." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { ArticlePageGetting } from './ui/ArticlePageGetting/ArticlePageGetting' |
48 changes: 48 additions & 0 deletions
48
src/features/articlePageGetting/ui/ArticlePageGetting/ArticlePageGetting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { useTranslation } from 'react-i18next' | ||
import { memo, useCallback, useEffect, useState } from 'react' | ||
import { isMobile } from 'react-device-detect' | ||
|
||
import { Modal } from '@/shared/ui/Modal' | ||
import { Text } from '@/shared/ui/Text' | ||
import { saveJsonSettings, useJsonUserSettings } from '@/entities/User' | ||
import { useAppDispatch } from '@/shared/lib/hooks/useAppDispatch/useAppDispatch' | ||
import { Drawer } from '@/shared/ui/Drawer' | ||
|
||
export const ArticlePageGetting = memo(() => { | ||
const { t } = useTranslation('articles-page') | ||
|
||
const [isOpen, setIsOpen] = useState(false) | ||
const { isArticlePageWasOpen } = useJsonUserSettings() | ||
const dispatch = useAppDispatch() | ||
|
||
const text = ( | ||
<Text | ||
title={t('Добро пожаловать на страницу статей!')} | ||
text={t('Здесь вы можете просматривать и искать статьи на различные темы.')} | ||
/> | ||
) | ||
|
||
useEffect(() => { | ||
if (!isArticlePageWasOpen) { | ||
setIsOpen(true) | ||
dispatch(saveJsonSettings({ isArticlePageWasOpen: true })) | ||
} | ||
}, [dispatch, isArticlePageWasOpen]) | ||
|
||
const onClose = useCallback(() => { | ||
setIsOpen(false) | ||
}, []) | ||
|
||
if (isMobile) { | ||
return ( | ||
<Drawer onClose={onClose} isOpen={isOpen}> | ||
{text} | ||
</Drawer> | ||
) | ||
} | ||
return ( | ||
<Modal lazy onClose={onClose} isOpen={isOpen}> | ||
{text} | ||
</Modal> | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters