Improve dashboard charts, category tree selects, and product AI name fill.
Fix RTL chart ordering with Y-axis and hover values; aggregate website views; refine category picker tree borders and spacing; add one-click FA→EN name translation on add product. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
7b2ed7c7b0
commit
a412cb82fc
@@ -0,0 +1,17 @@
|
||||
/** Nice Y-axis ticks from 0 through a ceiling of `max`. */
|
||||
export function buildYAxisTicks(max: number, segments = 4): number[] {
|
||||
if (max <= 0) return [0, 1]
|
||||
const step = Math.max(1, Math.ceil(max / segments))
|
||||
const top = Math.ceil(max / step) * step
|
||||
const ticks: number[] = []
|
||||
for (let value = 0; value <= top; value += step) {
|
||||
ticks.push(value)
|
||||
}
|
||||
return ticks
|
||||
}
|
||||
|
||||
export function formatChartCount(value: number, locale: string): string {
|
||||
return value.toLocaleString(locale === 'fa' ? 'fa-IR' : 'en-US', {
|
||||
numberingSystem: 'latn',
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user