fix(dashboard): truncate price cell titles (#9715)

Before:
![Screenshot 2024-10-22 at 17 14 56](https://github.com/user-attachments/assets/7ec74e70-c69f-4346-b15a-665fed27e688)

After
![Screenshot 2024-10-22 at 17 26 15](https://github.com/user-attachments/assets/b353c40b-7451-4bdf-9459-1494c18c7531)


Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>
This commit is contained in:
Frane PolićandKasper Fabricius Kristensen authored and GitHub committed 2024-11-04 11:01:00 +00:00
1 parent ab90900d40
commit 61cb97da26
3 files changed
+17 -8

No files matched your search

@@ -20,7 +20,9 @@ export const IncludesTaxTooltip = ({
: t("general.excludesTaxTooltip") : t("general.excludesTaxTooltip")
} }
> >
<BuildingTax className={clx({ "text-ui-fg-muted": !includesTax })} /> <BuildingTax
className={clx("shrink-0", { "text-ui-fg-muted": !includesTax })}
/>
</Tooltip> </Tooltip>
) )
} }
@@ -45,6 +45,10 @@ export const createDataGridPriceColumns = <
(p) => p.attribute === "currency_code" && p.value === currency (p) => p.attribute === "currency_code" && p.value === currency
) )
const translatedCurrencyName = t("fields.priceTemplate", {
regionOrCurrency: currency.toUpperCase(),
})
return columnHelper.column({ return columnHelper.column({
id: `currency_prices.${currency}`, id: `currency_prices.${currency}`,
name: t("fields.priceTemplate", { name: t("fields.priceTemplate", {
@@ -62,9 +66,9 @@ export const createDataGridPriceColumns = <
type: "number", type: "number",
header: () => ( header: () => (
<div className="flex w-full items-center justify-between gap-3"> <div className="flex w-full items-center justify-between gap-3">
{t("fields.priceTemplate", { <span className="truncate" title={translatedCurrencyName}>
regionOrCurrency: currency.toUpperCase(), {translatedCurrencyName}
})} </span>
<IncludesTaxTooltip includesTax={preference?.is_tax_inclusive} /> <IncludesTaxTooltip includesTax={preference?.is_tax_inclusive} />
</div> </div>
), ),
@@ -82,6 +86,10 @@ export const createDataGridPriceColumns = <
(p) => p.attribute === "region_id" && p.value === region.id (p) => p.attribute === "region_id" && p.value === region.id
) )
const translatedRegionName = t("fields.priceTemplate", {
regionOrCurrency: region.name,
})
return columnHelper.column({ return columnHelper.column({
id: `region_prices.${region.id}`, id: `region_prices.${region.id}`,
name: t("fields.priceTemplate", { name: t("fields.priceTemplate", {
@@ -99,9 +107,9 @@ export const createDataGridPriceColumns = <
type: "number", type: "number",
header: () => ( header: () => (
<div className="flex w-full items-center justify-between gap-3"> <div className="flex w-full items-center justify-between gap-3">
{t("fields.priceTemplate", { <span className="truncate" title={translatedRegionName}>
regionOrCurrency: region.name, {translatedRegionName}
})} </span>
<IncludesTaxTooltip includesTax={preference?.is_tax_inclusive} /> <IncludesTaxTooltip includesTax={preference?.is_tax_inclusive} />
</div> </div>
), ),
@@ -64,7 +64,6 @@ export const EditRegionForm = ({
currency_code: values.currency_code.toLowerCase(), currency_code: values.currency_code.toLowerCase(),
payment_providers: values.payment_providers, payment_providers: values.payment_providers,
is_tax_inclusive: values.is_tax_inclusive, is_tax_inclusive: values.is_tax_inclusive,
automatic_taxes: values.automatic_taxes,
}, },
{ {
onSuccess: () => { onSuccess: () => {