fix(dashboard): cleanup Payments section (#9520)

**What**
- fix content breaking
- use a shorter payment ID in the UI

---

FIXES CC-572
This commit is contained in:
Frane Polić
2024-10-17 11:36:02 +00:00
committed by GitHub
parent 1d540af783
commit 2cba362537
5 changed files with 61 additions and 15 deletions
@@ -0,0 +1,30 @@
import { useTranslation } from "react-i18next"
import { useState } from "react"
import copy from "copy-to-clipboard"
import { clx, toast, Tooltip } from "@medusajs/ui"
type DisplayIdProps = {
id: string
className?: string
}
function DisplayId({ id, className }: DisplayIdProps) {
const { t } = useTranslation()
const [open, setOpen] = useState(false)
const onClick = () => {
copy(id)
toast.success(t("actions.idCopiedToClipboard"))
}
return (
<Tooltip maxWidth={260} content={id} open={open} onOpenChange={setOpen}>
<span onClick={onClick} className={clx("cursor-pointer", className)}>
#{id.slice(-7)}
</span>
</Tooltip>
)
}
export default DisplayId
@@ -0,0 +1 @@
export * from "./display-id"