Skip to content

Commit

Permalink
Update article content
Browse files Browse the repository at this point in the history
  • Loading branch information
nothing9537 committed Nov 1, 2023
1 parent 7dde18e commit fd688a0
Show file tree
Hide file tree
Showing 11 changed files with 251 additions and 182 deletions.
1 change: 1 addition & 0 deletions extractedTranslations/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"desc-sort": "desc-sort",
"design-variant": "design-variant",
"edit": "edit",
"edit-page": "edit-page",
"enter-pass": "enter-pass",
"enter-password": "enter-password",
"enter-username": "enter-username",
Expand Down
1 change: 1 addition & 0 deletions extractedTranslations/ru/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"desc-sort": "desc-sort",
"design-variant": "design-variant",
"edit": "edit",
"edit-page": "edit-page",
"enter-pass": "enter-pass",
"enter-password": "enter-password",
"enter-username": "enter-username",
Expand Down
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
<button form>

</button>
</body>

</html>
359 changes: 190 additions & 169 deletions json-server/db.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"send": "Send",
"close": "Close",
"let-your-feedback": "Let your feedback!",
"thanks-for-rate": "Thanks for your rate!"
"thanks-for-rate": "Thanks for your rate!",
"edit-page": "Edit page of article with"
}
3 changes: 2 additions & 1 deletion public/locales/ru/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"send": "Отправить",
"close": "Закрыть",
"let-your-feedback": "Оставьте ваш отзыв!",
"thanks-for-rate": "Спасибо за оценку!"
"thanks-for-rate": "Спасибо за оценку!",
"edit-page": "Страница редактирования статьи с"
}
18 changes: 17 additions & 1 deletion src/app/providers/RouterProvider/ui/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { Route, Routes } from 'react-router-dom';
import { getUserAuthData } from '@/entities/User';
import { useAppSelector } from '@/shared/lib/hooks/useAppSelector';
import { PageLoader } from '@/widgets/PageLoader';
import { AppLoaderLayout } from '@/shared/layouts/AppLoaderLayout';
import { classNames } from '@/shared/lib/classNames/classNames';
import { ToggleFeatures } from '@/shared/lib/features';

import { routeConfig } from '../config/routeConfig';
import { RequireAuth } from './RequireAuth';
import { RequireRole } from './RequireRole';
Expand Down Expand Up @@ -40,8 +44,20 @@ export const AppRouter: FC = memo(() => {
);
}), [authData]);

const PageLoadingSuspense = (
<ToggleFeatures
name="isAppRedesigned"
on={(
<div className={classNames('App_redesigned', {}, ['scroll'])} id="App">
<AppLoaderLayout />
</div>
)}
off={<PageLoader />}
/>
);

return (
<Suspense fallback={<PageLoader />}>
<Suspense fallback={PageLoadingSuspense}>
<Routes>
{routes}
</Routes>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { FC, memo } from 'react';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import { useAppTranslation } from '@/shared/lib/hooks/useAppTranslation';
import { classNames } from '@/shared/lib/classNames/classNames';
import { PageWrapper } from '@/widgets/PageWrapper';

import cls from './ArticleEditPage.module.scss';

interface ArticleEditPageProps {
className?: string;
}

const ArticleEditPage: FC<ArticleEditPageProps> = memo(({ className }) => {
const { t } = useTranslation();
const { t } = useAppTranslation('translation');
const { id } = useParams<{ id: string }>();

return (
<PageWrapper className={classNames(cls.ArticleEditPage, {}, [className])}>
{t('Article edit page')}
{`${t('edit-page')} id = ${id}`}
</PageWrapper>
);
});
Expand Down
3 changes: 3 additions & 0 deletions src/shared/layouts/MainLayout/some.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.foo {
/* margin: 1px; */
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

.content {
grid-area: content;
max-width: 1200px;
max-width: 1300px;
justify-self: center;
width: 100%;
display: flex;
Expand Down
31 changes: 25 additions & 6 deletions src/widgets/PageError/ui/PageError/PageError.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { FC } from 'react';
import { useTranslation } from 'react-i18next';
import { classNames } from '@/shared/lib/classNames/classNames';
import { Button } from '@/shared/ui/deprecated/Button';
import { Button as ButtonDeprecated } from '@/shared/ui/deprecated/Button';
import { Text as TextDeprecated, TextSize, TextTheme } from '@/shared/ui/deprecated/Text';
import { ToggleFeatures } from '@/shared/lib/features';
import { Button } from '@/shared/ui/redesigned/Button';
import { Text } from '@/shared/ui/redesigned/Text';

import cls from './PageError.module.scss';

interface PageErrorProps {
className?: string;
className?: string;
}

export const PageError: FC<PageErrorProps> = ({ className }) => {
Expand All @@ -15,10 +20,24 @@ export const PageError: FC<PageErrorProps> = ({ className }) => {

return (
<div className={classNames(cls.PageError, {}, [className])}>
<h1>{t('error-message')}</h1>
<Button onClick={reloadPage}>
{t('error-message-update-page')}
</Button>
<ToggleFeatures
name="isAppRedesigned"
on={<Text size="l" title={t('error-message')} variant="error" />}
off={<TextDeprecated size={TextSize.L} theme={TextTheme.ERROR} title={t('error-message')} />}
/>
<ToggleFeatures
name="isAppRedesigned"
on={(
<Button onClick={reloadPage}>
{t('error-message-update-page')}
</Button>
)}
off={(
<ButtonDeprecated onClick={reloadPage}>
{t('error-message-update-page')}
</ButtonDeprecated>
)}
/>
</div>
);
};

0 comments on commit fd688a0

Please sign in to comment.