-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tasks] Removing task list empty state (#1090)
* [Tasks] Removing task list empty state * separate no-tasks story in a different file to handle cache issues
- Loading branch information
Showing
8 changed files
with
143 additions
and
28 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
23 changes: 23 additions & 0 deletions
23
front/src/modules/activities/components/__stories__/TaskGroups.stories.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,23 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { TasksContext } from '@/activities/states/TasksContext'; | ||
import { ComponentWithRecoilScopeDecorator } from '~/testing/decorators/ComponentWithRecoilScopeDecorator'; | ||
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator'; | ||
import { graphqlMocks } from '~/testing/graphqlMocks'; | ||
|
||
import { TaskGroups } from '../TaskGroups'; | ||
|
||
const meta: Meta<typeof TaskGroups> = { | ||
title: 'Modules/Activity/TaskGroups', | ||
component: TaskGroups, | ||
decorators: [ComponentWithRouterDecorator, ComponentWithRecoilScopeDecorator], | ||
parameters: { | ||
msw: graphqlMocks, | ||
recoilScopeContext: TasksContext, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof TaskGroups>; | ||
|
||
export const Default: Story = {}; |
47 changes: 47 additions & 0 deletions
47
front/src/modules/activities/components/__stories__/TaskGroupsWithoutTasks.stories.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,47 @@ | ||
import { getOperationName } from '@apollo/client/utilities'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { graphql } from 'msw'; | ||
|
||
import { GET_ACTIVITIES } from '@/activities/queries'; | ||
import { TasksContext } from '@/activities/states/TasksContext'; | ||
import { ComponentWithRecoilScopeDecorator } from '~/testing/decorators/ComponentWithRecoilScopeDecorator'; | ||
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator'; | ||
import { graphqlMocks } from '~/testing/graphqlMocks'; | ||
|
||
import { TaskGroups } from '../TaskGroups'; | ||
|
||
const meta: Meta<typeof TaskGroups> = { | ||
title: 'Modules/Activity/TaskGroupsWithoutTasks', | ||
component: TaskGroups, | ||
decorators: [ComponentWithRouterDecorator, ComponentWithRecoilScopeDecorator], | ||
parameters: { | ||
msw: graphqlMocks, | ||
recoilScopeContext: TasksContext, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof TaskGroups>; | ||
|
||
export const Default: Story = { | ||
parameters: { | ||
msw: [ | ||
...graphqlMocks.filter( | ||
(graphqlMock) => | ||
graphqlMock.info.operationName !== getOperationName(GET_ACTIVITIES), | ||
), | ||
...[ | ||
graphql.query( | ||
getOperationName(GET_ACTIVITIES) ?? '', | ||
(_req, res, ctx) => { | ||
return res( | ||
ctx.data({ | ||
findManyActivities: [], | ||
}), | ||
); | ||
}, | ||
), | ||
], | ||
], | ||
}, | ||
}; |
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
12 changes: 12 additions & 0 deletions
12
front/src/testing/decorators/ComponentWithRecoilScopeDecorator.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,12 @@ | ||
import { Decorator } from '@storybook/react'; | ||
|
||
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope'; | ||
|
||
export const ComponentWithRecoilScopeDecorator: Decorator = ( | ||
Story, | ||
context, | ||
) => ( | ||
<RecoilScope SpecificContext={context.parameters.recoilScopeContext}> | ||
<Story /> | ||
</RecoilScope> | ||
); |
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