diff --git a/.changeset/four-schools-train.md b/.changeset/four-schools-train.md new file mode 100644 index 00000000000..2c7f0b7596c --- /dev/null +++ b/.changeset/four-schools-train.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Collection details page uses now Buttons from new macaw diff --git a/playwright/pages/collectionsPage.ts b/playwright/pages/collectionsPage.ts index 3782013ebac..e3f98a3b017 100644 --- a/playwright/pages/collectionsPage.ts +++ b/playwright/pages/collectionsPage.ts @@ -28,7 +28,7 @@ export class CollectionsPage extends BasePage { readonly assignProductButton = page.getByTestId("add-product"), readonly collectionImages = page.getByTestId("product-image"), readonly uploadImageButton = page.getByTestId("upload-image-button"), - readonly collectionNameInput = page.getByTestId("collection-name-input").locator("input"), + readonly collectionNameInput = page.getByTestId("collection-name-input"), readonly collectionDescriptionEditor = page.getByTestId("rich-text-editor-description"), readonly descriptionLoader = page.locator(".codex-editor__loader"), ) { diff --git a/src/collections/components/CollectionDetails/CollectionDetails.tsx b/src/collections/components/CollectionDetails/CollectionDetails.tsx index 560eaee03e3..cf9485767ed 100644 --- a/src/collections/components/CollectionDetails/CollectionDetails.tsx +++ b/src/collections/components/CollectionDetails/CollectionDetails.tsx @@ -1,4 +1,3 @@ -// @ts-strict-ignore import { DashboardCard } from "@dashboard/components/Card"; import FormSpacer from "@dashboard/components/FormSpacer"; import RichTextEditor from "@dashboard/components/RichTextEditor"; @@ -8,7 +7,7 @@ import { commonMessages } from "@dashboard/intl"; import { getFormErrors, getProductErrorMessage } from "@dashboard/utils/errors"; import { useRichTextContext } from "@dashboard/utils/richText/context"; import { OutputData } from "@editorjs/editorjs"; -import { TextField } from "@material-ui/core"; +import { Input } from "@saleor/macaw-ui-next"; import React from "react"; import { useIntl } from "react-intl"; @@ -40,7 +39,7 @@ const CollectionDetails: React.FC = ({ - = ({ onChange={onChange} error={!!formErrors.name} helperText={getProductErrorMessage(formErrors.name, intl)} - fullWidth /> {isReadyForMount ? ( diff --git a/src/collections/components/CollectionImage/CollectionImage.tsx b/src/collections/components/CollectionImage/CollectionImage.tsx index 0b15cf80450..06af9f62b8a 100644 --- a/src/collections/components/CollectionImage/CollectionImage.tsx +++ b/src/collections/components/CollectionImage/CollectionImage.tsx @@ -1,5 +1,3 @@ -// @ts-strict-ignore -import { Button } from "@dashboard/components/Button"; import { DashboardCard } from "@dashboard/components/Card"; import Hr from "@dashboard/components/Hr"; import ImageUpload from "@dashboard/components/ImageUpload"; @@ -8,7 +6,7 @@ import { CollectionDetailsFragment } from "@dashboard/graphql"; import { commonMessages } from "@dashboard/intl"; import { TextField } from "@material-ui/core"; import { makeStyles } from "@saleor/macaw-ui"; -import { Skeleton, vars } from "@saleor/macaw-ui-next"; +import { Button, Skeleton, vars } from "@saleor/macaw-ui-next"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -61,10 +59,10 @@ export interface CollectionImageProps { export const CollectionImage: React.FC = props => { const { data, onImageUpload, image, onChange, onImageDelete } = props; - const anchor = React.useRef(); + const anchor = React.useRef(null); const classes = useStyles(props); const intl = useIntl(); - const handleImageUploadButtonClick = () => anchor.current.click(); + const handleImageUploadButtonClick = () => anchor?.current?.click(); return ( @@ -79,7 +77,7 @@ export const CollectionImage: React.FC = props => { <> @@ -104,7 +107,7 @@ const CollectionProducts: React.FC = props => { colSpan={numberOfColumns} selected={selected} disabled={disabled} - items={mapEdgesToItems(collection?.products)} + items={mapEdgesToItems(collection?.products) ?? []} toggleAll={toggleAll} toolbar={toolbar} > @@ -150,17 +153,14 @@ const CollectionProducts: React.FC = props => { checked={isSelected} disabled={disabled} disableClickPropagation - onChange={() => toggle(product.id)} + onChange={() => product?.id && toggle(product.id)} /> - product.thumbnail.url)} - > - {maybe(() => product.name, )} + + {product?.name ?? } - {maybe(() => product.productType.name, )} + {product?.productType?.name ?? } {product && !product?.channelListings?.length ? ( @@ -173,14 +173,13 @@ const CollectionProducts: React.FC = props => { - } data-test-id="delete-icon" variant="secondary" disabled={!product} - onClick={event => onProductUnassign(product.id, event)} - > - - + onClick={event => product?.id && onProductUnassign(product.id, event)} + />