-
Notifications
You must be signed in to change notification settings - Fork 1
Компактное отображение списка преподов Дубинушки #87
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
Conversation
…ная логика с вычислением по одному преподу
…жим не сохраняется.
…`slotProps` и затем обратился к свойствам через него.
|
Что нужно доделать:
|
BatuevIO
left a comment
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.
Хорошо справился! Особенно с приведением типов к нужным
Комменты в основном по читаемости кода, внеси их, пожалуйста.
| <div> | ||
| <strong>{{ item.raw.last_name }}</strong> | ||
| {{ item.raw.first_name }} {{ item.raw.middle_name }} | ||
| </div> |
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.
Зачем тут div?
| > | ||
| {{ subject }} | ||
| </v-chip> | ||
| <v-chip v-if="getFilteredSubjects(item.raw.subjects).length > 2" size="small" readonly :ripple="false"> |
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.
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 }} |
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.
getFilteredSubjects(item.raw.subjects).length - 2
И здесь тоже, типа reaminingSubjects = ...
| {{ ratings[index] }} | ||
| </template> | ||
|
|
||
| <template #[`item.fullName`]="{ item }"> |
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.
Тут и дальше в темплейтах можно удобно деструктурировать.
<template #[`item.fullName`]="{ item: {raw: {last_name, middle_name, first_name}} }">
<div>
<strong>{{ last_name }}</strong>
{{ first_name }} {{ middle_name }}
</div>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.
Сам об этом только что подумал...
| :items="tableItems" | ||
| hide-default-footer | ||
| disable-sort | ||
| class="elevation-1 lecturer-table" |
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.
А elevation зачем
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.
По сути, это не карточка, а вся таблица -- хорошо бы отразить это в названии.
Например, TheLecturerSearchTable.vue
| emit('lecturerClick', item.raw.id); | ||
| } | ||
| function formatMark(mark: number | null | undefined): 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.
Вот это потом можно вынести в компоузабл или стор, потому что используется не только здесь.
getMarkColor тоже
| const lecturersPhotos = ref<string[]>(Array<string>(itemsPerPage)); | ||
| // Вычисляем порядковые номера для компактного режима | ||
| const lecturerRatings = computed(() => { |
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.
Тоже хорошо будет убрать в стор
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.
Это можно сделать не сейчас
…ть функций в utils
|
Вроде все комменты обработал: почистил код, изменил название, деструктурировал, убрал всякое разное в сторы + сделал стор, который хранит состояние списка (чтобы при выходе из карточки препода попадать в предыдущее состояние списка). |
src/pages/MainPage.vue
Outdated
| // utils | ||
| const totalPages: Ref<number> = ref(1); | ||
| const userAdmin = ref(profileStore.isAdmin()); |
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.
А зачем реф? Можно просто функцию использовать
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.
Чтобы не писать через точку, можно метод через деструктуризацию достать
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.
Если нужна реактивность, то через компьютед
Изменения
Добавил компактное отображение списка преподов в виде таблицы с 10 элементами на странице. Сделал кнопку-свитчер между стандартным и компактным отображением.
Детали реализации
Check-List
blackиisortдля Back-End илиPrettierдля Front-End?