Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
Merge branch 'dev' into feature/permission-service
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Rybalko authored Jan 4, 2024
2 parents a8b03e1 + ae08498 commit 4ca1cfe
Show file tree
Hide file tree
Showing 36 changed files with 715 additions and 11,021 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: "[BUG] "
labels: bugfix
labels: ''
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Feature
about: New feature on the front-end site
title: "[FEATURE]"
title: ''
labels: feature
assignees: ''

Expand Down
331 changes: 331 additions & 0 deletions public/icons/halloween-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { AppBar, Box, Link } from '@mui/material';
import Image from 'next/image';
import NextLink from 'next/link';

// import { BurgerMenu } from '@/components/common/icons/BurgerMenu';
import { TransformedUser } from '@/components/common/layout/header/types';
import IconButton from '@/components/common/ui/icon-button-mui';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/ui/form/input-mui/Input.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const label = (state: InputState): SxProps<Theme> => ({
export const remark = (state: InputState): SxProps<Theme> => ({
margin: '2px 8px 0 16px',
'&.MuiFormHelperText-root': {
textTransform: 'lowercase',
textTransform: 'none',
},

...(state === InputState.ERROR && {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export const row: SxProps<Theme> = {
mobile: '8px',
desktop: '16px',
},
'& img': {
borderRadius: '50%',
'& .MuiAvatar-root': {
width: { mobile: '36px', desktop: '48px' },
height: { mobile: '36px', desktop: '48px' },
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { PlusIcon } from '@heroicons/react/24/solid';
import { Box, Grid, Typography, useMediaQuery } from '@mui/material';
import { Avatar, Box, Grid, Typography, useMediaQuery } from '@mui/material';

import { Captain } from '@/components/common/icons/Captain';
import { Moderator } from '@/components/common/icons/Moderator';
Expand Down Expand Up @@ -88,7 +88,7 @@ const StudentsTable: React.FC<StudentsTableProps> = ({
<Grid container key={index} sx={gridStyles.row}>
{row.imgSrc && (
<Grid item desktop={4} mobile={9}>
<img width={48} height={48} src={row.imgSrc} alt="avatar" />
<Avatar src={row.imgSrc} alt="avatar" />
{!isMobile && (
<Typography className="name">{row.fullName}</Typography>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const ChangePasswordForm = () => {
type={InputType.PASSWORD}
name="oldPassword"
isSuccessOnDefault={true}
showRemark={true}
/>
{errors.oldPassword === 'Введений пароль недійсний' && (
<Typography variant="body2">
Expand All @@ -77,6 +78,7 @@ const ChangePasswordForm = () => {
name="newPassword"
disabled={!!errors.oldPassword}
isSuccessOnDefault={true}
showRemark={true}
/>
<Input
sx={styles.input}
Expand All @@ -86,6 +88,7 @@ const ChangePasswordForm = () => {
name="confirmationPassword"
disabled={!!errors.oldPassword || !!errors.newPassword}
isSuccessOnDefault={true}
showRemark={true}
/>
<Box sx={styles.confirmButton}>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export const validationSchema = yup.object().shape({
newPassword: yup
.string()
.required(`Обов'язкове поле`)
.min(8, 'Не коротше 8 символів')
.max(32, 'Не довше 32 символів')
.matches(
/^(?=.*[A-Za-z])(?=.*\d)[\w\W]+$/,
'Мінімум одна латинська літера та одна цифра',
/^(?=.*[A-Z])(?=.*\d)(?=.*[\W_])[\w\W]+$/,
'Мінімум одна велика латинська літера, одна цифра та один спеціальний символ',
),
confirmationPassword: yup
.string()
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/main-page/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const MainPage: FC<MainPageProps> = ({ data }) => {
Зустрічай твій студентський портал, який надає багато корисних інструментів для студентів.
Тут ти знайдеш опитування про викладачів, багатофункціональний розклад, можливість керувати групою,
набори в активне ком’юніті та багато інших цікавих інструментів."
className={styles['admin-default']}
className={styles['main-page']}
>
<Box sx={stylesMUI.mainPageContent}>
{token && isReady && <TokenPopup token={token} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ const GreetingBlock = () => {
const imgScr = '/images/admin-default/avatars/';

const avatars = [
'/images/admin-default/avatars/stas.png',
'/images/admin-default/avatars/svyat.png',
'/images/admin-default/avatars/oleg.png',
'/images/admin-default/avatars/danya.png',
'/images/admin-default/avatars/katya.png',
'/images/admin-default/avatars/pasha.png',
'/images/admin-default/avatars/dima.png',
'/images/admin-default/avatars/illia.png',
'/images/admin-default/avatars/vovka.png',
'/images/admin-default/avatars/artem.png',
'/images/admin-default/avatars/sasha.png',
'/images/main-page/avatars/stas.png',
'/images/main-page/avatars/svyat.png',
'/images/main-page/avatars/oleg.png',
'/images/main-page/avatars/danya.png',
'/images/main-page/avatars/katya.png',
'/images/main-page/avatars/pasha.png',
'/images/main-page/avatars/dima.png',
'/images/main-page/avatars/illia.png',
'/images/main-page/avatars/vovka.png',
'/images/main-page/avatars/artem.png',
'/images/main-page/avatars/sasha.png',
];
const names = [
'Стасік',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ const AnswersSheet: React.FC<AnswersSheetProps> = ({
}
};

const handleSubmit = (value: Record<string, string>) => {
updateAnswer(value);
if (!isTheLast) {
setCurrentCategory(currentCategory + 1);
window.scrollTo({ top: 0, behavior: 'smooth' });
return;
}
setIsSendingStatus(SendingStatus.LOADING);
sendData();
};

const updateAnswer = (values: FormikValues) => {
const resultAnswers = setCollectAnswers(answers, values);
setAnswers(resultAnswers);
Expand All @@ -128,6 +117,17 @@ const AnswersSheet: React.FC<AnswersSheetProps> = ({
});
};

const handleSubmit = (value: Record<string, string>) => {
updateAnswer(value);
if (!isTheLast) {
setCurrentCategory(currentCategory + 1);
window.scrollTo({ top: 0, behavior: 'smooth' });
return;
}
setIsSendingStatus(SendingStatus.LOADING);
sendData();
};

const sendData = async () => {
try {
const formattedAnswers = answers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ export const validationSchema = yup.object().shape({
password: yup
.string()
.required(`Обов'язкове поле`)
.min(8, 'Не коротше 8 символів')
.max(32, 'Не довше 32 символів')
.matches(
/^(?=.*[A-Za-z])(?=.*\d)[\w\W]+$/,
'Мінімум одна латинська літера та одна цифра',
/^(?=.*[A-Z])(?=.*\d)(?=.*[\W_])[\w\W]+$/,
'Мінімум одна велика латинська літера, одна цифра та один спеціальний символ',
),
passwordConfirmation: yup
.string()
Expand Down
25 changes: 15 additions & 10 deletions src/components/pages/schedule-page/SchedulePage.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
import { FC } from 'react';
import { FC, useEffect } from 'react';
import { Box } from '@mui/material';
import { useMediaQuery } from '@mui/material';

import PageLayout from '@/components/common/layout/page-layout/PageLayout';
import ScheduleEventEdit from '@/components/pages/schedule-page/schedule-event-edit-section/ScheduleEventEdit';
import { useToastError } from '@/hooks/use-toast-error/useToastError';
import { GetCurrentSemester } from '@/lib/api/dates/types/GetCurrentSemester';
import ScheduleAPI from '@/lib/api/schedule/ScheduleAPI';
import { PostEventBody } from '@/lib/api/schedule/types/PostEventBody';
import { SharedEventBody } from '@/lib/api/schedule/types/shared';
import { useSchedule } from '@/store/schedule/useSchedule';
import theme from '@/styles/theme';
import { Group } from '@/types/group';

import { CalendarSection } from './calendar-section/CalendarSection';
import { ButtonIcons } from './calendar-section/components/mobile/buttonIcons/ButtonIcons';
import { CalendarSectionMobile } from './calendar-section/components/mobile/CalendarSectionMobile';
import { ScheduleSection } from './schedule-section/ScheduleSection';
import ScheduleSectionMobile from './schedule-section/ScheduleSectionMobile';
import * as styles from './SchedulePage.styles';
const MAX_WEEK_NUMBER = 20;
import { useToastError } from '@/hooks/use-toast-error/useToastError';
import ScheduleAPI from '@/lib/api/schedule/ScheduleAPI';
import { PostEventBody } from '@/lib/api/schedule/types/PostEventBody';
import { SharedEventBody } from '@/lib/api/schedule/types/shared';

import { initialValues } from './schedule-event-edit-section/schedule-form/constants';
import { ScheduleEventForm } from './schedule-event-edit-section/schedule-form/ScheduleEventForm';
import { formValidationSchema } from './schedule-event-edit-section/schedule-form/validation';
import { ScheduleSection } from './schedule-section/ScheduleSection';
import ScheduleSectionMobile from './schedule-section/ScheduleSectionMobile';
import { makeNegativeValuesUndefined } from './utils/undefineNegativeValues';
import * as styles from './SchedulePage.styles';
export interface SchedulePageProps {
groups: Group[];
semester: GetCurrentSemester | null;
Expand Down Expand Up @@ -54,7 +52,14 @@ const SchedulePage: FC<SchedulePageProps> = ({ semester, groups }) => {
state.isNewEventAdded,
]);

const getEvents = async () => {
await handleWeekChange();
};

useInitialise(semester, groups);
useEffect(() => {
getEvents();
}, []);
const { displayError } = useToastError();
const closeForm = () => {
useSchedule.setState({ isNewEventAdded: false });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { FormEvent, Fragment, useRef } from 'react';
import { Fragment } from 'react';
import { Stack } from '@mui/system';
import { Form, Formik, FormikProps } from 'formik';

import Checkbox from '@/components/common/ui/form/checkbox';
import { CheckboxColor } from '@/components/common/ui/form/checkbox/types';
import Checkbox from '@/components/common/ui/form/with-formik/checkbox';
import useAuthentication from '@/hooks/use-authentication';
import { Checkboxes, useSchedule } from '@/store/schedule/useSchedule';
import { useSchedule } from '@/store/schedule/useSchedule';

import * as styles from './CheckBoxSection.styles';

Expand All @@ -18,51 +17,61 @@ export const CheckBoxSection = () => {

const { user } = useAuthentication();

const handleValuesChange = (event: FormEvent<HTMLFormElement>) => {
const values = form?.current?.values as Checkboxes;
updateCheckboxes(values);
const handleValuesChange = (value: Record<string, boolean>) => {
updateCheckboxes({ ...checkboxes, ...value });
};

const form = useRef<FormikProps<Checkboxes>>(null);

return (
<Formik initialValues={checkboxes} onSubmit={() => {}} innerRef={form}>
<Form
onChange={event => setTimeout(() => handleValuesChange(event), 0)}
style={{ alignSelf: 'flex-start' }}
>
<Stack sx={styles.checkboxes}>
{user && user.group?.id === groupId && (
<Fragment>
<Checkbox
label={'Інша подія'}
name={'otherEvents'}
color={CheckboxColor.EVENT}
/>
<Checkbox
label={'Мої вибіркові'}
color={CheckboxColor.PRIMARY}
name={'isSelective'}
/>
</Fragment>
)}
<Checkbox
label={'Лекція'}
name={'addLecture'}
color={CheckboxColor.LECTURE}
/>
<Stack sx={styles.checkboxes}>
{user && user.group?.id === groupId && (
<Fragment>
<Checkbox
label={'Практика'}
name={'addPractice'}
color={CheckboxColor.PRACTICE}
label={'Інша подія'}
name={'otherEvents'}
color={CheckboxColor.EVENT}
checked={checkboxes.otherEvents}
onChange={(event, checked) =>
handleValuesChange({ otherEvents: checked })
}
/>
<Checkbox
label={'Лабораторна'}
name={'addLaboratory'}
color={CheckboxColor.LAB}
label={'Мої вибіркові'}
color={CheckboxColor.PRIMARY}
name={'isSelective'}
checked={checkboxes.isSelective}
onChange={(event, checked) =>
handleValuesChange({ isSelective: checked })
}
/>
</Stack>
</Form>
</Formik>
</Fragment>
)}
<Checkbox
label={'Лекція'}
name={'addLecture'}
color={CheckboxColor.LECTURE}
checked={checkboxes.addLecture}
onChange={(event, checked) =>
handleValuesChange({ addLecture: checked })
}
/>
<Checkbox
label={'Практика'}
name={'addPractice'}
color={CheckboxColor.PRACTICE}
checked={checkboxes.addPractice}
onChange={(event, checked) =>
handleValuesChange({ addPractice: checked })
}
/>
<Checkbox
label={'Лабораторна'}
name={'addLaboratory'}
color={CheckboxColor.LAB}
checked={checkboxes.addLaboratory}
onChange={(event, checked) =>
handleValuesChange({ addLaboratory: checked })
}
/>
</Stack>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { Theme } from '@mui/system';
export const buttonIcons: SxProps<Theme> = {
position: 'fixed',
right: '10%',
top: '70vh',
bottom: '32px',
display: 'flex',
flexDirection: 'column',
height: 'fit-content',
height: '93px',
justifyContent: 'space-between',
gap: '10px',
zIndex: 11,
};
Loading

0 comments on commit 4ca1cfe

Please sign in to comment.