Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/common/CreatorProfileInfoGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import CreatorProfileStatItem from './CreatorProfileStatItem';
interface CreatorProfileInfoItem {
label: string;
value: ReactNode;
helperText?: ReactNode;
}

interface CreatorProfileInfoGridProps {
Expand All @@ -28,6 +29,7 @@ const CreatorProfileInfoGrid: React.FC<CreatorProfileInfoGridProps> = ({
key={item.label}
label={item.label}
value={item.value}
helperText={item.helperText}
/>
))}
</div>
Expand Down
7 changes: 7 additions & 0 deletions src/components/common/CreatorProfileStatItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { cn } from '@/lib/utils';
interface CreatorProfileStatItemProps {
label: string;
value: ReactNode;
helperText?: ReactNode;
className?: string;
}

const CreatorProfileStatItem: React.FC<CreatorProfileStatItemProps> = ({
label,
value,
helperText,
className,
}) => {
return (
Expand All @@ -26,6 +28,11 @@ const CreatorProfileStatItem: React.FC<CreatorProfileStatItemProps> = ({
<div className="relative z-10 mt-2.5 font-jakarta text-base font-bold text-white md:text-[1.05rem]">
{value}
</div>
{helperText && (
<p className="relative z-10 mt-1.5 text-xs text-white/45">
{helperText}
</p>
)}
</div>
);
};
Expand Down
29 changes: 29 additions & 0 deletions src/components/common/__tests__/CreatorProfileStatItem.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import CreatorProfileStatItem from '../CreatorProfileStatItem';

describe('CreatorProfileStatItem', () => {
it('renders helper text beneath the value when provided', () => {
render(
<CreatorProfileStatItem
label="Followers"
value="Not available"
helperText="Follower count not available yet."
/>
);

expect(screen.getByText('Followers')).toBeInTheDocument();
expect(screen.getByText('Not available')).toBeInTheDocument();
expect(
screen.getByText('Follower count not available yet.')
).toBeInTheDocument();
});

it('omits helper text when not provided', () => {
render(<CreatorProfileStatItem label="Followers" value="12.4K" />);

expect(
screen.queryByText('Follower count not available yet.')
).not.toBeInTheDocument();
});
});
15 changes: 15 additions & 0 deletions src/pages/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const FEATURED_CREATOR_FACTS = [
{ label: 'Community', value: 'Private behind-the-scenes notes' },
];

const FEATURED_CREATOR_FOLLOWER_COUNT: number | null = null;

// Fallback demo data in case API fails
const DEMO_CREATORS: Course[] = [
{
Expand Down Expand Up @@ -598,6 +600,19 @@ function LandingPage() {
<CreatorProfileInfoGrid
items={[
...FEATURED_CREATOR_FACTS,
{
label: 'Followers',
value:
FEATURED_CREATOR_FOLLOWER_COUNT != null
? formatCompactNumber(
FEATURED_CREATOR_FOLLOWER_COUNT
)
: 'Not available',
helperText:
FEATURED_CREATOR_FOLLOWER_COUNT != null
? undefined
: 'Follower count not available yet.',
},
{
label: 'Your holdings',
value: `${formatNumber(featuredHoldings)} keys`,
Expand Down
Loading