fix(dashboard): Truncate long product organization tags (#10261)
Resolves CMRC-736
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(dashboard): Truncate long product organization tags
|
||||||
+1
-1
@@ -59,7 +59,7 @@ export const ProductTagProductSection = ({
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
pageSize={PAGE_SIZE}
|
pageSize={PAGE_SIZE}
|
||||||
count={count}
|
count={count}
|
||||||
navigateTo={(row) => row.original.id}
|
navigateTo={(row) => `/products/${row.original.id}`}
|
||||||
search
|
search
|
||||||
pagination
|
pagination
|
||||||
orderBy={[
|
orderBy={[
|
||||||
|
|||||||
+29
-17
@@ -1,6 +1,6 @@
|
|||||||
import { PencilSquare } from "@medusajs/icons"
|
import { PencilSquare } from "@medusajs/icons"
|
||||||
import { HttpTypes } from "@medusajs/types"
|
import { HttpTypes } from "@medusajs/types"
|
||||||
import { Badge, Container, Heading } from "@medusajs/ui"
|
import { Badge, Container, Heading, Tooltip } from "@medusajs/ui"
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
import { Link } from "react-router-dom"
|
import { Link } from "react-router-dom"
|
||||||
import { ActionMenu } from "../../../../../components/common/action-menu"
|
import { ActionMenu } from "../../../../../components/common/action-menu"
|
||||||
@@ -41,9 +41,11 @@ export const ProductOrganizationSection = ({
|
|||||||
value={
|
value={
|
||||||
product.tags?.length
|
product.tags?.length
|
||||||
? product.tags.map((tag) => (
|
? product.tags.map((tag) => (
|
||||||
<Badge key={tag.id} className="w-fit" size="2xsmall" asChild>
|
<OrganizationTag
|
||||||
<Link to={`/products?tag_id=${tag.id}`}>{tag.value}</Link>
|
key={tag.id}
|
||||||
</Badge>
|
label={tag.value}
|
||||||
|
to={`/settings/product-tags/${tag.id}`}
|
||||||
|
/>
|
||||||
))
|
))
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
@@ -52,11 +54,10 @@ export const ProductOrganizationSection = ({
|
|||||||
title={t("fields.type")}
|
title={t("fields.type")}
|
||||||
value={
|
value={
|
||||||
product.type ? (
|
product.type ? (
|
||||||
<Badge size="2xsmall" className="w-fit" asChild>
|
<OrganizationTag
|
||||||
<Link to={`/products?type_id=${product.type_id}`}>
|
label={product.type.value}
|
||||||
{product.type.value}
|
to={`/settings/product-types/${product.type_id}`}
|
||||||
</Link>
|
/>
|
||||||
</Badge>
|
|
||||||
) : undefined
|
) : undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -65,11 +66,10 @@ export const ProductOrganizationSection = ({
|
|||||||
title={t("fields.collection")}
|
title={t("fields.collection")}
|
||||||
value={
|
value={
|
||||||
product.collection ? (
|
product.collection ? (
|
||||||
<Badge size="2xsmall" className="max-w-[182px]" asChild>
|
<OrganizationTag
|
||||||
<Link to={`/collections/${product.collection.id}`}>
|
label={product.collection.title}
|
||||||
<span className="truncate">{product.collection.title}</span>
|
to={`/collections/${product.collection.id}`}
|
||||||
</Link>
|
/>
|
||||||
</Badge>
|
|
||||||
) : undefined
|
) : undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -79,9 +79,11 @@ export const ProductOrganizationSection = ({
|
|||||||
value={
|
value={
|
||||||
product.categories?.length
|
product.categories?.length
|
||||||
? product.categories.map((pcat) => (
|
? product.categories.map((pcat) => (
|
||||||
<Badge key={pcat.id} className="w-fit" size="2xsmall" asChild>
|
<OrganizationTag
|
||||||
<Link to={`/categories/${pcat.id}`}>{pcat.name}</Link>
|
key={pcat.id}
|
||||||
</Badge>
|
label={pcat.name}
|
||||||
|
to={`/categories/${pcat.id}`}
|
||||||
|
/>
|
||||||
))
|
))
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
@@ -93,3 +95,13 @@ export const ProductOrganizationSection = ({
|
|||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const OrganizationTag = ({ label, to }: { label: string; to: string }) => {
|
||||||
|
return (
|
||||||
|
<Tooltip content={label}>
|
||||||
|
<Badge size="2xsmall" className="block w-fit truncate" asChild>
|
||||||
|
<Link to={to}>{label}</Link>
|
||||||
|
</Badge>
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user