-
+
= ({ sessionId }) => {
export const Components: FC = (): ReactElement => {
const { data: mentor, isLoading: loadingMentor } = useGetMentorMe();
const mentorId = mentor?.id ?? '';
+ const { data: stats } = useGetMentorStats(mentorId);
const { data: sessions, isLoading } = useGetMentorSessions(mentorId);
+ const [params, setParams] = useSearchParams();
+ const tab = params.get('tab') ?? 'sessions';
+
+ const all = sessions?.sessions ?? [];
+ const sessionCount = all.length;
+ const completedCount = all.filter((s) => s.status === 'completed').length;
+ const confirmedCount = all.filter((s) => s.status === 'confirmed').length;
+ const pendingCount = all.filter((s) => s.status === 'pending').length;
+ const menteeCount = new Set(
+ all.map((s) => s.mentee_email ?? s.mentee_fullname ?? '')
+ ).size;
+
+ const isMentor = !loadingMentor && !!mentor;
+
+ const setTab = (key: string) => {
+ if (key === 'sessions') params.delete('tab');
+ else params.set('tab', key);
+ setParams(params, { replace: true });
+ };
+
+ const content = useMemo(() => {
+ switch (tab) {
+ case 'setup':
+ return (
+
+
+
+
+
+
+
Mentoring Setup
+
+ Atur jadwal sesi & topik mentoring kamu.
+
+
+
+
+
+
+ Waktu Sesi
+
+
+ Sesi mentoring kamu berjalan {confirmedCount > 0 ? `${confirmedCount} terkunci` : 'belum ada yang terkunci'}. Jadwal sesi tampil otomatis setelah mentee booking & pembayaran lunas.
+
+
+
+
+ Monetization
+
+
+ {pendingCount > 0
+ ? `${pendingCount} sesi menunggu konfirmasi pembayaran.`
+ : 'Tidak ada sesi menunggu pembayaran saat ini.'}
+
+
+
+
+ );
+ case 'mentee':
+ return (
+
+
+
+
+
+
+
List Mentee
+
+ {menteeCount} mentee unik pernah mengikuti sesimu.
+
+
+
+
+
+ {(session) => (
+
+
+
+ {(session.mentee_fullname ?? session.mentee_email ?? 'M')
+ .charAt(0)
+ .toUpperCase()}
+
+
+
+ {session.mentee_fullname ?? session.mentee_email ?? 'Mentee'}
+
+
{session.topic}
+
+
+
+ {session.status}
+
+
+ )}
+
+ {all.length === 0 && (
+
+ Belum ada mentee yang mengikuti sesimu.
+
+ )}
+
+
+ );
+ case 'feedback':
+ return (
+
+
+
+
+
+
+
Feedback
+
+ Rating & feedback dari mentee setelah sesi selesai.
+
+
+
+
+
โญ
+
+ Feedback mentee akan muncul di sini setelah sesi selesai
+ ({completedCount} sesi selesai).
+
+
+
+ );
+ default:
+ return (
+
+
+ {(session) => (
+
+
+
+ {session.topic}
+
+
+ {session.status}
+
+
+
+
+ ๐
{formatDate(session.scheduled_at)}
+
+
+ ๐งโ๐{' '}
+ {session.mentee_fullname ?? session.mentee_email ?? 'Mentee'}
+ {' ยท '}
+ {session.session_type === 'video_call' ? 'Video Call' : 'Chat'}
+
+
+
+
+
+
+
+ Lihat Detail
+
+
+
+
+ )}
+
+
+ );
+ }
+ }, [tab, all, confirmedCount, pendingCount, completedCount, menteeCount]);
return (
-
+
-
-
- Dashboard Mentor
-
-
- Permintaan sesi yang masuk ke kamu beserta status pembayarannya.
-
-
-
{
}
>
- 0}
- fallback={
-
-
- Belum ada permintaan sesi mentoring.
-
-
- }
- >
-
-
- {(session) => (
-
-
-
- {session.topic}
-
-
- {session.status}
-
-
-
-
- ๐
{formatDate(session.scheduled_at)}
-
-
- ๐งโ๐{' '}
- {session.mentee_fullname ?? session.mentee_email ?? 'Mentee'}
- {' ยท '}
- {session.session_type === 'video_call'
- ? 'Video Call'
- : 'Chat'}
-
-
-
-
-
-
-
- Lihat Detail
-
-
-
-
- )}
-
-
-
- }
- >
-
- {[0, 1].map((i) => (
-
- ))}
+
+
+ Kamu belum terdaftar sebagai mentor. Daftar dulu untuk menerima
+ permintaan sesi.
+
+
+ Daftar Jadi Mentor
+
-
- }
- >
-
-
- Kamu belum terdaftar sebagai mentor. Daftar dulu untuk menerima
- permintaan sesi.
-
-
-
Daftar Jadi Mentor
-
-
-
+ }
+ >
+ {/* Overview stats */}
+
+ } label="Your Rating" value={stats?.avg_rating?.toFixed(1) ?? '-'} />
+ } label="Session Complete" value={completedCount} />
+ } label="Mentee Impacted" value={menteeCount} />
+ } label="Total Feedback" value={completedCount} />
+
+
+ {/* Tabs */}
+
+ {TABS.map((t) => (
+ setTab(t.key)}
+ className={cn(
+ 'shrink-0 px-4 py-2.5 text-sm font-medium border-b-2 -mb-px transition-colors',
+ tab === t.key
+ ? 'border-primary-500 text-primary-600'
+ : 'border-transparent text-neutral-500 hover:text-neutral-700'
+ )}
+ >
+ {t.label}
+
+ ))}
+
+
+
+
0 || tab !== 'sessions'}
+ fallback={
+
+
+ Belum ada permintaan sesi mentoring.
+
+
+ }
+ >
+ {content}
+
+ }
+ >
+
+ {[0, 1].map((i) => (
+
+ ))}
+
+
+
+
-
+
);
};
-export default Components;
+export default Components;
\ No newline at end of file
diff --git a/apps/dimentorin/src/app/(public)/mentoring/my-sessions/page.tsx b/apps/dimentorin/src/app/(public)/mentoring/my-sessions/page.tsx
index 512683b..65fb80a 100644
--- a/apps/dimentorin/src/app/(public)/mentoring/my-sessions/page.tsx
+++ b/apps/dimentorin/src/app/(public)/mentoring/my-sessions/page.tsx
@@ -9,6 +9,7 @@ import {
} from '@imphnen-frontend-service/service';
import { ReloadOutlined } from '@ant-design/icons';
import { toast } from 'sonner';
+import { DashboardLayout } from '../_components/dashboard-layout';
const STATUS_STYLE: Record