|
3 | 3 | import { useMemo, useState } from "react"; |
4 | 4 | import Link from "next/link"; |
5 | 5 |
|
| 6 | +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; |
6 | 7 | import { Button } from "@/components/ui/button"; |
7 | 8 | import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; |
8 | 9 | import { APP_ROLES, type AppRole } from "@/constants/roles"; |
@@ -49,6 +50,17 @@ const REPORT_EXPORT_ROLES: ReadonlySet<AppRole> = new Set([ |
49 | 50 | APP_ROLES.CAMPUS_HEAD, |
50 | 51 | ]); |
51 | 52 |
|
| 53 | +function getInitials(fullName: string) { |
| 54 | + return ( |
| 55 | + fullName |
| 56 | + .split(" ") |
| 57 | + .map((part) => part[0]) |
| 58 | + .join("") |
| 59 | + .slice(0, 2) |
| 60 | + .toUpperCase() || "F" |
| 61 | + ); |
| 62 | +} |
| 63 | + |
52 | 64 | export function FacultyReportScreen({ facultyId }: FacultyReportScreenProps) { |
53 | 65 | const [isExportDialogOpen, setIsExportDialogOpen] = useState(false); |
54 | 66 | const viewModel = useFacultyReportDetailViewModel({ facultyId }); |
@@ -147,9 +159,22 @@ export function FacultyReportScreen({ facultyId }: FacultyReportScreenProps) { |
147 | 159 | {/* Title row — mirrors the dashboard / faculty-list header pattern */} |
148 | 160 | <div className="flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between"> |
149 | 161 | <div className="min-w-0"> |
150 | | - <h1 className="font-playfair text-2xl font-semibold tracking-tight sm:text-3xl"> |
151 | | - {viewModel.report.faculty.name} |
152 | | - </h1> |
| 162 | + <div className="flex items-center gap-3"> |
| 163 | + <Avatar size="lg" className="border border-border/70"> |
| 164 | + {viewModel.report.faculty.profilePicture ? ( |
| 165 | + <AvatarImage |
| 166 | + src={viewModel.report.faculty.profilePicture} |
| 167 | + alt={viewModel.report.faculty.name} |
| 168 | + /> |
| 169 | + ) : null} |
| 170 | + <AvatarFallback className="bg-slate-100 text-sm font-semibold text-slate-700"> |
| 171 | + {getInitials(viewModel.report.faculty.name)} |
| 172 | + </AvatarFallback> |
| 173 | + </Avatar> |
| 174 | + <h1 className="font-playfair text-2xl font-semibold tracking-tight sm:text-3xl"> |
| 175 | + {viewModel.report.faculty.name} |
| 176 | + </h1> |
| 177 | + </div> |
153 | 178 | <p className="mt-3 max-w-3xl text-sm text-muted-foreground"> |
154 | 179 | Review per-question faculty evaluation results for{" "} |
155 | 180 | <span className="font-medium text-foreground">{viewModel.semesterLabel}</span>. |
|
0 commit comments