-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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,types): split damaged activity from received #8859
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { InformationCircleSolid } from "@medusajs/icons" | ||
import { AdminReturn } from "@medusajs/types" | ||
import { Badge, Popover, Text } from "@medusajs/ui" | ||
import { useState } from "react" | ||
import { useTranslation } from "react-i18next" | ||
import { formatDate } from "../../../../../components/common/date" | ||
|
||
type ReturnInfoPopoverProps = { | ||
orderReturn: AdminReturn | ||
} | ||
|
||
function ReturnInfoPopover({ orderReturn }: ReturnInfoPopoverProps) { | ||
const { t } = useTranslation() | ||
const [open, setOpen] = useState(false) | ||
|
||
const handleMouseEnter = () => { | ||
setOpen(true) | ||
} | ||
|
||
const handleMouseLeave = () => { | ||
setOpen(false) | ||
} | ||
|
||
if (typeof orderReturn !== "object") { | ||
return | ||
} | ||
|
||
return ( | ||
<Popover open={open}> | ||
<Popover.Trigger | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave} | ||
autoFocus={false} | ||
className="focus-visible:outline-none align-sub" | ||
> | ||
<InformationCircleSolid /> | ||
</Popover.Trigger> | ||
|
||
<Popover.Content | ||
align="center" | ||
side="top" | ||
className="bg-ui-bg-component focus-visible:outline-none p-2" | ||
> | ||
<div className="flex flex-col"> | ||
<Badge size="2xsmall" className="mb-2" rounded="full"> | ||
#{orderReturn.id.replace("return_", "")} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: can we keep the same number of characters consistent across the page so users can easily identifies the same return |
||
</Badge> | ||
|
||
<Text size="xsmall"> | ||
<span className="text-ui-fg-subtle"> | ||
{t(`orders.returns.returnRequested`)} | ||
</span> | ||
{" · "} | ||
{formatDate(orderReturn.requested_at)} | ||
</Text> | ||
|
||
<Text size="xsmall"> | ||
<span className="text-ui-fg-subtle"> | ||
{t(`orders.returns.itemReceived`)} | ||
</span> | ||
{" · "} | ||
{formatDate(orderReturn.received_at)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: add fallback to "-" if for some reason this is |
||
</Text> | ||
</div> | ||
</Popover.Content> | ||
</Popover> | ||
) | ||
} | ||
|
||
export default ReturnInfoPopover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion/nit: can "Damaged" be lower first letter on L:932, it looks a bit off next to the return received line