Skip to content

Conversation

@Dmatrushka19
Copy link
Contributor

@Dmatrushka19 Dmatrushka19 commented Aug 22, 2025

Изменения

Добавил компактное отображение списка преподов в виде таблицы с 10 элементами на странице. Сделал кнопку-свитчер между стандартным и компактным отображением.

Детали реализации

  1. Создал файл TheLecturerSearchCompactCard.vue, в котором реализована разметка через 'v-data-table', а также функции из карточки и функция для проверки и корректного отображения Null в графе предметов.
  2. Добавил в MainPage.vue обработку случая TheLecturerSearchCompactCard.vue и кнопку переключения между TheLecturerSearchCompactCard.vue и стандартным отображением TheLecturerSearchCard.vue. Разместил эту кнопку слева от пагинации.

Check-List

  • Вы проверили свой код перед отправкой запроса?
  • Вы написали тесты к реализованным функциям?
  • Вы не забыли применить форматирование black и isort для Back-End или Prettier для Front-End?

@Dmatrushka19
Copy link
Contributor Author

Dmatrushka19 commented Aug 22, 2025

Что нужно доделать:

  • Разобраться с дизайн-системой и перетащить кнопку смены режима отображения в нужное место (рядом со строкой поиска).
  • Добавить store, который будет хранить состояние кнопки смены режима, чтобы при выходе из карточки преподавателя попадать в нужный режим отображения
  • добавить отступ таблицы от строки поиска
  • Вместо косячного и костыльного CustomDataTableHeader разобраться и заюзать тип DataTableHeader[] из vuetify
  • Починить баг с отображением очень длинных предметов (как например у Свяховского, №61)
  • Сделать стили как в TheLecturerSearchCard.vue (точно касается предметов, там не тот цвет шрифта)
  • Зафиксировать ширину ячеек в колонке (ширина ячейки с предметами прыгает)

@Dmatrushka19 Dmatrushka19 requested a review from BatuevIO August 22, 2025 20:51
@Dmatrushka19 Dmatrushka19 self-assigned this Aug 22, 2025
@Dmatrushka19 Dmatrushka19 requested a review from Semedanik August 22, 2025 20:52
Copy link
Contributor

@BatuevIO BatuevIO left a comment

Choose a reason for hiding this comment

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

Хорошо справился! Особенно с приведением типов к нужным

Комменты в основном по читаемости кода, внеси их, пожалуйста.

Comment on lines 15 to 18
<div>
<strong>{{ item.raw.last_name }}</strong>
{{ item.raw.first_name }} {{ item.raw.middle_name }}
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Зачем тут div?

>
{{ subject }}
</v-chip>
<v-chip v-if="getFilteredSubjects(item.raw.subjects).length > 2" size="small" readonly :ripple="false">
Copy link
Contributor

Choose a reason for hiding this comment

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

getFilteredSubjects(item.raw.subjects).length > 2

Для читаемости можно вынести в отдельное условие типа isSubjectOverflow(subjects)

{{ subject }}
</v-chip>
<v-chip v-if="getFilteredSubjects(item.raw.subjects).length > 2" size="small" readonly :ripple="false">
еще {{ getFilteredSubjects(item.raw.subjects).length - 2 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

getFilteredSubjects(item.raw.subjects).length - 2

И здесь тоже, типа reaminingSubjects = ...

{{ ratings[index] }}
</template>

<template #[`item.fullName`]="{ item }">
Copy link
Contributor

Choose a reason for hiding this comment

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

Тут и дальше в темплейтах можно удобно деструктурировать.

<template #[`item.fullName`]="{ item: {raw: {last_name, middle_name, first_name}} }">
			<div>
				<strong>{{ last_name }}</strong>
				{{ first_name }} {{ middle_name }}
			</div>

Copy link
Contributor

Choose a reason for hiding this comment

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

Сам об этом только что подумал...

:items="tableItems"
hide-default-footer
disable-sort
class="elevation-1 lecturer-table"
Copy link
Contributor

Choose a reason for hiding this comment

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

А elevation зачем

Copy link
Contributor

Choose a reason for hiding this comment

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

По сути, это не карточка, а вся таблица -- хорошо бы отразить это в названии.

Например, TheLecturerSearchTable.vue

emit('lecturerClick', item.raw.id);
}
function formatMark(mark: number | null | undefined): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

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

getMarkColor тоже

const lecturersPhotos = ref<string[]>(Array<string>(itemsPerPage));
// Вычисляем порядковые номера для компактного режима
const lecturerRatings = computed(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Тоже хорошо будет убрать в стор

Copy link
Contributor

Choose a reason for hiding this comment

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

Это можно сделать не сейчас

@Dmatrushka19
Copy link
Contributor Author

Вроде все комменты обработал: почистил код, изменил название, деструктурировал, убрал всякое разное в сторы + сделал стор, который хранит состояние списка (чтобы при выходе из карточки препода попадать в предыдущее состояние списка).

// utils
const totalPages: Ref<number> = ref(1);
const userAdmin = ref(profileStore.isAdmin());
Copy link
Contributor

Choose a reason for hiding this comment

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

А зачем реф? Можно просто функцию использовать

Copy link
Contributor

Choose a reason for hiding this comment

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

Чтобы не писать через точку, можно метод через деструктуризацию достать

Copy link
Contributor

Choose a reason for hiding this comment

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

Если нужна реактивность, то через компьютед

@BatuevIO BatuevIO merged commit e77a7eb into main Sep 16, 2025
2 checks passed
@BatuevIO BatuevIO deleted the Compact-view-of-lecturer-search-screen branch September 16, 2025 10:21
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