Skip to content

Commit

Permalink
♻️ refactor to abstract costBasedMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkjrs committed Mar 27, 2024
1 parent 8f67ad0 commit 8bcd6e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/StatsHighlights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import { CampaignStatsData } from '@tincre/promo-types';
import { ArrowDownIcon, ArrowUpIcon } from '@heroicons/react/20/solid';
import { YouTubeIcon } from './YouTubeIcon';

const costBasedMetrics = ['CPM', 'CPC', 'CPV'];
/* @ts-ignore */
function classNames(...classes) {
return classes.filter(Boolean).join(' ');
Expand Down Expand Up @@ -80,7 +82,7 @@ export function StatsHighlights({
)}
>
{item.changeType === 'increase' ? (
!['CPM', 'CPC', 'CPV'].includes(item.name) ? (
!costBasedMetrics.includes(item.name) ? (
<ArrowUpIcon
className="h-5 w-5 flex-shrink-0 self-center text-green-600 dark:text-green-400"
aria-hidden="true"
Expand All @@ -92,7 +94,7 @@ export function StatsHighlights({
/>
)
) : item.changeType !== 'same' ? (
!['CPM', 'CPC', 'CPV'].includes(item.name) ? (
!costBasedMetrics.includes(item.name) ? (
<ArrowDownIcon
className="h-5 w-5 flex-shrink-0 self-center text-red-600 dark:text-red-400"
aria-hidden="true"
Expand Down

0 comments on commit 8bcd6e0

Please sign in to comment.