- My Comments
+ {session?.clientComments?.length === 0 && session?.coachComments?.length === 0 ? 'Comments' : 'My Comments'}
{activeTab === 0 && (
-
}
- >
- Add new
-
+ <>
+
}
+ onClick={() => setOpenAddCommentModal(true)}
+ >
+ Add new
+
+
setOpenAddCommentModal(false)}
+ locale={locale}
+ sessionId={sessionId}
+ refresh={fetchData}
+ />
+ >
)}
-
- Sed tincidunt finibus eros nec feugiat. Nulla facilisi. Nunc maximus magna et egestas tincidunt. Integer lobortis laoreet neque at sodales. Aenean eget risus pharetra, efficitur dolor ut, commodo lacus. Sed vitae nunc odio. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis et velit et dolor rutrum euismod a pretium est.
-
-
- Coach Comments
-
-
- Sed tincidunt finibus eros nec feugiat. Nulla facilisi. Nunc maximus magna et egestas tincidunt. Integer lobortis laoreet neque at sodales. Aenean eget risus pharetra, efficitur dolor ut, commodo lacus. Sed vitae nunc odio. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis et velit et dolor rutrum euismod a pretium est.
-
+ {(session?.clientComments?.length > 0 || session?.coachComments?.length > 0) ? (
+ <>
+ {(isCoach ? session?.coachComments : session?.clientComments)?.map(({ id, comment }) => (
+
+ {comment}
+
+ ))}
+ {(isCoach ? session?.clientComments : session?.coachComments)?.length > 0 && (
+
+ {isCoach ? 'Client Comments' : 'Coach Comments'}
+
+ )}
+ {(isCoach ? session?.clientComments : session?.coachComments)?.map(({ id , comment }) => (
+
+ {comment}
+
+ ))}
+ >
+ ) : (
+ <>
+
+ >
+ )}
>
)}
diff --git a/src/components/Account/sessions/SessionsTabs.tsx b/src/components/Account/sessions/SessionsTabs.tsx
index 2a998a8..6c80bc6 100644
--- a/src/components/Account/sessions/SessionsTabs.tsx
+++ b/src/components/Account/sessions/SessionsTabs.tsx
@@ -12,7 +12,7 @@ import 'dayjs/locale/es';
import { Loader } from '../../view/Loader';
import { useLocalStorage } from '../../../hooks/useLocalStorage';
import { AUTH_TOKEN_KEY, AUTH_USER } from '../../../constants/common';
-import { getRecentSessions, getRequestedSessions, getUpcomingSessions } from '../../../actions/profile';
+import { getRecentSessions, getRequestedSessions, getUpcomingSessions } from '../../../actions/sessions';
import { Session, Sessions, SessionType } from '../../../types/sessions';
import { i18nText } from '../../../i18nKeys';
diff --git a/src/components/Modals/AddCommentModal.tsx b/src/components/Modals/AddCommentModal.tsx
new file mode 100644
index 0000000..6041871
--- /dev/null
+++ b/src/components/Modals/AddCommentModal.tsx
@@ -0,0 +1,110 @@
+'use client';
+
+import React, { FC, useEffect, useState } from 'react';
+import { Modal, Form, Input, notification, Button } from 'antd';
+import { CloseOutlined } from '@ant-design/icons';
+import dayjs from 'dayjs';
+import utc from 'dayjs/plugin/utc';
+import { i18nText } from '../../i18nKeys';
+import { addSessionComment } from '../../actions/sessions';
+import { useLocalStorage } from '../../hooks/useLocalStorage';
+import { AUTH_TOKEN_KEY } from '../../constants/common';
+
+dayjs.extend(utc);
+
+type AddCommentModalProps = {
+ open: boolean;
+ handleCancel: () => void;
+ locale: string;
+ sessionId: number;
+ refresh: () => void;
+};
+
+export const AddCommentModal: FC