Skip to content

Commit 772d5da

Browse files
committed
added profile
1 parent acf0049 commit 772d5da

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

my-app/src/views/ReviewView.jsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ export function ReviewView(props) {
1010
const gradeRef = useRef(null);
1111
const recommendRef = useRef(null);
1212

13+
// Function to get user initials from their name
14+
const getInitials = (name) => {
15+
if (!name) return "N/A";
16+
const words = name.trim().split(" ");
17+
if (words.length === 1) return words[0][0]?.toUpperCase() || "N/A";
18+
return `${words[0][0]?.toUpperCase() || ""}${words[words.length - 1][0]?.toUpperCase() || ""}`;
19+
};
20+
1321
useEffect(() => {
1422
function handleClickOutside(event) {
1523
if (gradeRef.current && !gradeRef.current.contains(event.target)) {
@@ -191,7 +199,12 @@ export function ReviewView(props) {
191199
return (
192200
<div key={i} className="bg-white shadow-md rounded-lg p-4">
193201
<div className="flex justify-between items-center mb-2">
194-
<p className="font-semibold text-gray-800">{rev.userName}</p>
202+
<div className="flex items-center gap-2">
203+
<div className="w-6 h-6 rounded-full bg-blue-600 text-white flex items-center justify-center text-sm font-semibold">
204+
{getInitials(rev.userName)}
205+
</div>
206+
<p className="font-semibold text-gray-800">{rev.userName}</p>
207+
</div>
195208
<p className="text-sm text-gray-500">
196209
Posted on{" "}
197210
{new Date(rev.timestamp).toLocaleDateString("en-US", {

0 commit comments

Comments
 (0)