Skip to content

Conversation

@marina-bul
Copy link
Contributor

No description provided.

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

Name Status Preview
xi.web ✔️Success✔️ Visit Preview

@marina-bul
Copy link
Contributor Author

xi-effect/xi.progress#19

import type { FC, PropsWithChildren } from 'react';
import type { FormData } from '../../model';

interface AddingFormProps extends PropsWithChildren {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут можно сделать type
и если используется PropsWithChildren то ему в дженерик можно передать тип для расширения PropsWithChildren

@unknownproperty
Copy link
Contributor

Поправь, пожалуйста, вёрстку, кроме красных стрелок, ещё хотелось бы прижать кнопки действий в низу модалки

Снимок экрана 2025-11-21 в 16 31 05

Copy link
Contributor

@unknownproperty unknownproperty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Марина, посмотри, пожалуйста, типизацию на предмет использования type и interface, у тебя где-то используется одно, где-то другое. Мы всё же пишем типы почти везде через type и хотелось бы соблюдать общей code style

export const AssignLessonButton = ({ className }: { className?: string }) => {
type AssignLessonButtonProps = {
className?: string;
onButtonClick?: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как будто слишком обобщённое название, хотелось видеть что-то конретное, либо просто базу handleClick

<Button
size="s"
className="text-s-base text-brand-0 hidden rounded-lg px-4 sm:flex"
onClick={onButtonClick}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Функция может быть undefined, исходя из типизации, быть может стоит сделать проверку на её наличие. Не уверен, будут ли тут ошибки, если не передать, но лучше всё же подумать, как это поправить

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше вместо utils.ts написать в названии файла то, что в нём содержится и что мы из него экспортируем getFullDateString.ts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Возможно ли как-то иначе поправить проблему, например патчем самого компонента в xi.kit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

если проблема в том, что не выбирается дата в календаре, то это из-за того что модальное окно при появлении навешивает pointer-events: none на body
соответственно, когда открывается календарь нужно снимать pointer-events
тут как вариант можно завернуть daypicker в поповер или исправить сам daypicker что бы он себя вел как modal (навешивал/снимал pointer-events)

<Close className="fill-gray-80 sm:fill-gray-0 dark:fill-gray-100" />
</ModalCloseButton>
<ModalContentWrapper currentDay={eventDate}>
<AddingForm onClose={handleCloseModal} onDateChange={setEventDate}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не совсем понимаю, зачем делать AddingForm как wrapper?

Если дело в submit, то можно использовать id для формы

import { DatePicker } from '@xipkg/datepicker';
import { Calendar } from '@xipkg/icons';
import { Input } from '@xipkg/input';
import { getFullDateString } from '../../utils/utils';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не очень красивый импорт и экспорт в utils, я бы добавил index

Comment on lines +24 to +28
useEffect(() => {
if (value) {
setDate(value);
}
}, [value]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже, что и коммент ранее, странно выглядит, для управления каким-то общим состоянием в разных компонентах лучше использовать небольшой Zustand store

<DatePicker
calendarProps={{ mode: 'single', selected: date, onSelect: handleSelectDate, required: true }}
>
<Input
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На самом деле можно вместо input тут использовать Button, так по факту само поле ввода нам не нужно, только надо выводить информацию и открывать сам DatePicker

import { DayCalendar } from './DayCalendar';
import type { FC, PropsWithChildren } from 'react';

interface ModalContentWrapperProps extends PropsWithChildren {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Давай перепишем на type

Comment on lines +48 to +56
const handleClearForm = () => {
setValue('title', DEFAULT_VALUES.title);
setValue('description', DEFAULT_VALUES.description);
setValue('studentId', DEFAULT_VALUES.studentId);
setValue('startTime', DEFAULT_VALUES.startTime);
setValue('endTime', DEFAULT_VALUES.endTime);
setValue('startDate', DEFAULT_VALUES.startDate);
setValue('shouldRepeat', DEFAULT_VALUES.shouldRepeat);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мне не очень нравится повторение и вызов функции 7 раз подряд. А ты не смотрела на метод reset в react-hook-form?

@unknownproperty unknownproperty changed the base branch from main to calendar January 1, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants