feat: some ui updates
This commit is contained in:
@@ -92,6 +92,25 @@ const formatCurrency = (value: number | null | undefined): string => {
|
||||
}).format(value);
|
||||
};
|
||||
|
||||
const getCreativeWord = (count: number): string => {
|
||||
const mod10 = count % 10;
|
||||
const mod100 = count % 100;
|
||||
|
||||
if (mod100 >= 11 && mod100 <= 14) {
|
||||
return "креативов";
|
||||
}
|
||||
|
||||
if (mod10 === 1) {
|
||||
return "креатив";
|
||||
}
|
||||
|
||||
if (mod10 >= 2 && mod10 <= 4) {
|
||||
return "креатива";
|
||||
}
|
||||
|
||||
return "креативов";
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// Component
|
||||
// ============================================================================
|
||||
@@ -217,7 +236,7 @@ export default function CreativesPage() {
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold tracking-tight">Креативы</h1>
|
||||
<p className="text-muted-foreground">
|
||||
{filteredCreatives.length} креативов • {formatCurrency(totals.cost)} •{" "}
|
||||
{filteredCreatives.length} {getCreativeWord(filteredCreatives.length)} • {formatCurrency(totals.cost)} •{" "}
|
||||
{formatNumber(totals.subscriptions)} подписчиков
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user