Commit cbcf354d authored by Ermolaev Timur's avatar Ermolaev Timur

#132 добавил 24 часа, пофиксил вылезавшие баги

parent 572b2feb
......@@ -40,7 +40,7 @@ import { DateTimeTask } from './DateTimeTask';
id!: string
@Column({ name: 'title', type: 'varchar', length:50,nullable: false })
title!: string
@Column({ name: 'description', type: 'varchar', length:50,nullable: true })
@Column({ name: 'description', type: 'varchar', length:100,nullable: true })
description!: string
@Column({ name: 'note', type: 'varchar', length:100,nullable: true })
note!: string
......
......@@ -89,5 +89,8 @@ const CalendarRowDay = ({ xs, hoursInDay, createTaskInCellHandler, currentTask,
</>
};
export default memo(CalendarRowDay);
export default memo(CalendarRowDay, (prevProps, nextProps) => {
if (!prevProps.modal) return false
if (nextProps.modal) return true
});
......@@ -72,7 +72,7 @@ function CalendarModalTaskContent({ title, onChangeCurrentTaskHandler, descripti
/>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', margin: '10px 0' }}>
<Button id='test_button_save_task' onClick={sendNewTaskHandler} disabled={!isValidate(title, project, startHour, endHour)}>Сохранить</Button>
<Button id='test_button_save_task' onClick={sendNewTaskHandler} disabled={!isValidate(title, project, startHour, endHour, description)}>Сохранить</Button>
<Button onClick={deleteTaskHandler} disabled={!id}>Удалить</Button>
</div>
</>);
......
export const isValidate = (title, project, startHour, endHour) => {
if (title && project) {
export const isValidate = (title, project, startHour, endHour, description) => {
if ((title && project) && (title?.length <= 50 && ( description?.length <= 100 || !description) )) {
const startHourInt = parseInt(startHour)
const endHourInt = parseInt(endHour)
if (startHourInt >= 8 && startHourInt <= 24) {
if (endHourInt >= 8 && endHourInt <= 24) {
if (startHourInt >= 0 && startHourInt <= 24) {
if (endHourInt >= 0 && endHourInt <= 24) {
if (startHourInt < endHourInt) {
return true
}
......
......@@ -11,7 +11,7 @@ import { getTasksWithInfoForPosition, getWidthLeftZIndex } from "./Helpers";
function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat, handleOpen, setCurrentTask, copyTask, setCopyTask, createCopyTask, createTaskInCellHandler, modal, dragTaskHandler }) {
const [columnDaySize, setColumnDaySize] = useState({ width: 0, height: 0 })
console.log(month, year)
const dayColumnRef = useRef('')
useEffect(() => {
setColumnDaySize(prev => { return { height: dayColumnRef.current.offsetHeight, width: dayColumnRef.current.offsetWidth } })
......
......@@ -19,4 +19,8 @@ export const priorities = [
{ value: 'A', text: 'A' },
{ value: 'B', text: 'B' },
{ value: 'C', text: 'C' }
]
\ No newline at end of file
]
export const AllHoursOneHourFormat = ['0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']
export const AllHoursTwoHourFormat = ['0:00', '2:00', '4:00', '6:00', '8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00']
\ No newline at end of file
......@@ -8,6 +8,7 @@ import { dateToISOLikeButLocal, getCurrentMonthString, getDaysInMonth } from '..
import { fetchAllUserProjects, fetchProject } from '../../store/actions/projectsActions';
import { addCalendarTask, addCopyCalendarTask, deleteCalendarTask, editCalendarTask, fetchCalendarTasks } from '../../store/actions/tasksActions';
import { fetchCurrentCalendarDisplayName } from '../../store/actions/usersActions';
import { AllHoursOneHourFormat, AllHoursTwoHourFormat } from '../../constants';
function MonthCalendar() {
const dispatch = useDispatch();
......@@ -56,9 +57,9 @@ function MonthCalendar() {
const hoursInDay = useMemo(() => {
let arr
if (hourFormat) {
arr = ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00']
arr = AllHoursOneHourFormat
} else {
arr = ['8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00']
arr = AllHoursTwoHourFormat
}
const cells = arr.length
const xs = 10.8 / cells
......
......@@ -5,12 +5,12 @@ import CalendarModalWorkerContent from '../../components/Calendars/UI/CalendarMo
import WeekCalendarBody from '../../components/Calendars/WeekCalendar/WeekCalendarBody/WeekCalendarBody';
import WeekCalendarHeader from '../../components/Calendars/WeekCalendar/WeekCalendarHeader/WeekCalendarHeader';
import DefaultModal from '../../components/UI/DefaultModal/DefaultModal';
import { AllHoursOneHourFormat, AllHoursTwoHourFormat } from '../../constants';
import { getWeekInfoString, getWeekFromCurrentDate, dateToISOLikeButLocal } from '../../helpers/CalendarHelpers';
import { fetchAllUserProjects } from '../../store/actions/projectsActions';
import { addCalendarTask, addCopyCalendarTask, deleteCalendarTask, editCalendarTask, fetchCalendarTasks } from '../../store/actions/tasksActions';
import { fetchCurrentCalendarDisplayName } from '../../store/actions/usersActions';
function WeekCalendar() {
const dispatch = useDispatch();
const { calendarTasks } = useSelector(state => state.tasks);
......@@ -54,9 +54,9 @@ function WeekCalendar() {
const hoursInDay = useMemo(() => {
let arr
if (hourFormat) {
arr = ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00']
arr = AllHoursOneHourFormat
} else {
arr = ['8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00']
arr = AllHoursTwoHourFormat
}
return arr
}, [hourFormat])
......@@ -160,7 +160,7 @@ function WeekCalendar() {
endHour: hourDue,
startDay: dayNumber,
month: month,
year: year,
startYear: year,
},
project: allUserProjects[0]?.id
}
......
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