-
Notifications
You must be signed in to change notification settings - Fork 3
Feedback & Code Review od Mentora Recenzenta (Szymon Pakuła) #94
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: feedback/mentor-recenzent
Are you sure you want to change the base?
Conversation
Add a GiHub Actions workflow to the project. Every time someone wants to merge commit into develop it will try to build application, run tests and upload new files on GitHub Pages. Build and test checks must pass to be able to merge.
* more project settings * fixes to settings * add ESLint * additional checks for ts code
Co-authored-by: lamparina <anna.lamperska@gmail.com>
…4 and there is no pieces on Pawn's way"
…to_account_the_King's_check #43_Moves_a_piece_taking_into_account_the_King's_check
Build on windows
…abled (#80) * Add test * Change turn to avoid error * Add pawnPromotionWasEnabled event * Fix tests * Block move until promotion is done * Restore tests for check | Merge changes and resolve conflicts * Update lock file * Fix bug * Add missing test case Co-authored-by: lamparina <anna.lamperska@gmail.com>
* Initiall commit * Initiall commit * Add types * Fix name of pieceMovesNotCausingAllyKingCheck function * Add first test * Add second test * Finishtest * Add CheckmatedKing variable and isCheckmatedKing function * Delete last added function: isCheckmatedKing * After code review | Update tests * Add empty method in ChessEngine. Add code in move() method * Fix last commit * Add new test * Delete doubled test * Fix bug in test * Finish checkmateHasOccurred function, In progress: is PossibleMoves * Finish all without cleaning code. * EsLint CoderReview | Update * Add tests for Stalemate Has Occurred * Add type for Stalemate Has Occurred * Fix | Fix test for Stalemate Has Occurred * Fix | Fix test from others tasks because this tests had bug with stalemate event * Finish stalemate event service * Eslint CodeReview | Update
* Add positive and negative test cases for castling * CastlingWasDone - positive cases | Castling not possible while king's exposed to attack * Disable castling if king or rook has already moved or there is any piece between them * Refactor ChessEngine * Return all possible moves from one method * Rename method * Fix method name * Refactor possibleMoves method Co-authored-by: lamparina <anna.lamperska@gmail.com>
Z podziękowaniem dla @nowakprojects @lamparina @tomdworniczak @Szambelan za ładne CodeReview poprzedniego taska * Update | Change Stalemate and fix a small bug in test * Update | Change type of Stalemate event * Update | Delete imports * Update | Delete kingPosition problem
* Create modal window for pawn promotion * Selected figure to be promoted * Proba skonczenia zadanka * Rename modal's css classes * Promotion modal and it's test * Changes in modal event * #76 modal window for pawn promotion - Model * #76 make promotingOnSquare private again * #76 remove dead code * #76 CR fixes Co-authored-by: Pawel Szambelan <p.szambelan1@gmail.com> Co-authored-by: lamparina <59768305+lamparina@users.noreply.github.com> Co-authored-by: lamparina <anna.lamperska@gmail.com>
* First part * Add bg * next part * next part * next part * next part
* #70 Tests and draft solution * #70 Refactor test case * #70 Apply pawn attack in passing logic * #70 Remove silly test case * #70 Add return type to method * #70 Add test case * #70 delete unneeded if statement * #70 refactor * #70 merge develop * Add en passant to possibleMoves * Last fix Co-authored-by: lamparina <anna.lamperska@gmail.com> Co-authored-by: lamparina <59768305+lamparina@users.noreply.github.com>
Co-authored-by: lamparina <anna.lamperska@gmail.com>
Co-authored-by: lamparina <anna.lamperska@gmail.com>
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>....Our title</title> |
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.
bugs_bunny_our_meme.jpg 🤣
| // case 'PawnWasPromoted': | ||
| // this.view.afterPromotionPiece( | ||
| // this.translateSquareToAlgebraicNotation(event.onSquare), | ||
| // event.chosenPiece.name.toLowerCase(), | ||
| // event.chosenPiece.side, | ||
| // ); | ||
| // break; |
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.
Warto usuwać zakomentowany kod. Najprawdopodobniej i tak osoba, która będzie rozwijała tę funkcjonalność napisze wszystko od nowa zamiast to odkomentowywać.
Dodatkowo jeśli ktoś będzie potrzebował tego, to z łatwością można do tego wrócić dzięki VCS.
| @@ -0,0 +1 @@ | |||
| export interface GameCommentsView {} | |||
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.
Myślę że, tak jak w przypadku zakomentowanego kody, warto usuwać kod, który nie jest nigdzie używany.
| import { Bishop, Chessboard, ChessEngine, King, Knight, Pawn, Queen, Rook, Side, Square, SquareWithPiece } from '../../../src/app/model'; | ||
| import 'jest-extended'; |
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.
sortowanie importowanych zależności w kolejności
- "zewnętrzne" - tak jak 'jest-extended'
- "wewnętrzne" - w tym przypadku Figury
pozwoli poprawić czytelność i będzie pomocne w przypadku znacznie większych projektów
| const queenPromotion = document.createElement('div'); | ||
| queenPromotion.classList.add('modal__pawn'); | ||
| queenPromotion.textContent = 'Queen'; | ||
| modalPawnWrap.appendChild(queenPromotion); | ||
|
|
||
| const rookPromotion = document.createElement('div'); | ||
| rookPromotion.classList.add('modal__pawn'); | ||
| rookPromotion.textContent = 'Rook'; | ||
| modalPawnWrap.appendChild(rookPromotion); | ||
|
|
||
| const knightPromotion = document.createElement('div'); | ||
| knightPromotion.classList.add('modal__pawn'); | ||
| knightPromotion.textContent = 'Knight'; | ||
| modalPawnWrap.appendChild(knightPromotion); | ||
|
|
||
| const bishopPromotion = document.createElement('div'); | ||
| bishopPromotion.classList.add('modal__pawn'); | ||
| bishopPromotion.textContent = 'Bishop'; | ||
| modalPawnWrap.appendChild(bishopPromotion); |
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.
rozważyłbym utworzenie funkcji pomocniczej aby uniknąć duplikowania pewnych części kodu
| const pieceImage = divFrom?.firstChild as HTMLImageElement; | ||
|
|
||
| if (pieceImage) { | ||
| pieceImage.src = `static/img/pieces/${side.toLowerCase()}-${piece.toLowerCase()}.svg`; |
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.
Dobrym pomysłem mogłoby być przechowywanie początka ścieżki (static/img/pieces/) w zmiennej globalnej, na wypadek zmian w strukturze katalogów.
W tym przypadku występuje to także w 83 linijce
| buttonDomElement.classList.remove('button--large'); | ||
| buttonDomElement.classList.add('button--small'); | ||
| } | ||
| if (this.size == Size.LARGE) { | ||
| buttonDomElement.classList.remove('button--small'); | ||
| buttonDomElement.classList.add('button--large'); |
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.
Tutaj także zastosować enuma, tak jak w przypadku Size.
Nefariusek
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.
Organizacja kodu, zastosowanie programowania obiektowego i możliwości jakie daje TypeScript na bardzo wysokim poziomie. Implementacja jest bardzo przejrzysta.
Pochwalić należy także wysokie pokrycie kodu testami.
Podsumowując - super projekt.
|
Dzięki za review! Chciałam tylko dodać, że już wszystko działa :) Promocja, bicie w przelocie i takie tam ;) |
* Update README.md Update README file * Update readme again * Add live version link and sreenshoots of a game Co-authored-by: lamparina <59768305+lamparina@users.noreply.github.com>
No description provided.