Skip to content

Commit

Permalink
Merge branch 'dev' into IN-831-edit-organization-page
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Karow <[email protected]>
  • Loading branch information
JoeKarow authored Dec 28, 2023
2 parents 5590be7 + c87d0be commit 98efd02
Show file tree
Hide file tree
Showing 91 changed files with 606 additions and 10,713 deletions.
107 changes: 10 additions & 97 deletions packages/ui/components/core/ActionButtons.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { type Meta, type StoryObj } from '@storybook/react'

import { getTRPCMock } from '~ui/lib/getTrpcMock'
import { createAndSave, getAll, saveItem } from '~ui/mockData/savedList'
import { organization } from '~ui/mockData/organization'
import { review } from '~ui/mockData/review'
import { savedList } from '~ui/mockData/savedList'

import { ActionButtons as ActionButtonsComponent } from './ActionButtons'

Expand All @@ -16,34 +18,11 @@ export default {
layout: 'fullscreen',
layoutWrapper: 'centeredHalf',
msw: [
getTRPCMock({
path: ['organization', 'getIdFromSlug'],
type: 'query',
response: {
id: 'orgn_ORGANIZATIONID',
},
}),
getTRPCMock({
path: ['review', 'create'],
type: 'mutation',
response: {
id: 'orev_NEWREVIEWID',
},
}),
getTRPCMock({
path: ['savedList', 'getAll'],
response: getAll,
}),
getTRPCMock({
path: ['savedList', 'saveItem'],
type: 'mutation',
response: saveItem,
}),
getTRPCMock({
path: ['savedList', 'createAndSaveItem'],
type: 'mutation',
response: createAndSave,
}),
organization.getIdFromSlug,
review.create,
savedList.getAll,
savedList.saveItem,
savedList.createAndSaveItem,
],
nextjs: {
router: {
Expand Down Expand Up @@ -89,38 +68,7 @@ export const SavedToSingleList = {
nextAuthMock: {
session: 'userPic',
},
msw: [
getTRPCMock({
path: ['savedList', 'isSaved'],
response: [
{
id: 'listId',
name: 'List Name',
},
],
}),
getTRPCMock({
path: ['savedList', 'getAll'],
response: getAll,
}),
getTRPCMock({
path: ['savedList', 'deleteItem'],
type: 'mutation',
response: {
id: 'listId',
name: 'list name',
organizations: [],
services: [],
},
}),
getTRPCMock({
path: ['organization', 'getIdFromSlug'],
type: 'query',
response: {
id: 'orgn_ORGANIZATIONID',
},
}),
],
msw: [savedList.isSavedSingle, savedList.deleteItem, organization.getIdFromSlug],
},
} satisfies StoryDef
export const SavedToMultipleLists = {
Expand All @@ -131,42 +79,7 @@ export const SavedToMultipleLists = {
nextAuthMock: {
session: 'userPic',
},
msw: [
getTRPCMock({
path: ['savedList', 'isSaved'],
response: [
{
id: 'listId1',
name: 'List Name 1',
},
{
id: 'listId2',
name: 'List Name 2',
},
],
}),
getTRPCMock({
path: ['savedList', 'getAll'],
response: getAll,
}),
getTRPCMock({
path: ['savedList', 'deleteItem'],
type: 'mutation',
response: {
id: 'listId',
name: 'list name',
organizations: [],
services: [],
},
}),
getTRPCMock({
path: ['organization', 'getIdFromSlug'],
type: 'query',
response: {
id: 'orgn_ORGANIZATIONID',
},
}),
],
msw: [savedList.isSavedMultiple, savedList.getAll, savedList.deleteItem, organization.getIdFromSlug],
},
} satisfies StoryDef
export const Share = {
Expand Down
25 changes: 3 additions & 22 deletions packages/ui/components/core/SearchBox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { type Meta, type StoryObj } from '@storybook/react'
import { type ComponentProps, useState } from 'react'
import { type SetOptional } from 'type-fest'

import { getTRPCMock } from '~ui/lib/getTrpcMock'
import { mockAutocomplete, mockGeocode } from '~ui/mockData/locationSearch'
import { mockOrgNameSearch } from '~ui/mockData/orgSearch'
import { geo } from '~ui/mockData/geo'
import { organization } from '~ui/mockData/organization'

import { SearchBox as SearchBoxComp } from './SearchBox'

Expand All @@ -22,25 +21,7 @@ export default {
type: 'figma',
url: 'https://www.figma.com/file/gl8ppgnhpSq1Dr7Daohk55/Design-System-(2023)?node-id=51%3A493&t=AVaWASBVFglQPwtW-0',
},
msw: [
getTRPCMock({
path: ['organization', 'searchName'],
type: 'query',
response: (input) => mockOrgNameSearch(input),
delay: 1500,
}),
getTRPCMock({
path: ['geo', 'autocomplete'],
type: 'query',
response: (input) => mockAutocomplete(input),
delay: 2000,
}),
getTRPCMock({
path: ['geo', 'geoByPlaceId'],
type: 'query',
response: (input) => mockGeocode(input),
}),
],
msw: [organization.searchName, geo.autocompleteSearchBox, geo.geocodeSearchBox],
layoutWrapper: 'centeredFullscreen',
rqDevtools: true,
},
Expand Down
69 changes: 57 additions & 12 deletions packages/ui/components/core/SearchResultCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { type Meta } from '@storybook/react'

import { StorybookGridDouble } from '~ui/layouts'
import { searchResultLongTitle, searchResultsMock } from '~ui/mockData/searchResults'
import { trpc } from '~ui/lib/trpcClient'
import { organization } from '~ui/mockData/organization'

import { SearchResultCard } from './SearchResultCard'

Expand All @@ -20,24 +21,68 @@ export default {
} satisfies Meta<typeof SearchResultCard>

export const SingleResult = {
args: {
result: searchResultsMock.orgs[0],
parameters: {
msw: [organization.searchDistance],
},
render: () => {
const { data } = trpc.organization.searchDistance.useQuery({
dist: 0,
lat: 0,
lon: 0,
unit: 'mi',
skip: 0,
take: 0,
})
if (!data) return <>Loading mock data</>
const item = data.orgs.at(0)
if (!item) return <>Something is wrong with the mock data</>
return <SearchResultCard result={item} />
},
}
export const SingleResultWithLongName = {
args: {
result: searchResultLongTitle,
parameters: {
msw: [organization.searchDistanceLongTitle],
},
render: () => {
const { data } = trpc.organization.searchDistance.useQuery({
dist: 0,
lat: 0,
lon: 0,
unit: 'mi',
skip: 0,
take: 0,
})
if (!data) return <>Loading mock data</>
const item = data.orgs.at(0)
if (!item) return <>Something is wrong with the mock data</>
return <SearchResultCard result={item} />
},
}

export const MultipleResults = {
render: () => (
<>
{searchResultsMock.orgs.map((result) => (
<SearchResultCard key={result.id} result={result} />
))}
</>
),
parameters: {
msw: [organization.searchDistance],
},
render: () => {
const { data } = trpc.organization.searchDistance.useQuery({
dist: 0,
lat: 0,
lon: 0,
unit: 'mi',
skip: 0,
take: 0,
})
if (!data) return <>Loading mock data</>
const item = data.orgs.at(0)
if (!item) return <>Something is wrong with the mock data</>
return (
<>
{data.orgs.map((result) => (
<SearchResultCard key={result.id} result={result} />
))}
</>
)
},
}
export const SingleLoading = {
args: {
Expand Down
10 changes: 2 additions & 8 deletions packages/ui/components/data-display/ContactInfo.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Meta, type StoryObj } from '@storybook/react'

import { getTRPCMock } from '~ui/lib/getTrpcMock'
import { organization } from '~ui/mockData/organization'
import { orgEmail } from '~ui/mockData/orgEmail'
import { orgPhone } from '~ui/mockData/orgPhone'
import { orgSocialMedia } from '~ui/mockData/orgSocialMedia'
Expand All @@ -25,13 +25,7 @@ export default {
},
},
msw: [
getTRPCMock({
path: ['organization', 'getIdFromSlug'],
type: 'query',
response: {
id: 'orgn_ORGANIZATIONID',
},
}),
organization.getIdFromSlug,
orgEmail.forContactInfo,
orgPhone.forContactInfo,
orgWebsite.forContactInfo,
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/components/data-portal/AddressDrawer.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { type Meta, type StoryObj } from '@storybook/react'
import { Button } from '~ui/components/core/Button'
import { getTRPCMock } from '~ui/lib/getTrpcMock'
import { fieldOpt } from '~ui/mockData/fieldOpt'
import { geoMocks } from '~ui/mockData/geo'
import { geo } from '~ui/mockData/geo'
import { location } from '~ui/mockData/location'
import { organization } from '~ui/mockData/organization'
import { service } from '~ui/mockData/orgService'
import { service } from '~ui/mockData/service'

import { AddressDrawer } from './AddressDrawer'

Expand All @@ -26,8 +26,8 @@ export default {
},
},
msw: [
geoMocks.autocomplete,
geoMocks.geocodeFullAddress,
geo.autocompleteFullAddress,
geo.geocodeFullAddress,
fieldOpt.govDistsByCountryNoSub,
organization.getIdFromSlug,
service.getNames,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { type Meta, type StoryObj } from '@storybook/react'

import { Button } from '~ui/components/core/Button'
import { allFieldOptHandlers } from '~ui/mockData/fieldOpt'
import { location } from '~ui/mockData/location'
import { organization } from '~ui/mockData/organization'
import { orgEmail } from '~ui/mockData/orgEmail'
import { location } from '~ui/mockData/orgLocation'
import { service } from '~ui/mockData/orgService'
import { service } from '~ui/mockData/service'

import { EmailTableDrawer } from './EmailTableDrawer'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { type Meta, type StoryObj } from '@storybook/react'
import { Button } from '~ui/components/core/Button'
import { getTRPCMock } from '~ui/lib/getTrpcMock'
import { fieldOpt } from '~ui/mockData/fieldOpt'
import { geoMocks } from '~ui/mockData/geo'
import { location } from '~ui/mockData/location'
import { organization } from '~ui/mockData/organization'
import { orgHours } from '~ui/mockData/orgHours'
import { service } from '~ui/mockData/orgService'
import { service } from '~ui/mockData/service'

import { HoursDrawer } from './index'

Expand All @@ -28,8 +27,6 @@ export default {
},
},
msw: [
geoMocks.autocomplete,
geoMocks.geocodeFullAddress,
fieldOpt.govDistsByCountryNoSub,
organization.getIdFromSlug,
service.getNames,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { type Meta, type StoryObj } from '@storybook/react'

import { Button } from '~ui/components/core/Button'
import { location } from '~ui/mockData/location'
import { organization } from '~ui/mockData/organization'
import { location } from '~ui/mockData/orgLocation'
import { orgPhone } from '~ui/mockData/orgPhone'
import { service } from '~ui/mockData/orgService'
import { service } from '~ui/mockData/service'
import { phoneEmailFieldMocks } from '~ui/modals/dataPortal/PhoneEmail/fields.stories'

import { PhoneTableDrawer } from './PhoneTableDrawer'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type Meta, type StoryObj } from '@storybook/react'
import { Button } from '~ui/components/core/Button'
import { fieldOpt } from '~ui/mockData/fieldOpt'
import { organization } from '~ui/mockData/organization'
import { service } from '~ui/mockData/orgService'
import { service } from '~ui/mockData/service'

import { ServiceEditDrawer } from './ServiceEditDrawer'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type Meta, type StoryObj } from '@storybook/react'

import { Button } from '~ui/components/core/Button'
import { organization } from '~ui/mockData/organization'
import { service } from '~ui/mockData/orgService'
import { service } from '~ui/mockData/service'

import { ServicesDrawer } from './ServicesDrawer'

Expand Down
9 changes: 2 additions & 7 deletions packages/ui/components/sections/Contact.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type Meta, type StoryObj } from '@storybook/react'
import { StorybookGridSingle } from '~ui/layouts'
import { getTRPCMock } from '~ui/lib/getTrpcMock'
import { miscMock } from '~ui/mockData/misc'
import { organization } from '~ui/mockData/organization'
import { orgEmail } from '~ui/mockData/orgEmail'
import { orgPhone } from '~ui/mockData/orgPhone'
import { orgSocialMedia } from '~ui/mockData/orgSocialMedia'
Expand All @@ -29,13 +30,7 @@ export default {
},
},
msw: [
getTRPCMock({
path: ['organization', 'getIdFromSlug'],
type: 'query',
response: {
id: 'orgn_ORGANIZATIONID',
},
}),
organization.getIdFromSlug,
orgEmail.forContactInfo,
orgPhone.forContactInfo,
orgWebsite.forContactInfo,
Expand Down
Loading

0 comments on commit 98efd02

Please sign in to comment.