forked from Talenttrust/Talenttrust-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReputationPageContent.tsx
More file actions
55 lines (50 loc) · 1.78 KB
/
Copy pathReputationPageContent.tsx
File metadata and controls
55 lines (50 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'use client';
import React, { Suspense } from 'react';
import EmptyState from '../../components/EmptyState';
import ReputationProfile from '../../components/ReputationProfile';
import ReputationSummaryCard from '../../components/ReputationSummaryCard';
import ReputationErrorBoundary from '../../components/ReputationErrorBoundary';
import type { Reputation } from '@/types/domain';
export type ReputationPageContentProps = {
reputationData?: Reputation | null;
userName?: string;
};
export function ReputationPageContent({
reputationData,
userName = 'User',
}: ReputationPageContentProps) {
const score = reputationData?.score;
const hasReputation = typeof score === 'number' && score >= 0;
return (
<ReputationErrorBoundary>
{!reputationData || !hasReputation ? (
<main className="min-h-screen p-8">
<h1 className="text-2xl font-bold mb-6">Reputation</h1>
<EmptyState
illustration="reputation"
title="No reputation yet"
description="Your reputation will be built as you complete contracts and receive feedback from clients. Start by creating and fulfilling your first contract."
/>
</main>
) : (
<main className="min-h-screen p-8">
<h1 className="text-2xl font-bold mb-6">Reputation</h1>
<ReputationSummaryCard
name={userName}
score={score}
level={reputationData.level}
history={reputationData.history}
/>
<Suspense fallback={null}>
<ReputationProfile
name={userName}
score={score}
level={reputationData.level}
history={reputationData.history}
/>
</Suspense>
</main>
)}
</ReputationErrorBoundary>
);
}