fix(admin-ui): Template download path (#4050)

* pin react-router-dom

* fix template download path

* add changeset
This commit is contained in:
Kasper Fabricius Kristensen
2023-05-09 12:13:54 +02:00
committed by GitHub
parent 1e404b43dc
commit 2829537592
2 changed files with 12 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---
fix(admin-ui): Make download path respect **BASE** in UploadModal.
@@ -1,15 +1,16 @@
import { ReactNode, useState } from "react"
import clsx from "clsx" import clsx from "clsx"
import { ReactNode, useState } from "react"
import { useHref } from "react-router-dom"
import Tooltip from "../../atoms/tooltip"
import Button from "../../fundamentals/button" import Button from "../../fundamentals/button"
import CheckCircleIcon from "../../fundamentals/icons/check-circle-icon" import CheckCircleIcon from "../../fundamentals/icons/check-circle-icon"
import CrossIcon from "../../fundamentals/icons/cross-icon" import CrossIcon from "../../fundamentals/icons/cross-icon"
import DownloadIcon from "../../fundamentals/icons/download-icon" import DownloadIcon from "../../fundamentals/icons/download-icon"
import FileIcon from "../../fundamentals/icons/file-icon" import FileIcon from "../../fundamentals/icons/file-icon"
import Modal from "../../molecules/modal"
import TrashIcon from "../../fundamentals/icons/trash-icon" import TrashIcon from "../../fundamentals/icons/trash-icon"
import WarningCircleIcon from "../../fundamentals/icons/warning-circle" import WarningCircleIcon from "../../fundamentals/icons/warning-circle"
import Tooltip from "../../atoms/tooltip" import Modal from "../../molecules/modal"
type FileSummaryProps = { type FileSummaryProps = {
name: string name: string
@@ -215,6 +216,8 @@ function UploadModal(props: UploadModalProps) {
onFileRemove() onFileRemove()
} }
const download = useHref(templateLink)
return ( return (
<Modal open handleClose={onClose}> <Modal open handleClose={onClose}>
<Modal.Body> <Modal.Body>
@@ -272,11 +275,7 @@ function UploadModal(props: UploadModalProps) {
name="medusa-template.csv" name="medusa-template.csv"
size={2967} size={2967}
action={ action={
<a <a className="h-6 w-6 cursor-pointer" href={download} download>
className="h-6 w-6 cursor-pointer"
href={templateLink}
download
>
<DownloadIcon stroke="#9CA3AF" /> <DownloadIcon stroke="#9CA3AF" />
</a> </a>
} }