-
Notifications
You must be signed in to change notification settings - Fork 26
Feat/region page #100
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
base: main
Are you sure you want to change the base?
Feat/region page #100
Conversation
| setCurrentPage(1); | ||
| }, [selectedExperience, selectedRegion, searchQuery]) | ||
|
|
||
| // Если приспичит сделать кнопки для переключения страниц |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не очень понятно, как тогда работает без переключения страниц 🤔
|
|
||
| let result = formatted; | ||
|
|
||
| for (const [regExp, sign] of rules) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если с reduce не будет сильно запутано - то reduce предпочтительнее
| for (const [regExp, sign] of rules) { | ||
| result = result.replace(regExp, sign); | ||
| } | ||
| // Регулярка убирает лишние пробелы |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно сделать функцию и ее название будет сообщать действие - тогда комментарий не потребуется. Комментарии быстро устаревают
| @@ -0,0 +1 @@ | |||
| export const truncateText = (text: string, maxLength: number): string => text.length > maxLength ? `${text.substring(0, maxLength)}...` : text; No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мелкие функции удобнее собирать в одном утилитном файле. Если уже есть предполагаемые разделы, можно поделить: data.ts, text.ts, dateTime.ts. Если структура еще не понятна - в один файл утилит.
Скорее всего, в файле не будет JSX - расширение ts подойдет
| return useMemo(() => { | ||
| const monthCounts: Record<string, number> = {}; | ||
|
|
||
| monthOrder.forEach((month) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Заполнение стоит вынести в отдельную функцию. reduce удобнее. Полезно уменьшать число мутаций в коде
| > | ||
| <Group> | ||
| <ChartColumn color="#20B0B4"/> | ||
| <Title order={2} c="#0c2e4d"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Было бы полезно завести файл с константами для цветов. Да, не сразу будет все понятно с названиями, но его будет проще править, чем искать цвета в компонентах
| import type { VacancyWithExperience } from "../../model/types"; | ||
|
|
||
| const experienceRange: Record<string, [number, number]> = { | ||
| '0-1': [0, 1], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Где-то уже встречались подобные ключи - лучше реализовать их как константы. Поможет избежать ошибок в дальнейшем
| }) | ||
| }, [vacancies, selectedExperience, selectedRegion, searchQuery]); | ||
|
|
||
| function setFilters(params: { experience?: string; region?: string; searchQuery?: string; }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
если не требуется this - используем стрелочные функции. Актуально для всего проекта
| @@ -0,0 +1,78 @@ | |||
| import React from "react"; | |||
| // import { ChevronDown } from "lucide-react"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужен?
|
Поправьте конфликты |






Это просто пр для посмотреть, пока бэкэнда нет, чтобы потом не терять время.