From ef8b48ae2174deab5b66dc8c34e56b6df2168232 Mon Sep 17 00:00:00 2001
From: Jonnashell <35744008+Jonnashell@users.noreply.github.com>
Date: Thu, 25 Sep 2025 15:07:39 +0200
Subject: [PATCH] yes
---
src/components/header/index.js | 4 +++-
src/pages/profile/ProfilePage.jsx | 4 ++--
src/pages/profile/trainingInfo/index.jsx | 2 +-
src/pages/search/StudentSearchView.jsx | 12 ++++++++++--
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/components/header/index.js b/src/components/header/index.js
index 0f89717..49a3aa6 100644
--- a/src/components/header/index.js
+++ b/src/components/header/index.js
@@ -61,7 +61,9 @@ const Header = () => {
{name}
- {user.specialism}, {user.cohort.title}
+ {user?.cohort?.title
+ ? `${user.specialism}, ${user.cohort.title}`
+ : user.specialism}
diff --git a/src/pages/profile/ProfilePage.jsx b/src/pages/profile/ProfilePage.jsx
index 989cc85..8a183dc 100644
--- a/src/pages/profile/ProfilePage.jsx
+++ b/src/pages/profile/ProfilePage.jsx
@@ -119,8 +119,8 @@ const ProfilePage = () => {
role={tempCurrentUser?.role || ''}
specialism={tempCurrentUser?.specialism || ''}
cohort={tempCurrentUser?.cohort || ''}
- startDate={tempCurrentUser?.cohort.startDate || ''}
- endDate={tempCurrentUser?.cohort.endDate || ''}
+ startDate={tempCurrentUser?.cohort?.startDate || ''}
+ endDate={tempCurrentUser?.cohort?.endDate || ''}
isEditing={isEditing}
onChange={handleChange}
/>
diff --git a/src/pages/profile/trainingInfo/index.jsx b/src/pages/profile/trainingInfo/index.jsx
index 2d1f9f0..c3e48f2 100644
--- a/src/pages/profile/trainingInfo/index.jsx
+++ b/src/pages/profile/trainingInfo/index.jsx
@@ -46,7 +46,7 @@ const ProfileTrainingInfo = ({
onChange('cohort', e.target.value)}
className={getInputClass('cohort', isEditing, user.cohort)}
disabled={!canEditField('cohort', isEditing, user.cohort)}
diff --git a/src/pages/search/StudentSearchView.jsx b/src/pages/search/StudentSearchView.jsx
index 29f3654..71406e6 100644
--- a/src/pages/search/StudentSearchView.jsx
+++ b/src/pages/search/StudentSearchView.jsx
@@ -107,7 +107,11 @@ const StudentSearchView = () => {
{u.firstName} {u.lastName}
{/* Empty cohorts get a random cohort to ensure nice formatting */}
- {u.cohort.title ? u.cohort.title : 'Software Developer, Cohort 69'}
+
+ {u.cohort?.title
+ ? `${u.specialism}, ${u.cohort?.title}`
+ : `${u.specialism}`}
+
navigate(`/profile/${u.id}`)}>
Profile
@@ -133,7 +137,11 @@ const StudentSearchView = () => {
{u.firstName} {u.lastName}
{/* Empty cohorts get a random cohort to ensure nice formatting */}
-
{u.cohort.title ? u.cohort.title : 'Software Developer, Cohort 69'}
+
+ {u.cohort?.title
+ ? `${u.specialism}, ${u.cohort?.title}`
+ : `${u.specialism}`}
+