From 6eb5daf63046c7455efcc2b80468de5f368c70e5 Mon Sep 17 00:00:00 2001 From: Aleksandr Tereshchenko Date: Wed, 18 Dec 2024 16:18:43 +0200 Subject: [PATCH] Add approve button to allow approvers to do it with single click --- .../ThesisPage/ViewThesisFooter.tsx | 39 ++++++++++++++++++- src/client/locales/en.json | 1 + src/client/locales/fi.json | 1 + 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/client/components/ThesisPage/ViewThesisFooter.tsx b/src/client/components/ThesisPage/ViewThesisFooter.tsx index 3a3c1a7c..90843c59 100644 --- a/src/client/components/ThesisPage/ViewThesisFooter.tsx +++ b/src/client/components/ThesisPage/ViewThesisFooter.tsx @@ -31,10 +31,14 @@ import usePrograms from '../../hooks/usePrograms' import useEvents from '../../hooks/useEvents' import { useSingleThesis } from '../../hooks/useTheses' -import { BASE_PATH } from '../../../config' +import { BASE_PATH, THESIS_STATUSES } from '../../../config' import EventsView from '../EventsView/EventsView' import { useState } from 'react' import { ExpandLess, ExpandMore } from '@mui/icons-material' +import { useEditThesisMutation } from '../../hooks/useThesesMutation' +import useLoggedInUser from '../../hooks/useLoggedInUser' + +const IN_PROGRESS_STATUS = THESIS_STATUSES.IN_PROGRESS as 'IN_PROGRESS' const StatusRow = ({ thesis }: { thesis: Thesis }) => ( @@ -416,8 +422,37 @@ const ViewThesisFooter = ( - {thesis && ( + {thesis && currentUser && ( + {Boolean( + thesis.status === THESIS_STATUSES.PLANNING && + thesis.approvers?.length && + thesis.approvers[0].id === currentUser?.id + ) && ( + + )}