From def3a381ba859b9f0721b843eb8577299e7d6a89 Mon Sep 17 00:00:00 2001 From: Magdalena Markusik Date: Wed, 12 May 2021 11:11:17 +0200 Subject: [PATCH] Change more usages to map edges to items --- src/hooks/makeTopLevelSearch/utils.ts | 3 +- src/navigation/views/MenuList/MenuList.tsx | 12 +- .../OrderDetails/OrderDraftDetails/index.tsx | 2 +- src/pageTypes/views/PageTypeDetails.tsx | 4 +- .../views/PageTypeList/PageTypeList.tsx | 5 +- .../views/ProductTypeList/ProductTypeList.tsx | 3 +- .../views/ProductTypeUpdate/index.tsx | 6 +- .../views/ProductCreate/ProductCreate.tsx | 12 +- .../views/ProductList/ProductList.tsx | 19 +- .../views/ProductUpdate/ProductUpdate.tsx | 10 +- .../PriceRatesUpdate/PriceRatesUpdate.tsx | 7 +- src/shipping/views/ShippingZonesList.tsx | 10 +- .../WeightRatesUpdate/WeightRatesUpdate.tsx | 7 +- .../stories/categories/CategoryUpdatePage.tsx | 9 +- .../views/TranslationsEntities.tsx | 254 ++++++++---------- .../WarehouseList/WarehouseList.tsx | 11 +- .../views/WarehouseList/WarehouseList.tsx | 7 +- 17 files changed, 166 insertions(+), 215 deletions(-) diff --git a/src/hooks/makeTopLevelSearch/utils.ts b/src/hooks/makeTopLevelSearch/utils.ts index 61d2e8058..fcf9c1a41 100644 --- a/src/hooks/makeTopLevelSearch/utils.ts +++ b/src/hooks/makeTopLevelSearch/utils.ts @@ -1,4 +1,5 @@ import { FetchMoreProps } from "@saleor/types"; +import { mapEdgesToItems } from "@saleor/utils/maps"; import { ResultSearchData } from "./makeTopLevelSearch"; import { CommonSearchOpts } from "./types"; @@ -14,4 +15,4 @@ export const getSearchFetchMoreProps = ( }); export const getParsedSearchData = ({ data }: ResultSearchData) => - data?.search?.edges?.map(({ node }) => node) || []; + mapEdgesToItems(data?.search); diff --git a/src/navigation/views/MenuList/MenuList.tsx b/src/navigation/views/MenuList/MenuList.tsx index 6a3d2bcbb..0974162d5 100644 --- a/src/navigation/views/MenuList/MenuList.tsx +++ b/src/navigation/views/MenuList/MenuList.tsx @@ -11,6 +11,7 @@ import usePaginator, { } from "@saleor/hooks/usePaginator"; import { buttonMessages, commonMessages } from "@saleor/intl"; import { maybe } from "@saleor/misc"; +import { getById } from "@saleor/orders/components/OrderReturnPage/utils"; import { ListViews } from "@saleor/types"; import createSortHandler from "@saleor/utils/handlers/sortHandler"; import { mapEdgesToItems } from "@saleor/utils/maps"; @@ -209,13 +210,10 @@ const MenuList: React.FC = ({ params }) => { defaultMessage="Are you sure you want to delete {menuName}?" id="menuListDeleteMenuContent" values={{ - menuName: maybe( - () => - data.menus.edges.find( - edge => edge.node.id === params.id - ).node.name, - "..." - ) + menuName: + mapEdgesToItems(data?.menus).find( + getById(params.id) + )?.name || "..." }} /> diff --git a/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx b/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx index 5904982bb..db3459f80 100644 --- a/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx +++ b/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx @@ -172,7 +172,7 @@ export const OrderDraftDetails: React.FC = ({ order: id }) } - users={users?.data?.search?.edges?.map(edge => edge.node) || []} + users={mapEdgesToItems(users?.data?.search)} hasMore={users?.data?.search?.pageInfo?.hasNextPage || false} onFetchMore={loadMoreCustomers} fetchUsers={searchUsers} diff --git a/src/pageTypes/views/PageTypeDetails.tsx b/src/pageTypes/views/PageTypeDetails.tsx index 7b022ae3f..e47afb6d8 100644 --- a/src/pageTypes/views/PageTypeDetails.tsx +++ b/src/pageTypes/views/PageTypeDetails.tsx @@ -264,8 +264,8 @@ export const PageTypeDetails: React.FC = ({ deleteButtonState={deletePageTypeOpts.status} /> edge.node + attributes={mapEdgesToItems( + result?.data?.pageType?.availableAttributes )} confirmButtonState={assignAttributeOpts.status} errors={ diff --git a/src/pageTypes/views/PageTypeList/PageTypeList.tsx b/src/pageTypes/views/PageTypeList/PageTypeList.tsx index 77254572a..0736d854d 100644 --- a/src/pageTypes/views/PageTypeList/PageTypeList.tsx +++ b/src/pageTypes/views/PageTypeList/PageTypeList.tsx @@ -19,6 +19,7 @@ import { usePageTypeBulkDeleteMutation } from "@saleor/pageTypes/mutations"; import { ListViews } from "@saleor/types"; import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers"; import createSortHandler from "@saleor/utils/handlers/sortHandler"; +import { mapEdgesToItems } from "@saleor/utils/maps"; import { getSortParams } from "@saleor/utils/sort"; import React from "react"; import { useIntl } from "react-intl"; @@ -165,7 +166,7 @@ export const PageTypeList: React.FC = ({ params }) => { params }); - const pageTypesData = data?.pageTypes?.edges.map(edge => edge.node) || []; + const pageTypesData = mapEdgesToItems(data?.pageTypes); return ( <> @@ -179,7 +180,7 @@ export const PageTypeList: React.FC = ({ params }) => { onTabSave={() => openModal("save-search")} tabs={tabs.map(tab => tab.name)} disabled={loading} - pageTypes={data?.pageTypes?.edges?.map(edge => edge.node)} + pageTypes={pageTypesData} pageInfo={pageInfo} onAdd={() => navigate(pageTypeAddUrl)} onBack={() => navigate(configurationMenuUrl)} diff --git a/src/productTypes/views/ProductTypeList/ProductTypeList.tsx b/src/productTypes/views/ProductTypeList/ProductTypeList.tsx index d13060efa..57017b806 100644 --- a/src/productTypes/views/ProductTypeList/ProductTypeList.tsx +++ b/src/productTypes/views/ProductTypeList/ProductTypeList.tsx @@ -159,8 +159,7 @@ export const ProductTypeList: React.FC = ({ params }) => { params }); - const productTypesData = - data?.productTypes?.edges.map(edge => edge.node) || []; + const productTypesData = mapEdgesToItems(data?.productTypes); return ( = ({ <> {Object.keys(ProductAttributeType).map(key => ( - result.data.productType.availableAttributes.edges.map( - edge => edge.node - ) + attributes={mapEdgesToItems( + result?.data?.productType?.availableAttributes )} confirmButtonState={assignAttribute.opts.status} errors={maybe( diff --git a/src/products/views/ProductCreate/ProductCreate.tsx b/src/products/views/ProductCreate/ProductCreate.tsx index 84320d0b2..2818d3baf 100644 --- a/src/products/views/ProductCreate/ProductCreate.tsx +++ b/src/products/views/ProductCreate/ProductCreate.tsx @@ -118,9 +118,7 @@ export const ProductCreateView: React.FC = ({ params }) => { skip: !selectedProductTypeId }); - const productTypes = searchProductTypesOpts?.data?.search?.edges?.map( - edge => edge.node - ); + const productTypes = mapEdgesToItems(searchProductTypesOpts?.data?.search); const { data: channelsData } = useChannelsList({}); const allChannels: ChannelData[] = createSortedChannelsData( @@ -281,12 +279,8 @@ export const ProductCreateView: React.FC = ({ params }) => { edge.node - )} - collections={(searchCollectionOpts?.data?.search?.edges || []).map( - edge => edge.node - )} + categories={mapEdgesToItems(searchCategoryOpts?.data?.search)} + collections={mapEdgesToItems(searchCollectionOpts?.data?.search)} loading={loading} channelsErrors={ updateVariantChannelsOpts.data?.productVariantChannelListingUpdate diff --git a/src/products/views/ProductList/ProductList.tsx b/src/products/views/ProductList/ProductList.tsx index a0a380a42..264c409d7 100644 --- a/src/products/views/ProductList/ProductList.tsx +++ b/src/products/views/ProductList/ProductList.tsx @@ -317,24 +317,17 @@ export const ProductList: React.FC = ({ params }) => { const filterOpts = getFilterOpts( params, - initialFilterAttributes?.attributes?.edges?.map(edge => edge.node) || [], + mapEdgesToItems(initialFilterAttributes?.attributes), { - initial: - initialFilterCategories?.categories?.edges?.map(edge => edge.node) || - [], + initial: mapEdgesToItems(initialFilterCategories?.categories), search: searchCategories }, { - initial: - initialFilterCollections?.collections?.edges?.map(edge => edge.node) || - [], + initial: mapEdgesToItems(initialFilterCollections?.collections), search: searchCollections }, { - initial: - initialFilterProductTypes?.productTypes?.edges?.map( - edge => edge.node - ) || [], + initial: mapEdgesToItems(initialFilterProductTypes?.productTypes), search: searchProductTypes } ); @@ -462,9 +455,7 @@ export const ProductList: React.FC = ({ params }) => { edge.node - )} + attributes={mapEdgesToItems(searchAttributes?.result?.data?.search)} hasMore={searchAttributes.result.data?.search.pageInfo.hasNextPage} loading={ searchAttributes.result.loading || diff --git a/src/products/views/ProductUpdate/ProductUpdate.tsx b/src/products/views/ProductUpdate/ProductUpdate.tsx index d885c67e7..e3425ea21 100644 --- a/src/products/views/ProductUpdate/ProductUpdate.tsx +++ b/src/products/views/ProductUpdate/ProductUpdate.tsx @@ -426,12 +426,10 @@ export const ProductUpdate: React.FC = ({ id, params }) => { createProductMediaOpts.data?.productMediaCreate.errors ); - const categories = (searchCategoriesOpts?.data?.search?.edges || []).map( - edge => edge.node - ); - const collections = (searchCollectionsOpts?.data?.search?.edges || []).map( - edge => edge.node - ); + const categories = mapEdgesToItems(searchCategoriesOpts?.data?.search); + + const collections = mapEdgesToItems(searchCollectionsOpts?.data?.search); + const errors = [ ...(updateProductOpts.data?.productUpdate.errors || []), ...(updateSimpleProductOpts.data?.productUpdate.errors || []), diff --git a/src/shipping/views/PriceRatesUpdate/PriceRatesUpdate.tsx b/src/shipping/views/PriceRatesUpdate/PriceRatesUpdate.tsx index 50e5e9f58..33e1a4691 100644 --- a/src/shipping/views/PriceRatesUpdate/PriceRatesUpdate.tsx +++ b/src/shipping/views/PriceRatesUpdate/PriceRatesUpdate.tsx @@ -59,6 +59,7 @@ import { } from "@saleor/types/globalTypes"; import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers"; import createMetadataUpdateHandler from "@saleor/utils/handlers/metadataUpdateHandler"; +import { mapEdgesToItems } from "@saleor/utils/maps"; import { useMetadataUpdate, usePrivateMetadataUpdate @@ -341,9 +342,9 @@ export const PriceRatesUpdate: React.FC = ({ loading={productsSearchOpts.loading} open={params.action === "assign-product"} hasMore={productsSearchOpts.data?.search?.pageInfo.hasNextPage} - products={productsSearchOpts.data?.search?.edges - .map(edge => edge.node) - .filter(suggestedProduct => suggestedProduct.id)} + products={mapEdgesToItems(productsSearchOpts?.data?.search).filter( + suggestedProduct => suggestedProduct.id + )} onClose={closeModal} onFetch={productsSearch} onFetchMore={loadMore} diff --git a/src/shipping/views/ShippingZonesList.tsx b/src/shipping/views/ShippingZonesList.tsx index 74a822191..b6ee8c11c 100644 --- a/src/shipping/views/ShippingZonesList.tsx +++ b/src/shipping/views/ShippingZonesList.tsx @@ -14,6 +14,7 @@ import useShop from "@saleor/hooks/useShop"; import useUser from "@saleor/hooks/useUser"; import { commonMessages } from "@saleor/intl"; import { getStringOrPlaceholder, maybe } from "@saleor/misc"; +import { getById } from "@saleor/orders/components/OrderReturnPage/utils"; import { ListViews } from "@saleor/types"; import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers"; import { mapEdgesToItems } from "@saleor/utils/maps"; @@ -184,13 +185,8 @@ export const ShippingZonesList: React.FC = ({ values={{ shippingZoneName: ( - {maybe( - () => - data.shippingZones.edges.find( - edge => edge.node.id === params.id - ).node.name, - "..." - )} + {mapEdgesToItems(data?.shippingZones).find(getById(params.id)) + ?.name || "..."} ) }} diff --git a/src/shipping/views/WeightRatesUpdate/WeightRatesUpdate.tsx b/src/shipping/views/WeightRatesUpdate/WeightRatesUpdate.tsx index 23257da0f..b7978e156 100644 --- a/src/shipping/views/WeightRatesUpdate/WeightRatesUpdate.tsx +++ b/src/shipping/views/WeightRatesUpdate/WeightRatesUpdate.tsx @@ -59,6 +59,7 @@ import { } from "@saleor/types/globalTypes"; import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers"; import createMetadataUpdateHandler from "@saleor/utils/handlers/metadataUpdateHandler"; +import { mapEdgesToItems } from "@saleor/utils/maps"; import { useMetadataUpdate, usePrivateMetadataUpdate @@ -342,9 +343,9 @@ export const WeightRatesUpdate: React.FC = ({ loading={productsSearchOpts.loading} open={params.action === "assign-product"} hasMore={productsSearchOpts.data?.search?.pageInfo.hasNextPage} - products={productsSearchOpts.data?.search?.edges - .map(edge => edge.node) - .filter(suggestedProduct => suggestedProduct.id)} + products={mapEdgesToItems(productsSearchOpts?.data?.search).filter( + suggestedProduct => suggestedProduct.id + )} onClose={closeModal} onFetch={productsSearch} onFetchMore={loadMore} diff --git a/src/storybook/stories/categories/CategoryUpdatePage.tsx b/src/storybook/stories/categories/CategoryUpdatePage.tsx index 6e741da7d..ec5a824ba 100644 --- a/src/storybook/stories/categories/CategoryUpdatePage.tsx +++ b/src/storybook/stories/categories/CategoryUpdatePage.tsx @@ -1,7 +1,7 @@ import placeholderImage from "@assets/images/placeholder255x255.png"; import { Omit } from "@material-ui/core"; import { ProductErrorCode } from "@saleor/types/globalTypes"; -import { mapEdgesToItems } from "@saleor/utils/maps"; +import { mapEdgesToItems, mapNodeToChoice } from "@saleor/utils/maps"; import { storiesOf } from "@storybook/react"; import React from "react"; @@ -15,12 +15,7 @@ import Decorator from "../../Decorator"; const category = categoryFixture(placeholderImage); -const channelChoices = category.products.edges[0].node.channelListings.map( - listing => ({ - label: listing.channel.name, - value: listing.channel.id - }) -); +const channelChoices = mapNodeToChoice(mapEdgesToItems(category?.products)); const updateProps: Omit = { category, diff --git a/src/translations/views/TranslationsEntities.tsx b/src/translations/views/TranslationsEntities.tsx index 6661b478e..c4353f032 100644 --- a/src/translations/views/TranslationsEntities.tsx +++ b/src/translations/views/TranslationsEntities.tsx @@ -3,6 +3,7 @@ import usePaginator, { createPaginationState } from "@saleor/hooks/usePaginator"; import useShop from "@saleor/hooks/useShop"; +import { mapEdgesToItems } from "@saleor/utils/maps"; import { stringify as stringifyQs } from "qs"; import React from "react"; @@ -142,24 +143,22 @@ const TranslationsEntities: React.FC = ({ return ( edge.node) - .map( - node => - node.__typename === "CategoryTranslatableContent" && { - completion: { - current: sumCompleted([ - node.translation?.description, - node.translation?.name, - node.translation?.seoDescription, - node.translation?.seoTitle - ]), - max: 4 - }, - id: node?.category?.id, - name: node?.category?.name - } - )} + entities={mapEdgesToItems(data?.translations).map( + node => + node.__typename === "CategoryTranslatableContent" && { + completion: { + current: sumCompleted([ + node.translation?.description, + node.translation?.name, + node.translation?.seoDescription, + node.translation?.seoTitle + ]), + max: 4 + }, + id: node?.category?.id, + name: node?.category?.name + } + )} onRowClick={id => navigate( languageEntityUrl( @@ -187,24 +186,22 @@ const TranslationsEntities: React.FC = ({ return ( edge.node) - .map( - node => - node.__typename === "ProductTranslatableContent" && { - completion: { - current: sumCompleted([ - node.translation?.description, - node.translation?.name, - node.translation?.seoDescription, - node.translation?.seoTitle - ]), - max: 4 - }, - id: node?.product?.id, - name: node?.product?.name - } - )} + entities={mapEdgesToItems(data?.translations).map( + node => + node.__typename === "ProductTranslatableContent" && { + completion: { + current: sumCompleted([ + node.translation?.description, + node.translation?.name, + node.translation?.seoDescription, + node.translation?.seoTitle + ]), + max: 4 + }, + id: node?.product?.id, + name: node?.product?.name + } + )} onRowClick={id => navigate( languageEntityUrl( @@ -233,24 +230,22 @@ const TranslationsEntities: React.FC = ({ return ( edge.node) - .map( - node => - node.__typename === "CollectionTranslatableContent" && { - completion: { - current: sumCompleted([ - node.translation?.description, - node.translation?.name, - node.translation?.seoDescription, - node.translation?.seoTitle - ]), - max: 4 - }, - id: node.collection.id, - name: node.collection.name - } - )} + entities={mapEdgesToItems(data?.translations).map( + node => + node.__typename === "CollectionTranslatableContent" && { + completion: { + current: sumCompleted([ + node.translation?.description, + node.translation?.name, + node.translation?.seoDescription, + node.translation?.seoTitle + ]), + max: 4 + }, + id: node.collection.id, + name: node.collection.name + } + )} onRowClick={id => navigate( languageEntityUrl( @@ -279,19 +274,17 @@ const TranslationsEntities: React.FC = ({ return ( edge.node) - .map( - node => - node.__typename === "SaleTranslatableContent" && { - completion: { - current: sumCompleted([node.translation?.name]), - max: 1 - }, - id: node.sale?.id, - name: node.sale?.name - } - )} + entities={mapEdgesToItems(data?.translations).map( + node => + node.__typename === "SaleTranslatableContent" && { + completion: { + current: sumCompleted([node.translation?.name]), + max: 1 + }, + id: node.sale?.id, + name: node.sale?.name + } + )} onRowClick={id => navigate( languageEntityUrl(language, TranslatableEntities.sales, id) @@ -320,19 +313,17 @@ const TranslationsEntities: React.FC = ({ return ( edge.node) - .map( - node => - node.__typename === "VoucherTranslatableContent" && { - completion: { - current: sumCompleted([node.translation?.name]), - max: 1 - }, - id: node.voucher?.id, - name: node.voucher?.name || "-" - } - )} + entities={mapEdgesToItems(data?.translations).map( + node => + node.__typename === "VoucherTranslatableContent" && { + completion: { + current: sumCompleted([node.translation?.name]), + max: 1 + }, + id: node.voucher?.id, + name: node.voucher?.name || "-" + } + )} onRowClick={id => navigate( languageEntityUrl( @@ -361,24 +352,22 @@ const TranslationsEntities: React.FC = ({ return ( edge.node) - .map( - node => - node.__typename === "PageTranslatableContent" && { - completion: { - current: sumCompleted([ - node.translation?.content, - node.translation?.seoDescription, - node.translation?.seoTitle, - node.translation?.title - ]), - max: 4 - }, - id: node?.page.id, - name: node?.page.title - } - )} + entities={mapEdgesToItems(data?.translations).map( + node => + node.__typename === "PageTranslatableContent" && { + completion: { + current: sumCompleted([ + node.translation?.content, + node.translation?.seoDescription, + node.translation?.seoTitle, + node.translation?.title + ]), + max: 4 + }, + id: node?.page.id, + name: node?.page.title + } + )} onRowClick={id => navigate( languageEntityUrl(language, TranslatableEntities.pages, id) @@ -402,26 +391,24 @@ const TranslationsEntities: React.FC = ({ return ( edge.node) - .map( - node => - node.__typename === "AttributeTranslatableContent" && { - completion: { - current: sumCompleted([ - node.translation?.name, - ...(node.attribute?.values.map( - attr => attr.translation?.name - ) || []) - ]), - max: node.attribute - ? node.attribute.values.length + 1 - : 0 - }, - id: node?.attribute.id, - name: node?.attribute.name - } - )} + entities={mapEdgesToItems(data?.translations).map( + node => + node.__typename === "AttributeTranslatableContent" && { + completion: { + current: sumCompleted([ + node.translation?.name, + ...(node.attribute?.values.map( + attr => attr.translation?.name + ) || []) + ]), + max: node.attribute + ? node.attribute.values.length + 1 + : 0 + }, + id: node?.attribute.id, + name: node?.attribute.name + } + )} onRowClick={id => navigate( languageEntityUrl( @@ -449,23 +436,20 @@ const TranslationsEntities: React.FC = ({ return ( edge.node) - .map( - node => - node.__typename === - "ShippingMethodTranslatableContent" && { - completion: { - current: sumCompleted([ - node.translation?.name, - node.translation?.description - ]), - max: 2 - }, - id: node?.shippingMethod.id, - name: node?.name - } - )} + entities={mapEdgesToItems(data?.translations).map( + node => + node.__typename === "ShippingMethodTranslatableContent" && { + completion: { + current: sumCompleted([ + node.translation?.name, + node.translation?.description + ]), + max: 2 + }, + id: node?.shippingMethod.id, + name: node?.name + } + )} onRowClick={id => navigate( languageEntityUrl( diff --git a/src/warehouses/components/WarehouseList/WarehouseList.tsx b/src/warehouses/components/WarehouseList/WarehouseList.tsx index d8599df53..ccde14284 100644 --- a/src/warehouses/components/WarehouseList/WarehouseList.tsx +++ b/src/warehouses/components/WarehouseList/WarehouseList.tsx @@ -14,6 +14,7 @@ import { WarehouseWithShippingFragment } from "@saleor/fragments/types/Warehouse import { maybe, renderCollection, stopPropagation } from "@saleor/misc"; import { makeStyles } from "@saleor/theme"; import { ListProps, SortPage } from "@saleor/types"; +import { mapEdgesToItems } from "@saleor/utils/maps"; import { getArrowDirection } from "@saleor/utils/sort"; import { WarehouseListUrlSortField } from "@saleor/warehouses/urls"; import React from "react"; @@ -137,13 +138,9 @@ const WarehouseList: React.FC = props => { {maybe(() => warehouse.name, )} - {maybe( - () => - warehouse.shippingZones.edges - .map(edge => edge.node.name) - .join(", "), - - )} + {mapEdgesToItems(warehouse?.shippingZones) + .map(({ name }) => name) + .join(", ") || }
diff --git a/src/warehouses/views/WarehouseList/WarehouseList.tsx b/src/warehouses/views/WarehouseList/WarehouseList.tsx index 2379d2663..c6243065d 100644 --- a/src/warehouses/views/WarehouseList/WarehouseList.tsx +++ b/src/warehouses/views/WarehouseList/WarehouseList.tsx @@ -13,6 +13,7 @@ import usePaginator, { } from "@saleor/hooks/usePaginator"; import { commonMessages, sectionNames } from "@saleor/intl"; import { getMutationStatus, maybe } from "@saleor/misc"; +import { getById } from "@saleor/orders/components/OrderReturnPage/utils"; import { ListViews } from "@saleor/types"; import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers"; import createFilterHandlers from "@saleor/utils/handlers/filterHandlers"; @@ -166,11 +167,7 @@ const WarehouseList: React.FC = ({ params }) => { /> - data.warehouses.edges.find(edge => edge.node.id === params.id).node - .name - )} + name={mapEdgesToItems(data?.warehouses).find(getById(params.id))?.name} open={params.action === "delete"} onClose={closeModal} onConfirm={() =>