-
-
Notifications
You must be signed in to change notification settings - Fork 310
feat: add tournament screen #1583
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
daa3a61 to
705f28a
Compare
705f28a to
966166c
Compare
|
The tournament screen is great! Love it. |
|
Nice work on the UI! Will review asap. |
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.
Great work!
This reverts commit a8e71c0.
is disabled - Fix best move arrow shown on analysis screen when engine is disabled - Standardize analysis screen and broadcast game screen code
|
Thanks for the review! I added two widgets tests now, let me know if you think there's anything else that should be tested |
Done 👍
Ah, I checked with Firefox devtools, the website sends a |
| ]); | ||
| // wait for socket message | ||
| await tester.pump(const Duration(milliseconds: 10)); | ||
| expect(find.byType(PieceWidget), findsNWidgets(32)); |
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.
@veloce FYI: After adding the featured game in the tests as well, this expectation failed as it seems to still find the PieceWidgets from the FeatureGame board. So I replaced it with a check to find the name of our opponent instead to verify that the game screen is shown.
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.
@tom-anders you could refine by using find.descendant to check the pieces are descendant of GameScreen.
| featuredGame: pick('featured').asFeaturedGameOrNull(), | ||
| // Sometimes a new FEN comes in via the websocket, but the API reload response | ||
| // still has the FEN of the previous move, leading to sync issues. | ||
| // So only copy the whole game here if it's a new ID. |
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.
Without this logic, I saw some glitches where moves were taken back due to API and websocket being out of sync
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.
Have you checked how it works on the website? Given the reload mechanism I find it strange indeed to use both this and the websocket.
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.
I can check again and/or ask @ornicar, but I think the reload events are not tied to the events of the featured game, but rather to the score/standings changing
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.
No it's fine like that. You need the reload events to know there is a new game. I assume the server sends the reload socket message when a new featured game starts.
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.
Exactly, when there's a new featured game, we get it via reload and then send startWatching via the socket to get the updates for each move
| } | ||
|
|
||
| // Don't bother parsing the whole FEN here, we just need the turn | ||
| final turn = featuredGame.fen.endsWith(' b') ? Side.black : Side.white; |
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.
@veloce Does chessground have some kind of convenience API for this? I didn't want to waste performance by parsing the whole string here
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.
Nope. That would be more a dartchess thing but for now there is only the Position API which parses the full fen. I don't think performance is an issue here though, so I wouldn't bother.
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.
Well for bullet games this might be called pretty often
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.
Fen parsing is cheap enough that even for real games (playing), the FEN is parsed each time the position change (it's a chessground parameter).
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.
Alright 👍
Over the board feats: Resign, Offer Draw and notification on threefold repetition
…ess-mobile into tom-anders-tournamentScreen
|
Sorry it messed the PR commit history... |
|
Will merge soon I think, still some testing and a couple of UI changes. |
With this PR, we'd have very basic support for tournaments. However, the game screen is still missing some features, like berserking, displaying rank, etc. That will be a follow-up PR. Same goes for the "podium" screen for finished tournaments.
I did not add widget tests yet, wanted to get feedback on the layout/design first.
tournament_screen.webm
TODO: