-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard,types): split damaged activity from received
- Loading branch information
Showing
5 changed files
with
211 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...d/src/routes/orders/order-detail/components/order-summary-section/return-info-popover.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_", "")} | ||
</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)} | ||
</Text> | ||
</div> | ||
</Popover.Content> | ||
</Popover> | ||
) | ||
} | ||
|
||
export default ReturnInfoPopover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters