mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
fix: use short month names
This commit is contained in:
@@ -17,10 +17,8 @@ export function IncomeExpenceGraphTooltip({ data, defaultCurrency, position, vis
|
|||||||
const incomeCategories = data.categories.filter((cat) => cat.income > 0)
|
const incomeCategories = data.categories.filter((cat) => cat.income > 0)
|
||||||
const expenseCategories = data.categories.filter((cat) => cat.expenses > 0)
|
const expenseCategories = data.categories.filter((cat) => cat.expenses > 0)
|
||||||
|
|
||||||
// Calculate positioning - show to right if space available, otherwise to left
|
|
||||||
const tooltipWidth = 320 // estimated max width
|
const tooltipWidth = 320 // estimated max width
|
||||||
const spaceToRight = window.innerWidth - position.x
|
const spaceToRight = window.innerWidth - position.x
|
||||||
const spaceToLeft = position.x
|
|
||||||
const showToRight = spaceToRight >= tooltipWidth + 20 // 20px margin
|
const showToRight = spaceToRight >= tooltipWidth + 20 // 20px margin
|
||||||
|
|
||||||
const horizontalOffset = showToRight ? 15 : -15 // distance from cursor
|
const horizontalOffset = showToRight ? 15 : -15 // distance from cursor
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export function IncomeExpenseGraph({ data, defaultCurrency }: IncomeExpenseGraph
|
|||||||
onClick={() => item.income > 0 && handleBarClick(item, "income")}
|
onClick={() => item.income > 0 && handleBarClick(item, "income")}
|
||||||
>
|
>
|
||||||
{/* Period label above income bars */}
|
{/* Period label above income bars */}
|
||||||
<div className="text-sm font-bold text-gray-700 break-all mb-2 text-center">
|
<div className="text-sm font-bold text-gray-700 break-words mb-2 text-center">
|
||||||
{formatPeriodLabel(item.period, item.date)}
|
{formatPeriodLabel(item.period, item.date)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -127,9 +127,9 @@ export function formatPeriodLabel(period: string, date: Date): string {
|
|||||||
year: "numeric",
|
year: "numeric",
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// Monthly format: show month/year
|
// Monthly format: show month/year with short month name
|
||||||
return date.toLocaleDateString("en-US", {
|
return date.toLocaleDateString("en-US", {
|
||||||
month: "long",
|
month: "short",
|
||||||
year: "numeric",
|
year: "numeric",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user