diff --git a/frontend/src/components/projectDetail/index.js b/frontend/src/components/projectDetail/index.js
index ca4c2d08c3..675113cbc4 100644
--- a/frontend/src/components/projectDetail/index.js
+++ b/frontend/src/components/projectDetail/index.js
@@ -260,7 +260,7 @@ export const ProjectDetail = (props) => {
diff --git a/frontend/src/components/projectDetail/questionsAndComments.js b/frontend/src/components/projectDetail/questionsAndComments.js
index f41eb90adc..2f81459f22 100644
--- a/frontend/src/components/projectDetail/questionsAndComments.js
+++ b/frontend/src/components/projectDetail/questionsAndComments.js
@@ -85,27 +85,30 @@ export const QuestionsAndComments = ({ project, contributors, titleClass }) => {
- {commentsStatus === 'loading' ? (
-
- ) : commentsStatus === 'error' ? (
+ {commentsStatus === 'loading' &&
}{' '}
+ {commentsStatus === 'error' && (
- ) : comments?.chat.length ? (
-
- ) : (
-
-
-
)}
-
+ {commentsStatus === 'success' && (
+ <>
+ {comments?.chat.length ? (
+
+ ) : (
+
+
+
+ )}
+ >
+ )}
{comments?.pagination?.pages > 0 && (
{
export const TimeStats = ({ id }) => {
const { data: stats, status } = useProjectStatisticsQuery(id);
- return (
- <>
- {status === 'error' ? (
-
-
-
- ) : status === 'loading' ? (
-
- ) : (
-
- )}
- >
- );
+ if (status === 'loading') {
+ return ;
+ }
+ if (status === 'error') {
+ return (
+
+
+
+ );
+ }
+
+ return ;
};
diff --git a/frontend/src/components/taskSelection/taskActivity.js b/frontend/src/components/taskSelection/taskActivity.js
index 87c1a9618d..d83ea0c12a 100644
--- a/frontend/src/components/taskSelection/taskActivity.js
+++ b/frontend/src/components/taskSelection/taskActivity.js
@@ -82,12 +82,14 @@ export const TaskHistory = ({ projectId, taskId }) => {
const taskComments = commentPayload?.taskHistory.filter((t) => t.action === 'COMMENT');
const taskChanges = commentPayload?.taskHistory.filter((t) => t.action !== 'COMMENT');
- const shownHistory =
- historyOption === 'Comments'
- ? taskComments
- : historyOption === 'Activities'
- ? taskChanges
- : history;
+ let shownHistory;
+ if (historyOption === 'Comments') {
+ shownHistory = taskComments;
+ } else if (historyOption === 'Activities') {
+ shownHistory = taskChanges;
+ } else {
+ shownHistory = history;
+ }
const taskHistoryOptions = [
{ value: 'Comments', label: 'Comments' },
@@ -111,21 +113,32 @@ export const TaskHistory = ({ projectId, taskId }) => {
return res;
};
- return status === 'error' ? (
-
- ) : status === 'loading' ? (
-
-
-
- ) : history.length === 0 ? (
-
-
-
- ) : (
+ if (status === 'loading') {
+ return (
+
+
+
+ );
+ }
+
+ if (status === 'error') {
+ return (
+
+ );
+ }
+
+ if (history.length === 0) {
+ return (
+
+
+
+ );
+ }
+ return (
<>
{taskHistoryOptions.map((option) => (
diff --git a/frontend/src/components/teamsAndOrgs/teams.js b/frontend/src/components/teamsAndOrgs/teams.js
index 3520aaf59d..a20ef59578 100644
--- a/frontend/src/components/teamsAndOrgs/teams.js
+++ b/frontend/src/components/teamsAndOrgs/teams.js
@@ -63,21 +63,23 @@ export function TeamsManagement({
/>
- {teamsStatus === 'loading' ? (
+ {teamsStatus === 'loading' && (
- ) : teamsStatus === 'error' ? (
+ )}
+ {teamsStatus === 'error' && (
- ) : (
+ )}
+ {teamsStatus === 'success' && (
<>
{teams?.length ? (
- teams.map((team, n) =>
)
+ teams.map((team) =>
)
) : (
diff --git a/frontend/src/views/project.js b/frontend/src/views/project.js
index 89989124eb..d33b4bb3dc 100644
--- a/frontend/src/views/project.js
+++ b/frontend/src/views/project.js
@@ -169,21 +169,27 @@ export const ProjectDetailPage = () => {
window.scrollTo(0, 0);
}, [id]);
- return status === 'loading' ? (
-
}
- ready={false}
- />
- ) : status === 'error' ? (
- <>
- {error.response.data.SubCode === 'PrivateProject' ? (
-
- ) : (
-
- )}
- >
- ) : (
+ if (status === 'loading') {
+ return (
+
}
+ ready={false}
+ />
+ );
+ }
+ if (status === 'error') {
+ return (
+ <>
+ {error.response.data.SubCode === 'PrivateProject' ? (
+
+ ) : (
+
+ )}
+ >
+ );
+ }
+ return (
- {tasksStatus === 'error' ? (
+ {tasksStatus === 'loading' && (
+
+ )}
+ {tasksStatus === 'error' && (
- ) : tasksStatus === 'loading' ? (
-
- ) : (
+ )}
+ {tasksStatus === 'success' && (
Loading...}>
@@ -63,13 +65,15 @@ export function ProjectStats() {
{defaultComment?.[0] && (
- {editsStatus === 'error' ? (
+ {editsStatus === 'loading' && (
+
+ )}
+ {editsStatus === 'error' && (
- ) : editsStatus === 'loading' ? (
-
- ) : (
+ )}
+ {editsStatus === 'success' && (
Loading... }>
@@ -77,13 +81,15 @@ export function ProjectStats() {
)}
- {contributionsStatus === 'error' ? (
+ {contributionsStatus === 'error' && (
- ) : contributionsStatus === 'loading' ? (
+ )}
+ {contributionsStatus === 'loading' && (
- ) : (
+ )}
+ {contributionsStatus === 'success' && (
Loading...}>
@@ -95,33 +101,35 @@ export function ProjectStats() {
- {timelineDataStatus === 'loading' ? (
+ {timelineDataStatus === 'loading' && (
- ) : timelineDataStatus === 'error' ? (
+ )}
+ {timelineDataStatus === 'error' && (
- ) : (
+ )}
+ {timelineDataStatus === 'success' && (
Loading...}>
)}
- {tasksStatus === 'error' ? (
+ {tasksStatus === 'error' && (
- ) : tasksStatus === 'loading' ? (
+ )}
+ {tasksStatus === 'loading' && (
- ) : (
-
)}
+ {tasksStatus === 'success' &&
}