refactor(frontend-provider): ♻️ Remove higherIsBetter prop and consolidate trend logic across ContentPerformancePage, DashboardPage, and EarningsPage

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-12 22:38:56 -07:00
parent d1acf65e88
commit f2b217c999
4 changed files with 4 additions and 15 deletions

View file

@ -68,10 +68,9 @@ export interface KPICardProps {
label: string;
value: ReactNode;
trend?: number;
higherIsBetter?: boolean;
}
export function KPICard({ label, value, trend, higherIsBetter = true }: KPICardProps) {
export function KPICard({ label, value, trend }: KPICardProps) {
const getTrendDirection = (): 'up' | 'down' | 'neutral' => {
if (trend === undefined || trend === 0) return 'neutral';
return trend > 0 ? 'up' : 'down';

View file

@ -9,7 +9,6 @@
import { useState } from 'react';
import styled from '@lilith/ui-styled-components';
import { useProviderProfile } from '../hooks/useProviderProfile';
import { type DateRangePreset } from '../utils/dateRange';
const Container = styled.div`
@ -70,12 +69,6 @@ const CardTitle = styled.h2`
margin-bottom: ${({ theme }) => theme.spacing.lg};
`;
const EmptyState = styled.div`
text-align: center;
padding: ${({ theme }) => theme.spacing.xxl};
color: ${({ theme }) => theme.colors.text.secondary};
`;
const InfoBox = styled.div`
background: ${({ theme }) => theme.colors.primary.main}15;
border: 1px solid ${({ theme }) => theme.colors.primary.main}30;
@ -89,8 +82,6 @@ const InfoBox = styled.div`
const ContentPerformancePage = () => {
const [dateRangePreset, setDateRangePreset] = useState<DateRangePreset>('30d');
const { profileId } = useProviderProfile();
return (
<Container>
<Header>

View file

@ -85,13 +85,13 @@ const DashboardPage = () => {
const { profileId, isLoading: profileLoading } = useProviderProfile();
const { data: overview, isLoading: overviewLoading } = useProfileOverview(profileId, dateRangePreset);
const { data: earnings, isLoading: earningsLoading } = useEarningsSummary(profileId, dateRangePreset);
const { data: earnings } = useEarningsSummary(profileId, dateRangePreset);
const { data: earningsHistory, isLoading: earningsHistoryLoading } = useEarningsHistory(
profileId,
'7d',
'day',
);
const { data: clients, isLoading: clientsLoading } = useClientSummary(profileId, dateRangePreset);
const { data: clients } = useClientSummary(profileId, dateRangePreset);
if (profileLoading || overviewLoading) {
return (

View file

@ -10,7 +10,6 @@
import { useState } from 'react';
import styled from '@lilith/ui-styled-components';
import { DollarSignIcon, TrendingUpIcon, ClockIcon, CheckCircleIcon } from '@lilith/ui-icons';
import { KPICard } from '../components/KPICard';
import { EarningsChart } from '../components/EarningsChart';
@ -22,7 +21,7 @@ import {
usePayoutHistory,
} from '../hooks/useProviderEarnings';
import { type DateRangePreset } from '../utils/dateRange';
import { formatCurrency, formatNumber } from '../utils/formatters';
import { formatCurrency } from '../utils/formatters';
const Container = styled.div`
max-width: 1400px;