Giter VIP home page Giter VIP logo

saleor / saleor-dashboard Goto Github PK

View Code? Open in Web Editor NEW
783.0 39.0 1.0K 343.4 MB

A GraphQL-powered, single-page dashboard application for Saleor.

License: BSD 3-Clause "New" or "Revised" License

JavaScript 6.79% TypeScript 93.16% HTML 0.01% Dockerfile 0.02% Shell 0.02% CSS 0.01%
graphql ecommerce single-page-app saleor ecommerce-platform react typescript dashboard saleor-dashboard hacktoberfest

saleor-dashboard's Introduction

Saleor Dashboard

Saleor Dashboard

A GraphQL-powered, single-page dashboard application for Saleor.

Prerequisites

  • Node.js v18+
  • A running instance of Saleor

Development

  1. Clone the repository:
git clone https://github.com/saleor/saleor-dashboard.git
  1. Enter the project directory:
cd saleor-dashboard
  1. Install the dependencies:
npm i
  1. Configure the env vars as described in docs/configuration.md.

  2. Start the development server with:

npm run dev

Note: If you see CORS errors, check CORS configuration of your Saleor instance or CORS settings in the Cloud Console.

Docs

saleor-dashboard's People

Contributors

alicjaszu avatar andrzejewsky avatar benekex2 avatar cloud11pl avatar cmiacz avatar dependabot-preview[bot] avatar dependabot[bot] avatar dominik-zeglen avatar droniu avatar gabmartinez avatar grzegorzkowalik avatar jwm0 avatar karola312 avatar krzysztofwolski avatar krzysztofzuraw avatar lkostrowski avatar maarcingebala avatar magul avatar marekchoinski avatar michalina-graczyk avatar orzechdev avatar poulch avatar sektordv avatar szczecha avatar timuric avatar tomaszszymanski129 avatar witoszekdev avatar wojteknowacki avatar yellowee avatar zaiste avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

saleor-dashboard's Issues

Use provider composer pattern to reduce visual complexity of `Operations` components

Operations components should use composer pattern, because of growing cognitive complexity of code and hard to read git diffs. Therefore, we should end up implementing this:

