feat(admin-ui, medusa-js, medusa-react, medusa): Multiwarehousing UI (#3403)

* add "get-variant" endpoint

* import from a different place

* fix unit test

* add changeset

* inventory management for orders

* add changeset

* initial create-fulfillment

* add changeset

* type oas and admin

* Move inv. creation and listing from admin repo

* Fix location editing bug (CORE-1216)

* Fix default warehouse on inventory table view

* remove actions from each table line

* Use feature flag hook instead of context directly

* remove manage inventory action if inventory management is not enabled

* Address review comments

* fix queries made when inventorymodules are disabled

* variant form changes for feature enabled

* move exclamation icon into warning icon

* ensure queries are not run unless feature is enabled for create-fulfillment

---------

Co-authored-by: Philip Korsholm <philip.korsholm@hotmail.com>
Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
This commit is contained in:
Rares Stefan
2023-03-08 16:08:56 +01:00
committed by GitHub
co-authored by Philip Korsholm Philip Korsholm
parent 53eda215e0
commit 57d7728dd9
49 changed files with 3922 additions and 722 deletions
@@ -1,15 +1,15 @@
import React, { ReactNode, useState } from "react"
import clsx from "clsx"
import { ReactNode, useState } from "react"
import Modal from "../../molecules/modal"
import Button from "../../fundamentals/button"
import FileIcon from "../../fundamentals/icons/file-icon"
import TrashIcon from "../../fundamentals/icons/trash-icon"
import DownloadIcon from "../../fundamentals/icons/download-icon"
import XCircleIcon from "../../fundamentals/icons/x-circle-icon"
import CheckCircleIcon from "../../fundamentals/icons/check-circle-icon"
import WarningCircle from "../../fundamentals/icons/warning-circle"
import CrossIcon from "../../fundamentals/icons/cross-icon"
import DownloadIcon from "../../fundamentals/icons/download-icon"
import FileIcon from "../../fundamentals/icons/file-icon"
import Modal from "../../molecules/modal"
import TrashIcon from "../../fundamentals/icons/trash-icon"
import WarningCircleIcon from "../../fundamentals/icons/warning-circle"
import XCircleIcon from "../../fundamentals/icons/x-circle-icon"
import clsx from "clsx"
type FileSummaryProps = {
name: string
@@ -34,16 +34,16 @@ function FileSummary(props: FileSummaryProps) {
<div className="relative">
<div
style={{ width: `${progress}%` }}
className="absolute bg-grey-5 h-full transition-width duration-150 ease-in-out"
className="bg-grey-5 transition-width absolute h-full duration-150 ease-in-out"
/>
<div className="relative flex items-center rounded-xl border border-1 mt-6">
<div className="border-1 relative mt-6 flex items-center rounded-xl border">
<div className="m-4">
<FileIcon size={30} fill={progress ? "#9CA3AF" : "#2DD4BF"} />
</div>
<div className="flex-1 my-6">
<div className="text-small leading-5 text-grey-90">{name}</div>
<div className="text-xsmall leading-4 text-grey-50">
<div className="my-6 flex-1">
<div className="text-small text-grey-90 leading-5">{name}</div>
<div className="text-xsmall text-grey-50 leading-4">
{status || formattedSize}
</div>
</div>
@@ -68,18 +68,18 @@ function UploadSummary(props: UploadSummaryProps) {
const { creations, updates, rejections, type } = props
return (
<div className="flex gap-6">
<div className="flex items-center text-small text-grey-90">
<div className="text-small text-grey-90 flex items-center">
<CheckCircleIcon color="#9CA3AF" className="mr-2" />
<span className="font-semibold"> {creations}&nbsp;</span> new {type}
</div>
{updates && (
<div className="flex items-center text-small text-grey-90">
<WarningCircle fill="#9CA3AF" className="mr-2" />
<div className="text-small text-grey-90 flex items-center">
<WarningCircleIcon fill="#9CA3AF" className="mr-2" />
<span className="font-semibold">{updates}&nbsp;</span> updates
</div>
)}
{rejections && (
<div className="flex items-center text-small text-grey-90">
<div className="text-small text-grey-90 flex items-center">
<XCircleIcon color="#9CA3AF" className="mr-2" />
<span className="font-semibold">{rejections}&nbsp;</span> rejections
</div>
@@ -124,7 +124,7 @@ function DropArea(props: DropAreaProps) {
onDragOver={onDragOver}
onDrop={handleFileDrop}
className={clsx(
"flex flex-col justify-center items-center border border-dashed rounded-xl mt-3 p-6",
"mt-3 flex flex-col items-center justify-center rounded-xl border border-dashed p-6",
{ "opacity-50": isDragOver }
)}
>
@@ -208,7 +208,7 @@ function UploadModal(props: UploadModalProps) {
<Modal.Body>
<Modal.Content>
<div className="flex justify-between">
<span className="text-2xl text-grey-90 inter-large-semibold py-4">
<span className="text-grey-90 inter-large-semibold py-4 text-2xl">
Import {fileTitle}
</span>
<button onClick={onClose} className="text-grey-50 cursor-pointer">
@@ -216,7 +216,7 @@ function UploadModal(props: UploadModalProps) {
</button>
</div>
<div className="text-grey-90 text-base inter-large-semibold mb-1">
<div className="text-grey-90 inter-large-semibold mb-1 text-base">
Import {fileTitle}
</div>
@@ -241,14 +241,14 @@ function UploadModal(props: UploadModalProps) {
// TODO: change this to actual progress once this we can track upload
progress={100}
action={
<a className="w-6 h-6 cursor-pointer" onClick={removeFile}>
<a className="h-6 w-6 cursor-pointer" onClick={removeFile}>
<TrashIcon stroke="#9CA3AF" />
</a>
}
/>
)}
<div className="text-grey-90 text-base inter-large-semibold mt-8">
<div className="text-grey-90 inter-large-semibold mt-8 text-base">
{description2Title}
</div>
@@ -259,7 +259,7 @@ function UploadModal(props: UploadModalProps) {
size={2967}
action={
<a
className="w-6 h-6 cursor-pointer"
className="h-6 w-6 cursor-pointer"
href={templateLink}
download
>
@@ -271,11 +271,11 @@ function UploadModal(props: UploadModalProps) {
<div className="h-2" />
</Modal.Content>
<Modal.Footer>
<div className="flex w-full h-8 justify-end">
<div className="flex h-8 w-full justify-end">
<div className="flex gap-2">
<Button
variant="secondary"
className="mr-2 text-small justify-center"
className="text-small mr-2 justify-center"
size="small"
onClick={onClose}
>