Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix news query #579

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Bugfix news query #579

wants to merge 2 commits into from

Conversation

MADeit0
Copy link
Collaborator

@MADeit0 MADeit0 commented Sep 8, 2024

Описание

Pull Request исправляет фильтрацию поиска по месяцу и году, теперь они зависимы друг от друга. Это значит, что если не выбран год или месяц в селектах будут отображаться все доступные варианты, но если выбрать конкретный год или месяц, то у второго селекта будут доступны только те варианты которые есть в рамка выбранного первым селектом.

Ссылка на задачу

Некорректно работающий фильтр по месяцам #560

списки год и месяц, теперь зависят друг от друга, это убирает проблему когда без выбора года нельзя было выбрать месяц
})),
], [year]);
const yearOptions = useMemo(() => {
let yearsArray: {text: string; value: string }[] = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

можно вынести в утилитки маппинги

const getFilteredYearOptions = (filters, month, year) => {

const getFilteredMonthOptions = (filters, year) => {

Copy link
Collaborator Author

@MADeit0 MADeit0 Sep 20, 2024

Choose a reason for hiding this comment

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

касательно этого, можешь подсказать вынести прямо в отдельную директорию или выше за компонент?

Copy link
Member

Choose a reason for hiding this comment

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

@AlMkin @rkostyuchenko, парни, подскажите как лучше поступить в этой ситуации

Copy link
Collaborator

Choose a reason for hiding this comment

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

Тут дело вкуса. На мой взгляд, достаточно вынести за компонент.

Вообще, фильтр по месяцу без выбора года выглядит довольно бессмысленно: вряд ли кому-то понадобится найти новости за март каждого года. Возможно, лучше запретить пользователю выбирать месяц, пока не выбран год.

Copy link
Member

Choose a reason for hiding this comment

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

Согласен, давайте блокировать выбор по месяцу без установленного года @MADeit0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Погодите, но изначально же так и было, если год не выбран месяц не получится поставить, и соответственно после удаления года стирался и месяц.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Выпадающий список с месяцами лучше явно задизейблить, пока не выбран год

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