From 292c27ef64f6db2a79047856ffa970d5514ea28a Mon Sep 17 00:00:00 2001 From: Valery <57412523+valerydluski@users.noreply.github.com> Date: Sun, 10 Sep 2023 15:33:34 +0200 Subject: [PATCH] fix: update score height (#2296) * fix: update score height * fix: remove redundant code --- client/src/components/Sider/AdminSider.tsx | 2 +- .../src/modules/Score/components/ScoreTable/index.tsx | 2 +- client/src/pages/admin/mentor-registry.tsx | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/client/src/components/Sider/AdminSider.tsx b/client/src/components/Sider/AdminSider.tsx index a82c69c60b..36697a50b6 100644 --- a/client/src/components/Sider/AdminSider.tsx +++ b/client/src/components/Sider/AdminSider.tsx @@ -39,7 +39,7 @@ export function AdminSider(props: Props) { const adminMenuItems = getAdminMenuItems(session); const courseManagementMenuItems = useMemo( () => getCourseManagementMenuItems(session, props.activeCourse ?? activeCourse), - [activeCourse], + [activeCourse, props.activeCourse], ); const menuIconProps = { diff --git a/client/src/modules/Score/components/ScoreTable/index.tsx b/client/src/modules/Score/components/ScoreTable/index.tsx index 6eeddf137a..3af48cdcf3 100644 --- a/client/src/modules/Score/components/ScoreTable/index.tsx +++ b/client/src/modules/Score/components/ScoreTable/index.tsx @@ -180,7 +180,7 @@ export function ScoreTable(props: Props) { className="table-score" showHeader - scroll={{ x: getTableWidth(getVisibleColumns(columns).length), y: 'calc(95vh - 290px)' }} + scroll={{ x: getTableWidth(getVisibleColumns(columns).length), y: 'calc(95vh - 320px)' }} pagination={{ ...students.pagination, showTotal: total => `Total ${total} students` }} rowKey="githubId" rowClassName={record => (!record.isActive ? 'rs-table-row-disabled' : '')} diff --git a/client/src/pages/admin/mentor-registry.tsx b/client/src/pages/admin/mentor-registry.tsx index 96c2f4b37b..1bb7f8359e 100644 --- a/client/src/pages/admin/mentor-registry.tsx +++ b/client/src/pages/admin/mentor-registry.tsx @@ -6,7 +6,7 @@ import { Alert, Button, Col, Form, message, notification, Row, Select, Tabs, Typ import { DisciplineDto, DisciplinesApi, MentorRegistryDto } from 'api'; import { MentorRegistryService } from 'services/mentorRegistry'; -import { CourseRole } from 'services/models'; +import { Course, CourseRole } from 'services/models'; import { ModalForm } from 'components/Forms'; import { MentorRegistryResendModal } from 'modules/MentorRegistry/components/MentorRegistryResendModal'; import { MentorRegistryDeleteModal } from 'modules/MentorRegistry/components/MentorRegistryDeleteModal'; @@ -18,7 +18,8 @@ import { AdminPageLayout } from 'components/PageLayout'; import { tabRenderer } from 'components/TabsWithCounter/renderers'; import css from 'styled-jsx/css'; import { CommentModal } from 'components/CommentModal'; -import { ActiveCourseProvider, SessionProvider, useActiveCourseContext } from 'modules/Course/contexts'; +import { ActiveCourseProvider, SessionProvider } from 'modules/Course/contexts'; +import { CoursesService } from 'services/courses'; type NotificationType = 'success' | 'info' | 'warning' | 'error'; @@ -35,14 +36,15 @@ type ModalData = Partial<{ }>; const mentorRegistryService = new MentorRegistryService(); +const coursesService = new CoursesService(); const disciplinesApi = new DisciplinesApi(); function Page() { - const { courses } = useActiveCourseContext(); const [loading, withLoading] = useLoading(false); const [api, contextHolder] = notification.useNotification(); + const [courses, setCourses] = useState([]); const [modalLoading, setModalLoading] = useState(false); const [showAll, setShowAll] = useState(false); const [data, setData] = useState([]); @@ -61,9 +63,10 @@ function Page() { }; const loadData = withLoading(async () => { - const allData = await mentorRegistryService.getMentors(); + const [allData, courses] = await Promise.all([mentorRegistryService.getMentors(), coursesService.getCourses()]); const { data: disciplines } = await disciplinesApi.getDisciplines(); setAllData(allData); + setCourses(courses); updateData(showAll, allData); setDisciplines(disciplines); });