Skip to content

Commit

Permalink
add an ArticlePage page
Browse files Browse the repository at this point in the history
  • Loading branch information
stasguma committed Apr 20, 2024
1 parent de5de2b commit 73c9489
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 36 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ jobs:
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
buildScriptName: storybook:build
exitZeroOnChanges: true

build:
name: Build
Expand Down
Empty file removed build-storybook.log
Empty file.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"lint:scss": "pnpm dlx stylelint \"**/*.scss\"",
"lint:scss:fix": "pnpm dlx stylelint \"**/*.scss\" --fix",
"lint": "pnpm lint:jsts && pnpm lint:scss",
"test": "vitest",
"test:unit": "vitest",
"test:ui": "pnpm dlx chromatic --build-script-name=storybook:build",
"storybook": "storybook dev -p 6006 -c ./config/storybook",
Expand Down
10 changes: 5 additions & 5 deletions src/app/providers/router/ui/routerConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { HomePage } from '@/pages/HomePage';
import { AboutPage } from '@/pages/AboutPage';
import { ProfilePage } from '@/pages/ProfilePage';
import { ArticlesPage } from '@/pages/ArticlesPage';
import { ArticleDetailsPage } from '@/pages/ArticleDetailsPage';
import { ArticlePage } from '@/pages/ArticlePage';
import { Error404Page } from '@/pages/Error404Page';
import { PrivateGuard } from '../lib/PrivateGuard';

Expand All @@ -15,7 +15,7 @@ const AppRouteNames = {
ABOUT: 'about',
PROFILE: 'profile',
ARTICLES: 'articles',
ARTICLE_DETAILS: 'articleDetails',
ARTICLE: 'articleDetails',
ERROR404: 'error404',
} as const;

Expand All @@ -24,7 +24,7 @@ const AppRoutePaths = {
ABOUT: '/about',
PROFILE: '/profile',
ARTICLES: '/articles',
ARTICLE_DETAILS: '/article/:id',
ARTICLE: '/article/:id',
ERROR404: '*',
} as const;

Expand All @@ -36,7 +36,7 @@ export const AppRoutes: Record<
[AppRouteNames.ABOUT]: AppRoutePaths.ABOUT,
[AppRouteNames.PROFILE]: AppRoutePaths.PROFILE,
[AppRouteNames.ARTICLES]: AppRoutePaths.ARTICLES,
[AppRouteNames.ARTICLE_DETAILS]: AppRoutePaths.ARTICLE_DETAILS,
[AppRouteNames.ARTICLE]: AppRoutePaths.ARTICLE,
[AppRouteNames.ERROR404]: AppRoutePaths.ERROR404,
};

Expand All @@ -63,7 +63,7 @@ const routerConfig: RouteObject[] = [
},
{
path: AppRoutes.articleDetails,
element: <PrivateGuard><ArticleDetailsPage /></PrivateGuard>,
element: <PrivateGuard><ArticlePage /></PrivateGuard>,
},
],
},
Expand Down
2 changes: 2 additions & 0 deletions src/entities/Session/model/slice/sessionSlice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('sessionSlice', () => {
token: undefined,
isAuthenticated: false,
error: undefined,
sessionInited: false,
});
});

Expand All @@ -25,6 +26,7 @@ describe('sessionSlice', () => {
username: 'Tomas',
token: 'Bearer asdasdasda',
isAuthenticated: true,
sessionInited: true,
};

LocalStorage.setItem(LOCAL_STORAGE_SESSION_KEY, sessionData);
Expand Down
10 changes: 0 additions & 10 deletions src/pages/ArticleDetailsPage/index.tsx

This file was deleted.

This file was deleted.

10 changes: 10 additions & 0 deletions src/pages/ArticlePage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { lazy } from 'react';

// /* eslint-disable-next-line */
const ArticlePageAsync = lazy(() => {
return new Promise((resolve) => {
setTimeout(() => resolve(import('./ui/ArticlePage/ArticlePage')), 2000);
});
});

export { ArticlePageAsync as ArticlePage };
17 changes: 17 additions & 0 deletions src/pages/ArticlePage/ui/ArticlePage/ArticlePage.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { Meta, StoryObj } from '@storybook/react';

import { withStoreDecorator } from '@/shared/config/storybook/decorators/withStoreDecorator';
import ArticlePage from './ArticlePage';

const meta: Meta<typeof ArticlePage> = {
title: 'Pages/ArticlePage',
component: ArticlePage,
decorators: [withStoreDecorator()],
};

export default meta;
type Story = StoryObj<typeof ArticlePage>;

export const Default: Story = {
args: {},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import type { TReducers } from '@/shared/lib';
import { Suspense, memo } from 'react';
import { DynamicModuleLoader } from '@/shared/lib';
import { Loader } from '@/shared/ui';
import { articleSlice } from '@/entities/Article';
import { EntireArticle } from '@/widgets/EntireArticle';

const reducers: TReducers = {
// articleDetails: profileSlice.reducer,
article: articleSlice.reducer,
};

const ArticleDetailsPage: FC = () => {
const ArticlePage: FC = () => {
return (
<Suspense fallback={<Loader />}>
<DynamicModuleLoader reducers={reducers}>
ArticleDetailsPage
<EntireArticle />
</DynamicModuleLoader>
</Suspense>
);
};

export default memo(ArticleDetailsPage);
export default memo(ArticlePage);

0 comments on commit 73c9489

Please sign in to comment.