-
Notifications
You must be signed in to change notification settings - Fork 0
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
Month 12/step 1 #1
Conversation
src/utils/utils.tsx
Outdated
import { DELAY_IN_MS, SHORT_DELAY_IN_MS } from "../constants/delays" | ||
|
||
export const waitForMe = (delay: number = DELAY_IN_MS): Promise<null> => { | ||
return new Promise(resolve => { |
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.
Можно лучше: название я оценил :D, но все же лушче дать более конкретное и понятное имя вроде delay
|
||
export const swapNums = ( | ||
arr: columnObject[], | ||
firstIndex: number, |
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.
Можно лучше: функции swapNums
и swapChars
практически идентичны. Стоит обьеденить их в 1
/> | ||
<Button | ||
disabled={inputValue ? inputValue > 19 : true} | ||
isLoader={inProgress} |
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.
Можно лучше: магические число 19 лучше вынести в отдельную константу
const arr: columnObject[] = []; | ||
const size = Math.random() * (17 - 3) + 3; | ||
while (arr.length < size) { | ||
arr.push({ |
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.
Можно этот кусок кода записать проще:
const rSize = Math.random() * (17 - 3) + 3;
Array.from({length: rSize}, () => ({num: utils.getHeight(), state: ElementStates.Default}))
}; | ||
|
||
const bubbleSort = async (mode: "ascending" | "descending") => { | ||
// Лочим кнопки |
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.tsx
в папке этого компонента
|
||
const push = async () => { | ||
setInputValue(""); | ||
setPushing(true); |
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.
Надо исправить: В этом случае можно создать класс Stack где реализовать эти методы и сюда уже их импротить
/> | ||
<Button | ||
style={{ minWidth: "362px" }} | ||
extraClass={styles.button} |
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.
Можно лучше: не стоит использовать in-line
стили, лучше вынести их в класс
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.
Выглядит очень круто! Видно, что проделана большая работа.
Что важно исправить:
- В файле
readme
не нашел описание проекта - функции, которые реализуют работу алгоритма должны быть вынесены в отдельный
utils.tsx
в папке соответствующего компонента. Вutils.tsx
стоит считать шаги алгоритма (если сам результат уже не описывает шаги, как в случае последовательности фибоначи) и далее рендерить их в react - Стоит создать класс
Queue
для реализации очереди и классLinkedListNode
и лассLinkedList
с методами prepend, append, addByIndex, deleteByIndex, deleteHead, deleteTailи toArray
Можно лучше:
- файл
.editorconfig
стоит добавить в.gitignore
так как он локальный для вас и не используется другими - Для удобства можно установить
"noImplicitAny": true
вts config
Что понравилось:
- Отличное комментирование кода
Обратите внимание, что работа принимается только после исправления всех «Надо исправить»
.
Отличная работа! Желаю успехов в дальнейшем развитии и обучении |
No description provided.