<Composer components={[<Provider1 />, <Provider2 />, <Provider3 />]}>
{renderProps => 
  <Component prop1={renderProps[0]} ... />
}
</Composer>
rather than this:
```javascript
<Provider1>
{renderProps1 => 
  <Provider2>
  {renderProps2 =>
    <Provider3>
    {renderProps3 => 
      <Component prop1={renderProps1} ... />
    }
    </Provider3>
  }
  </Provider2>
}
</Provider1>

Filters should close after click away

The problem is that select components render dropdown at root using portal, so selecting an option results in sending click away event. We should investigate if select component can render dropdown as sibling instead of using portal to root.

Extract mutation errors to fragment

What I'm trying to achieve

To extract common piece of almost all mutations to common fragment.

Describe a proposed solution

Replace

someMutation() {
  errors {
    field
    message
  }
  ...
}

with

someMutation() {
  errors {
    ...MutationErrorsFragment
  }
  ...
}

Refactor translations

We should double check if all labels are translated and have context provided if necessary.

Digital content management

Support for digital content fulfillment in the backend was added in PR saleor/saleor#2098. Now we need to implement related management views in Dashboard 2.0. Mockups are available in Figma in the "PRODUCTS DIGITAL" section.

Refactor callback factories

We should not use the callback factory pattern, instead of doing this:

onClick={handleClick(productId)}

we should do this"

onClick={() => handleClick(productId)}

Add Product on create Order not working

What I'm trying to achieve

adding an Item to an Order

Steps to reproduce the problem

  1. Open All Orders
  2. click Plus for new Order
  3. click add Products
  4. select Product
  5. no button to save is visible (maybe the button is offscreen)

What I expected to happen

an button to save

Screenshots

sal

System information
Operating system: Mac OSX
Browser: Chrome (latest)

Be able to move category nodes in dashboard

This is a feature I expected to see on dashboard 2.0, but doesn't seem to be planned. I think we should add a way to move nodes of mptt trees (so we can implement it to other cases than the category model).

I'm thinking that maybe we could add a button "Move categories" and render the whole tree and allow the user to drag and drop categories and subcategories where the user want to move them.

Missing bulk actions

According to the mockups, we should also provide the following bulk actions:

  • bulk delete attributes
  • bulk delete shipping methods

Addition of Abandoned Checkouts section

Feature Request:
Addition of Abandoned Checkout

Functionalities:

  • Ability to view Abandoned Checkouts List in Orders Section of Dashboard
  • Abandoned Checkout Details Page
  • Ability to prepare and send Recovery Emails from Abandoned Checkout Details Page

Designs for it can be seen in Figma File

Fix sizing unit

There are components that use theme.spacing.unit as width or height where it could be written as simple integers.

Investigate replacing i18next with js-Lingui

i18next uses complex JSON structures which makes it hard to translate. We want to keep using Transifex which currently relies on unsupported scripts to convert between i18next's JSON structures and gettext .po catalog files.

Lingui on the other hand depends on Babel plugins which means we'd have to start using Babel to compile our Typescript code. We need to investigate the performance hit caused by adding another loader to the pipeline (especially when working locally with watch mode enabled).

Improve storybook config structure

What I'm trying to achieve

To keep order and transparency within the project.

Describe a proposed solution

Keep stories in their sections, include them in section's storybook.js (or stories.js or whatever) and in main config.js include those files. This way section files live only in one place, and storybook's config.js decreases to only a few lines long, increasing code readability.

Staff account without full permission set break dashboard views

What I'm trying to achieve

I'm trying to browse the dashboard as an admin with limited permissions.

Steps to reproduce the problem

I haven't discovered all failing cases as there is a lot of views and multiple permissions that staff users may have. One scenario that doesn't work and illustrates the issue:

  1. Create a staff user and give him "Manage orders" permission only.
  2. Try to log in as the newly created user.
  3. Dashboard homepage doesn't render because it queries for User.note field which requires "Manage products" permission.
  4. Go to order details list and try to create a new draft order.
  5. Draft order view fails because it tries to load the list of customers, but our staff user has no permission to fetch it.

Have EditableTableCell use Modal and Popper

This component currently relies on absolutely positioned elements that share the common DOM ancestors. That in turn makes it impossible to fix #11 as the table is often already surrounded by a form.

We've agreed that a proper solution should use a portal-based <Modal/> that contains an actual <Form/> and a <button type="submit"/>. The card itself will be positioned using Popper.

Product creation workflow improvements

Description

While creating a product, if I realize that the category/collection/product type that I want to use has not been created yet, there's no convenient way to do so (maybe through a popup). Instead, I have to discard the information I've already entered into the product and create the categories or product types first.

Also, if you have a category tree where some subcategories have identical names (like "Footwear" under "Men's fashion" and "Footwear" under "Ladies fashion"), there is no way to tell them apart in the dropdown when creating a new product. See screenshot below. Some breadcrumbs and/or tooltips showing the parent categories of each suggestion should solve this nicely.

Screenshots or mockups

saleor dash issue

Refactor getMutationState function to accept MutationResult object

What I'm trying to achieve

To simplify code.

Describe a proposed solution

export function getMutationState<TData>(
  result: MutationResult<TData>,
  ...keys: Array<keyof TData>
): ConfirmButtonTransitionState {
  if (result.loading) {
    return "loading";
  }
  if (result.called) {
    interface MutationData {
      errors: UserError[];
    }
    return keys
      .map(key => {
        const data = (result.data[key] as unknown) as MutationData;
        return data.errors;
      })
      .map(hasErrors)
      .reduce((acc, curr) => acc || curr, false)
      ? "error"
      : "success";
  }
  return "default";
}

Improve form leaving prompt display condition

At this moment, <ConfirmFormLeaveDialog /> is displayed at each URL change if form data is modified. This causes problems when creating eg. products, displaying prompt before navigating to new product's details view, or adding attributes to new product type.

Improving mechanism of creating elements (Products, Categories etc.)

Dashboard right now works like this:
Add element --> Provide basic information --> SAVE --> Open added element --> Configure element --> SAVE

Should be:
Add element --> Configure element --> SAVE

We should simplify adding elements by giving full capabilities to modify element after adding it to the system without necessity to Save after adding basic information.

Use @material-ui/styles

What I'm trying to achieve

To be able to use styling hook without packing two theme providers into the tree

Describe a proposed solution

Update @material-ui/core to v4 and then fix all the imports. Also check if all styles are okay.

Gift Card Section

Feature:
Gift Card Section

Functionalities:

  • Add section Gift Cards in Catalog section
  • List with all gift cards in the shop:
    • Alert card showing that you can create a "gift card" product in your store
    • Ability to filter the list
  • Gift Card details page:
    • Ability to disable gift card
    • Ability to resend gift card code to customer
  • Ability to issue gift card from list view:
    • Ability to create custom card code
    • Ability to assign card to specific customer
    • Ability to choose denomination and use "custom" denomination
    • Denominations to choose should be based on denominations in "Gift Card" product type
  • Add Gift Card section to Configure:
    • Ability to set default expiry dates
  • Add "Gift Card" product type to saleor:
    • Ability to add denominations to product type
    • Ability to define whether product is shippable
  • Add Gift Card in Customer Details page:
    • Element should show last 5 gift cards issued for this Customer
    • Ability to issue Card to customer from Customer Detail Page
    • "View All" gift card button should move user to prefiltered list of gift cards issued for customer.

Design and Prototype can be seen on Figma file

Refactor autocomplete widgets

At this moment autocomplete widget logic are messy and they require storing value as

interface AutocompleteFieldValue {
  label: string;
  value: string;
}

which only brings more and more form data processing. They also support both static list and list fetching, which causes them to lose benefits of strict typechecking. The idea to refactor them is to:

  • make widgets stateful and hold current label in component state
  • separate components that are able to fetch choice list from those which cannot
  • use fuzzaldrin library to sort static choice lists ( https://github.com/atom/fuzzaldrin )
  • decide if we should drop multiple choice autocomplete widget with fetching ability
  • refactor logic used in views

Review our static files and Webpack setup

  • I don't like the fact that Webpack needs to know public paths which makes it depend on STATIC_URL at compile time
  • I don't like the fact that source files are copied to the output /static/ directory
  • I'd like to use module names as module IDs in Webpack bundles to avoid all bundles being recompiled whenever a new dependency appears and dependency IDs shift
  • I'd like to investigate having a separate Webpack config for local development, optimized for speed in watch mode
  • I'd like to investigate making Django responsible for asset hashing until both dashboard and storefront become single-page apps (currently we only hash assets Webpack is aware of which means images referenced in Django templates are not hashed)

Draftail formatting options

image

List of formatting options in our editor is now very basic and I think we could extend it a little bit to support a few other common options. Here is my proposition:

  • P, H1, H2, blockquote
  • bold, italic, underline, strikethrough
  • ul, ol
  • alignment
  • link, image
  • clear formatting

From those that we have now I would only remove the one that inserts a new line.

Use dedicated component to render skeletons or values

What I'm trying to achieve

To simplify the code by using dedicated component rendering either value or skeleton.

Describe a proposed solution

Introduce new component <ValueOrSkeleton value={() => some.value.key} />.

Other solutions I've tried and won't work

<tag>{maybe<React.ReactNode>(() => some.value.key, <Skeleton />)</tag>

Refactor forms to handle formsets

What I'm trying to achieve

To handle formsets in <Form /> component. At this moment this is not possible without creating synthetic events and marking them as any by onChange({ target: { name: "input", value: "input value" } } as any).

Describe a proposed solution

<Form /> component should not depend on React.ChangeEvent. Also, it should return mapped change functions to their inputs rather than returning one generic function, losing all type checking benefits.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.