woocommerce/plugins/woocommerce-admin/client/products/add-product-page.tsx

58 lines
1.7 KiB
TypeScript
Raw Normal View History

/**
* External dependencies
*/
import { recordEvent } from '@woocommerce/tracks';
import { useEffect } from '@wordpress/element';
import { Form } from '@woocommerce/components';
import { Product } from '@woocommerce/data';
/**
* Internal dependencies
*/
import { ProductFormHeader } from './layout/product-form-header';
import { ProductFormLayout } from './layout/product-form-layout';
import { ProductDetailsSection } from './sections/product-details-section';
import { ProductInventorySection } from './sections/product-inventory-section';
import { PricingSection } from './sections/pricing-section';
import { ProductShippingSection } from './sections/product-shipping-section';
Images Product management MVP 1.0 (#34769) * Add image section # Conflicts: # plugins/woocommerce-admin/client/products/add-product-page.tsx * Add `keepSpaceWhenDragging` to sortable # Conflicts: # packages/js/components/src/sortable/sortable-item.tsx # packages/js/components/src/sortable/sortable.tsx # Conflicts: # packages/js/components/src/sortable/sortable.tsx * Export ImageGalleryItem * Add props to `image-gallery` # Conflicts: # packages/js/components/src/image-gallery/image-gallery-item.tsx # packages/js/components/src/image-gallery/image-gallery.tsx * Changed `media-uploader` label * Add changelogs * Fix image-gallery and sortable components # Conflicts: # packages/js/components/src/sortable/sortable-item.tsx # packages/js/components/src/sortable/sortable.tsx # Conflicts: # packages/js/components/src/image-gallery/image-gallery.tsx # packages/js/components/src/sortable/sortable.tsx * Set gallery min-height * Add onOrderChange * Show images section edit-product # Conflicts: # plugins/woocommerce-admin/client/products/edit-product-page.tsx # Conflicts: # plugins/woocommerce-admin/client/products/edit-product-page.tsx # Conflicts: # plugins/woocommerce-admin/client/products/edit-product-page.tsx * Fix styles * Fix styles * Fix image alt * Fix TS any * Add prop `onDragOver` # Conflicts: # packages/js/components/src/image-gallery/image-gallery.tsx * Fix styles * Fix padding * Fix image area min-height * Fix subtitle copy * Fix image margin * Change `draggedImageId` * Fix `setDraggedImageId` reset * Rename `isRemoveZoneVisible` * Add `CardBody` and remove redundant `setValue` * Fix card styles * Remove `getUniqueImages` * Use url as a key when there is no image id * Fix `orderedImages` * Add hover to gallery images * Fix gallery arrows and set cover problems * Altering blur handler to prevent toolbar closure on media modal * Fix toolbar drag and drop * Add replace fn * Restoring modal class for blur function * Fix storybook * Ensuring onBlur doesn't happen while dragging, resolving issue in Firefox * Adding expected event object to drag callbacks * Fix image size * Fix lint * Another fix lint * Update plugins/woocommerce-admin/client/products/sections/images-section.tsx Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix `draggedImageId` default value * Fix toolbar icon style * Rename consts * Update pnpm-lock.yaml Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com> Co-authored-by: Joel <dygerati@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-10-12 18:16:22 +00:00
import { ImagesSection } from './sections/images-section';
import './product-page.scss';
import { validate } from './product-validation';
import { AttributesSection } from './sections/attributes-section';
import { ProductFormFooter } from './layout/product-form-footer';
const AddProductPage: React.FC = () => {
useEffect( () => {
recordEvent( 'view_new_product_management_experience' );
}, [] );
return (
<div className="woocommerce-add-product">
<Form< Partial< Product > >
initialValues={ {
reviews_allowed: true,
name: '',
sku: '',
stock_quantity: 0,
stock_status: 'instock',
} }
errors={ {} }
validate={ validate }
>
<ProductFormHeader />
<ProductFormLayout>
<ProductDetailsSection />
<PricingSection />
Images Product management MVP 1.0 (#34769) * Add image section # Conflicts: # plugins/woocommerce-admin/client/products/add-product-page.tsx * Add `keepSpaceWhenDragging` to sortable # Conflicts: # packages/js/components/src/sortable/sortable-item.tsx # packages/js/components/src/sortable/sortable.tsx # Conflicts: # packages/js/components/src/sortable/sortable.tsx * Export ImageGalleryItem * Add props to `image-gallery` # Conflicts: # packages/js/components/src/image-gallery/image-gallery-item.tsx # packages/js/components/src/image-gallery/image-gallery.tsx * Changed `media-uploader` label * Add changelogs * Fix image-gallery and sortable components # Conflicts: # packages/js/components/src/sortable/sortable-item.tsx # packages/js/components/src/sortable/sortable.tsx # Conflicts: # packages/js/components/src/image-gallery/image-gallery.tsx # packages/js/components/src/sortable/sortable.tsx * Set gallery min-height * Add onOrderChange * Show images section edit-product # Conflicts: # plugins/woocommerce-admin/client/products/edit-product-page.tsx # Conflicts: # plugins/woocommerce-admin/client/products/edit-product-page.tsx # Conflicts: # plugins/woocommerce-admin/client/products/edit-product-page.tsx * Fix styles * Fix styles * Fix image alt * Fix TS any * Add prop `onDragOver` # Conflicts: # packages/js/components/src/image-gallery/image-gallery.tsx * Fix styles * Fix padding * Fix image area min-height * Fix subtitle copy * Fix image margin * Change `draggedImageId` * Fix `setDraggedImageId` reset * Rename `isRemoveZoneVisible` * Add `CardBody` and remove redundant `setValue` * Fix card styles * Remove `getUniqueImages` * Use url as a key when there is no image id * Fix `orderedImages` * Add hover to gallery images * Fix gallery arrows and set cover problems * Altering blur handler to prevent toolbar closure on media modal * Fix toolbar drag and drop * Add replace fn * Restoring modal class for blur function * Fix storybook * Ensuring onBlur doesn't happen while dragging, resolving issue in Firefox * Adding expected event object to drag callbacks * Fix image size * Fix lint * Another fix lint * Update plugins/woocommerce-admin/client/products/sections/images-section.tsx Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix `draggedImageId` default value * Fix toolbar icon style * Rename consts * Update pnpm-lock.yaml Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com> Co-authored-by: Joel <dygerati@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-10-12 18:16:22 +00:00
<ImagesSection />
<ProductInventorySection />
<ProductShippingSection />
<AttributesSection />
</ProductFormLayout>
<ProductFormFooter />
</Form>
</div>
);
};
export default AddProductPage;