Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dashboard, medusa, medusa-js, medusa-react, icons): DataGrid, partial Product domain, and ProductVariant hook #6428

Merged
merged 26 commits into from
Feb 21, 2024

Conversation

kasperkristensen
Copy link
Contributor

@kasperkristensen kasperkristensen commented Feb 18, 2024

The PR for the Products section is growing quite large, so I would like to merge this PR that contains a lot of the ground work before moving onto finalizing the rest of the domain.

Note
Since the PR contains changes to the core, that the dashboard depends on, the staging env will not work. To preview this PR, you will need to run it locally.

@medusajs/medusa

What

  • Adds missing query params to GET /admin/products/:id/variants
  • options.values has been added to the default relations of admin product endpoints.

medusa-react

What

  • Adds missing hook for GET /admin/products/:id/variants

@medusajs/dashboard

  • Adds base implementation for DataGrid component (formerly BulkEditor) (WIP)
  • Adds /products overview page
  • Adds partial /products/create page for creating new products (WIP - need to go over design w/ Ludvig before continuing)
  • Adds /products/:id details page
  • Adds /products/:id/gallery page for inspecting a products images in fullscreen.
  • Adds /products/:id/edit page for editing the general information of a product
  • Adds /products/:id/attributes page for editing the attributes information of a product
  • Adds /products/:id/sales-channels page for editing which sales channels a product is available in
  • Fixes a bug in DataTable where a table with two fixed columns would not display correctly

For the review its not important to test the DataGrid, as it is still WIP, and I need to go through some minor changes to the behaviour with Ludvig, as virtualizing it adds some constraints.

@medusajs/icons

What

  • Pulls latest icons from Figma

TODO in next PR

  • Fix the typing of POST /admin/products/:id as it is currently not possible to delete any of the nullable fields once they have been added. Be aware of this when reviewing this PR.
  • Wrap up /products/create page
  • Add /products/:id/media page for managing media associated with the product.
  • Add /products/id/options for managing product options (need Ludvig to rethink this as the current API is very limited and we can implement the current design as is.)
  • Add /products/:id/variants/:id page for editing a variant. (Possibly concat all of these into one BulkEditor page?)

Copy link

changeset-bot bot commented Feb 18, 2024

🦋 Changeset detected

Latest commit: 5321765

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@medusajs/client-types Patch
@medusajs/icons Patch
medusa-react Patch
@medusajs/medusa-js Patch
@medusajs/medusa Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 21, 2024 11:06am
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Feb 21, 2024 11:06am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Feb 21, 2024 11:06am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Feb 21, 2024 11:06am

@kasperkristensen kasperkristensen changed the title feat(dashboard, medusa, medusa-react): DataGrid, partial Product domain, and ProductVariant hook feat(dashboard, medusa, medusa-react, icons): DataGrid, partial Product domain, and ProductVariant hook Feb 18, 2024
@kasperkristensen kasperkristensen marked this pull request as ready for review February 19, 2024 14:31
@kasperkristensen kasperkristensen requested review from a team as code owners February 19, 2024 14:31
@kasperkristensen kasperkristensen changed the title feat(dashboard, medusa, medusa-react, icons): DataGrid, partial Product domain, and ProductVariant hook feat(dashboard, medusa, medusa-js, medusa-react, icons): DataGrid, partial Product domain, and ProductVariant hook Feb 19, 2024
@olivermrbl
Copy link
Contributor

The form for attributes seems to have incorrect field value validation:

CleanShot 2024-02-21 at 09 54 35

@olivermrbl
Copy link
Contributor

Would it be possible to not make the page jump on table searches? See video below.

CleanShot.2024-02-21.at.10.01.52.mp4

@olivermrbl
Copy link
Contributor

Searching in the table also does a not so elegant jump/refresh of the entire component:

CleanShot.2024-02-21.at.10.05.49.mp4

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a few comments. Nice work @kasperkristensen

{t("fields.categories")}
</Text>
<div className="flex flex-wrap items-center gap-1">
{product.categories.length > 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: Check categories exist. This fails if categories are not enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do this later, currently there is no checking for feature flags. But my idea is to implement a check in the loader for each page to prevent having sections that jump in after the page has loaded.

Comment on lines 20 to 23
weight: zod.string(),
length: zod.string(),
width: zod.string(),
height: zod.string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See other comment

Copy link
Contributor

@fPolic fPolic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Epic 🏅
Left a couple of discussion points but overall LGTM!

let cells: FieldCoordinates[] = []

function selectCell(i: number, columnIndex: number) {
const possibleCell = document.querySelector(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: use a more specific grid root element so that fewer nodes are traversal when searching

}

/**
* If the current cell is not a neighbour, we instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: is this an optimisation to separateisNeighbour case? Should selectCell() be able to solve for that too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants