From 0e86f8c852edd52508102ec2eb87c6170b853975 Mon Sep 17 00:00:00 2001 From: nebby2105 Date: Wed, 4 Dec 2024 13:32:02 +0200 Subject: [PATCH] fixed comments --- .../CooperationCompletion.tsx | 6 +++++- .../cooperation-details/CooperationDetails.tsx | 17 +++++++++++------ .../interfaces/cooperation.interface.ts | 4 ++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/containers/my-cooperations/cooperation-completion/CooperationCompletion.tsx b/src/containers/my-cooperations/cooperation-completion/CooperationCompletion.tsx index 4b2d1a7c7..bbab40dca 100644 --- a/src/containers/my-cooperations/cooperation-completion/CooperationCompletion.tsx +++ b/src/containers/my-cooperations/cooperation-completion/CooperationCompletion.tsx @@ -14,8 +14,10 @@ import { ButtonVariantEnum, SizeEnum, CooperationMaterialsAccessEnum, - UserRoleEnum + UserRoleEnum, + StatusEnum } from '~/types' +import { useAppSelector } from '~/hooks/use-redux' interface CooperationCompletionProps { onCloseCooperation: () => void @@ -27,6 +29,7 @@ const CooperationCompletion: React.FC = ({ userRole }) => { const { t } = useTranslation() + const cooperationStatus = useAppSelector((state) => state.cooperations.status) const [materialsAccess, setMaterialsAccess] = useState( @@ -47,6 +50,7 @@ const CooperationCompletion: React.FC = ({ > { return cooperationContent } - const isCooperationClosingRequestSend = - response.needAction === userRole && - response.status === StatusEnum.RequestToClose + const closeCooperationInitiator = + response.needAction === response.receiverRole + ? response.initiator + : response.receiver - const acceptClosingProccess = !isClosed && ( + const acceptClosingProcess = !isClosed && ( ) + const isCooperationClosingRequestSend = + response.needAction === userRole && + response.status === StatusEnum.RequestToClose + const iconConditionals = isNotesOpen ? ( ) : ( @@ -200,7 +205,7 @@ const CooperationDetails = () => { {activeTab === CooperationTabsEnum.Activities && isCooperationClosingRequestSend && - acceptClosingProccess} + acceptClosingProcess} {pageContent()} {!isDesktop && isNotesOpen && ( diff --git a/src/types/cooperation/interfaces/cooperation.interface.ts b/src/types/cooperation/interfaces/cooperation.interface.ts index d133be8af..a1aebf637 100644 --- a/src/types/cooperation/interfaces/cooperation.interface.ts +++ b/src/types/cooperation/interfaces/cooperation.interface.ts @@ -17,11 +17,14 @@ export interface Cooperation extends CommonEntityFields { role: UserRoleEnum } initiator: Pick + initiatorRole: 'tutor' | 'student' title: Offer['title'] price: Offer['price'] proficiencyLevel: ProficiencyLevelEnum status: StatusEnum needAction: UserRoleEnum + receiver: Pick + receiverRole: 'tutor' | 'student' sections: CourseSection[] } @@ -52,6 +55,7 @@ export interface MyCooperationDetails { proficiencyLevel: ProficiencyLevelEnum initiator: UserResponse initiatorRole: UserRoleEnum + status: StatusEnum } export interface CreateCooperationsParams extends EnrollOfferForm {