Use FieldDefinition for company show page (#1171)

* Use FieldDefinition for company show page

* removing console.log

* fix conflicts

* fix address placeholder + company show page field definition ordering

* fix story

* add replacePlaceholder

* use AppPath enum in stories

* add routeParams

* fix people input story
This commit is contained in:
Weiko
2023-08-11 14:31:52 -07:00
committed by GitHub
parent 3978ef4edb
commit 4eb4d1488c
43 changed files with 463 additions and 478 deletions

View File

@ -21,6 +21,7 @@ import { ShowPageContainer } from '../../modules/ui/layout/components/ShowPageCo
export function PersonShow() {
const personId = useParams().personId ?? '';
const { insertPersonFavorite, deletePersonFavorite } = useFavorites();
const { data } = usePersonQuery(personId);

View File

@ -3,6 +3,7 @@ import type { Meta } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import assert from 'assert';
import { AppPath } from '@/types/AppPath';
import {
PageDecorator,
type PageDecoratorArgs,
@ -18,7 +19,7 @@ const meta: Meta<PageDecoratorArgs> = {
title: 'Pages/People/FilterBy',
component: People,
decorators: [PageDecorator],
args: { currentPath: '/people' },
args: { routePath: AppPath.PeoplePage },
parameters: {
docs: { story: 'inline', iframeHeight: '500px' },
msw: graphqlMocks,

View File

@ -6,6 +6,7 @@ import { graphql } from 'msw';
import { UPDATE_ONE_PERSON } from '@/people/queries';
import { SEARCH_COMPANY_QUERY } from '@/search/queries/search';
import { AppPath } from '@/types/AppPath';
import { Company } from '~/generated/graphql';
import {
PageDecorator,
@ -25,7 +26,7 @@ const meta: Meta<PageDecoratorArgs> = {
title: 'Pages/People/Input',
component: People,
decorators: [PageDecorator],
args: { currentPath: '/people' },
args: { routePath: AppPath.PeoplePage },
parameters: {
docs: { story: 'inline', iframeHeight: '500px' },
msw: graphqlMocks,
@ -216,14 +217,6 @@ export const EditRelation: Story = {
await userEvent.click(airbnbChip);
});
await step(
'Click on last row company cell to exit relation picker',
async () => {
const otherCell = await canvas.findByText('Janice Dane');
await userEvent.click(otherCell);
},
);
await step('Check if Airbnb is in second row company cell', async () => {
await canvas.findByText('Airbnb');
});

View File

@ -2,6 +2,7 @@ import { expect } from '@storybook/jest';
import type { Meta } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { AppPath } from '@/types/AppPath';
import {
PageDecorator,
type PageDecoratorArgs,
@ -17,7 +18,7 @@ const meta: Meta<PageDecoratorArgs> = {
title: 'Pages/People/SortBy',
component: People,
decorators: [PageDecorator],
args: { currentPath: '/people' },
args: { routePath: AppPath.PeoplePage },
parameters: {
docs: { story: 'inline', iframeHeight: '500px' },
msw: graphqlMocks,

View File

@ -1,5 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react';
import { AppPath } from '@/types/AppPath';
import {
PageDecorator,
type PageDecoratorArgs,
@ -12,7 +13,7 @@ const meta: Meta<PageDecoratorArgs> = {
title: 'Pages/People',
component: People,
decorators: [PageDecorator],
args: { currentPath: '/people' },
args: { routePath: AppPath.PeoplePage },
parameters: {
docs: { story: 'inline', iframeHeight: '500px' },
msw: graphqlMocks,

View File

@ -1,6 +1,6 @@
import { Route, Routes } from 'react-router-dom';
import type { Meta, StoryObj } from '@storybook/react';
import { AppPath } from '@/types/AppPath';
import {
PageDecorator,
type PageDecoratorArgs,
@ -13,15 +13,11 @@ import { PersonShow } from '../PersonShow';
const meta: Meta<PageDecoratorArgs> = {
title: 'Pages/People/Person',
component: PersonShow,
decorators: [
(Story) => (
<Routes>
<Route path="/person/:personId" element={<Story />} />
</Routes>
),
PageDecorator,
],
args: { currentPath: `/person/${mockedPeopleData[0].id}` },
decorators: [PageDecorator],
args: {
routePath: AppPath.PersonShowPage,
routeParams: { ':personId': mockedPeopleData[0].id },
},
parameters: {
docs: { story: 'inline', iframeHeight: '500px' },
msw: graphqlMocks,