Skip to content

Conversation

@ShaganKonstantin
Copy link
Contributor

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

  • Пока нет бэкэнда использовал моковые вакансии, потом переделаю;
  • Для диаграммы использовал Rechart, потому что она самая попсовая;
  • Иконки для названия региона и динамики потом подберу.

@ShaganKonstantin
Copy link
Contributor Author

Десктоп Мобилка 1 Мобилка 2

@ShaganKonstantin
Copy link
Contributor Author

  • Привел к формату FSD;
  • Вставил иконки из библиотеки lucide. Иконка для динамики нашлась такая же, как в ТЗ, для региона подобрал другую из этой же библиотеки;
  • Поменял SVG для выпадающего меню на библиотечные;
  • Вставил компонент RegionPage в HomePage для наглядности;
  • Вакансии для тестирования так же пока оставил;
  • Теперь фильтры и график - переиспользуемые изолированные компоненты;
  • Количество отображаемых карточек с динамикой пока прописано хард кодом;
Десктоп refactored

@ShaganKonstantin
Copy link
Contributor Author

Мобилка refactored 1 Мобилка refactored 2

setCurrentPage(1);
}, [selectedExperience, selectedRegion, searchQuery])

// Если приспичит сделать кнопки для переключения страниц
Copy link

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) {
Copy link

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);
}
// Регулярка убирает лишние пробелы
Copy link

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
Copy link

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) => {
Copy link

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">
Copy link

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],
Copy link

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; }) {
Copy link

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";
Copy link

Choose a reason for hiding this comment

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

Нужен?

@arthur810629
Copy link
Collaborator

Поправьте конфликты

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.

3 participants