Commit ef153cfe authored by Ermolaev Timur's avatar Ermolaev Timur

#100 небольшие изменения

parent 98c5286f
import {Button} from "@mui/material";
import {NavLink} from "react-router-dom";
import { Button } from "@mui/material";
import { NavLink } from "react-router-dom";
import { superuserMenuButtons } from "../../../constants";
import ProfileBlock from "../ProfileBlock/ProfileBlock";
const AdminMenu = () => {
return <>
{superuserMenuButtons.map((button, i)=>{
return(
{superuserMenuButtons.map((button, i) => {
return (
<Button
key={i}
component={NavLink}
......@@ -19,7 +19,7 @@ const AdminMenu = () => {
</Button>
)
})}
<ProfileBlock/>
<ProfileBlock />
</>
};
......
import {Button} from "@mui/material";
import {NavLink} from "react-router-dom";
import { Button } from "@mui/material";
import { NavLink } from "react-router-dom";
import { anonymoysMenuButtons } from "../../../constants";
const AnonymousMenu = () => {
return <>
{anonymoysMenuButtons.map((button, i)=>{
return(
{anonymoysMenuButtons.map((button, i) => {
return (
<Button
key={i}
component={NavLink}
......
import {Button} from "@mui/material";
import {NavLink} from "react-router-dom";
import { Button } from "@mui/material";
import { NavLink } from "react-router-dom";
import { workerMenuButtons } from "../../../constants";
import ProfileBlock from "../ProfileBlock/ProfileBlock";
const WorkerMenu = () => {
return <>
{workerMenuButtons.map((button, i)=>{
return(
{workerMenuButtons.map((button, i) => {
return (
<Button
key={i}
component={NavLink}
......@@ -19,8 +19,8 @@ const WorkerMenu = () => {
</Button>
)
})}
<ProfileBlock/>
<ProfileBlock />
</>
};
......
import { Button, TextField } from "@mui/material";
import { memo } from "react";
import { priorities } from "../../../constants";
import CustomSelect from '../../UI/СustomSelect/СustomSelect'
const priorities = [{ value: null, text: '--Приоритет--' }, { value: 'A', text: 'A' }, { value: 'B', text: 'B' }, { value: 'C', text: 'C' }]
function MonthCalendarModalContent({ title, onChangeCurrentTaskHandler, description, priority, sendNewTaskHandler, deleteTaskHandler, startHour, endHour }) {
return (<>
......
import {AppBar, Box, Toolbar, Typography} from "@mui/material";
import {NavLink} from "react-router-dom";
import {useSelector} from "react-redux";
import { AppBar, Box, Toolbar, Typography } from "@mui/material";
import { NavLink } from "react-router-dom";
import { useSelector } from "react-redux";
import HasAccess from "../HasAccess/HasAccess";
import AnonymousMenu from "../../Menus/AnonymousMenu/AnonymousMenu";
import WorkerMenu from "../../Menus/WorkerMenu/WorkerMenu";
......@@ -10,24 +10,24 @@ const AppToolbar = () => {
const user = useSelector(state => state.users.user);
return <Box sx={{ flexGrow: 1, mb: "40px" }}>
<AppBar position="static">
<AppBar position="static">
<Toolbar>
<Typography
variant="h4"
component="div"
<Typography
variant="h4"
component="div"
sx={{ flexGrow: 1 }}>
<NavLink to='/' style={{textDecoration: 'none', color: 'inherit'}}>Task Manager</NavLink>
</Typography>
<NavLink to='/' style={{ textDecoration: 'none', color: 'inherit' }}>Task Manager</NavLink>
</Typography>
<HasAccess allowed={!user}>
<AnonymousMenu/>
<AnonymousMenu />
</HasAccess>
<HasAccess roles={['user']}>
<WorkerMenu/>
<WorkerMenu />
</HasAccess>
<HasAccess roles={['superuser']}>
<AdminMenu/>
<AdminMenu />
</HasAccess>
</Toolbar>
</AppBar>
......
import { FormControl, InputLabel, MenuItem, Select} from '@mui/material';
import { FormControl, InputLabel, MenuItem, Select } from '@mui/material';
import { memo } from 'react';
function СustomSelect({value, onChange, label, variant='standard', items, id, defaultValue, name}) {
return (
<>
<FormControl variant={variant} sx={{ m: 0, minWidth: 120 }}>
function СustomSelect({ value, onChange, label, variant = 'standard', items, id, defaultValue, name }) {
return (
<>
<FormControl variant={variant} sx={{ m: 0, minWidth: 120 }}>
<InputLabel id={`${id}-select-label`}>{label}</InputLabel>
<Select
labelId={`${id}-select-label`}
......@@ -16,7 +16,7 @@ function СustomSelect({value, onChange, label, variant='standard', items, id,
name={name}
defaultValue={defaultValue}
>
{items.map((item, i)=>{
{items.map((item, i) => {
return (
<MenuItem
key={i}
......@@ -26,11 +26,11 @@ function СustomSelect({value, onChange, label, variant='standard', items, id,
})}
</Select>
</FormControl>
</> );
</>);
}
export default memo(СustomSelect, (prevProps, nextProps)=>{
if(prevProps.value !== nextProps.value) {
export default memo(СustomSelect, (prevProps, nextProps) => {
if (prevProps.value !== nextProps.value) {
return false
} else {
return true
......
import { useMemo } from "react";
import { getHoursInDayNumbers, getAvailableTasks, getLinesInDay, getSortedTasks } from "../../../../helpers/CalendarHelpers";
import { getHoursInDayNumbers, getAvailableTasks, getLinesInDay, getSortedTasks } from "../../../../helpers/CalendarHelpers";
import CalendarStandartCell from "../../../MonthCalendar/MonthCalendarBody/CalendarStandartCell.js/CalendarStandartCell";
function CalendarRowDayWeek({hoursInDay, tasks, month, year, day, hourFormat}) {
const hours = useMemo(()=>{
function CalendarRowDayWeek({ hoursInDay, tasks, month, year, day, hourFormat }) {
const hours = useMemo(() => {
return getHoursInDayNumbers(hoursInDay)
}, [hoursInDay])
......@@ -18,7 +18,7 @@ function CalendarRowDayWeek({hoursInDay, tasks, month, year, day, hourFormat}) {
const linesInDay = useMemo(() => {
return getLinesInDay(availableTasks, sortedTasks, hoursInDay, hours, hourFormat)
}, [availableTasks, hourFormat, hours, hoursInDay, sortedTasks])
console.log(linesInDay)
return (<>
{hoursInDay?.map((hour, i) => {
return (
......
......@@ -3,21 +3,28 @@ export const uploadsUrl = `${apiUrl}/uploads`;
export const workerMenuButtons = [
{text: 'Проекты', path: '/projects'},
{text: 'Неделя', path: '/week'},
{text: 'Месяц', path: '/month'},
{text: 'Мои задачи', path: '/my-tasks'}
{ text: 'Проекты', path: '/projects' },
{ text: 'Неделя', path: '/week' },
{ text: 'Месяц', path: '/month' },
{ text: 'Мои задачи', path: '/my-tasks' }
]
export const superuserMenuButtons = [
{text: 'Проекты', path: '/projects'},
{text: 'Неделя', path: '/week'},
{text: 'Месяц', path: '/month'},
{text: 'Мои задачи', path: '/my-tasks'},
{text: 'Задачи Сотрудников', path: '/workers-tasks'},
{text: 'Создать Сотрудника', path: '/sign-up'}
{ text: 'Проекты', path: '/projects' },
{ text: 'Неделя', path: '/week' },
{ text: 'Месяц', path: '/month' },
{ text: 'Мои задачи', path: '/my-tasks' },
{ text: 'Задачи Сотрудников', path: '/workers-tasks' },
{ text: 'Создать Сотрудника', path: '/sign-up' }
]
export const anonymoysMenuButtons = [
{text: 'Вход', path: '/sign-in'},
{ text: 'Вход', path: '/sign-in' },
]
export const priorities = [
{ value: null, text: '--Приоритет--' },
{ value: 'A', text: 'A' },
{ value: 'B', text: 'B' },
{ value: 'C', text: 'C' }
]
\ No newline at end of file
import {getDaysInMonth, getCurrentMonthString, dateToISOLikeButLocal} from '../helpers/CalendarHelpers';
import {getAvailableTasks, getSortedTasks} from '../components/MonthCalendar/MonthCalendarBody/CalendarRowDay/Helpers'
import {getDaysInMonth, getCurrentMonthString, dateToISOLikeButLocal, getAvailableTasks, getSortedTasks} from '../helpers/CalendarHelpers';
describe('Получение дней в феврале 2022', () => {
test('Всего дней', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment