-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
feat: add study list screen #990
Conversation
I like the big icons they show on web. |
47a49fb
to
c586ae4
Compare
study_list.webm |
@tom-anders yeah great initiative! we should split this one as much as possible; I prefer to review small PRs :) |
Perfect 👍 I'll further split up this PR as well. |
Thanks for adding the icons :) 2 more A few times in video the names become ... prob because too long. But on mobile web I don't see it. So I'm assuming (because names are prob capped anyway) should be able to fit them always without truncation I do slightly prefer how mobile web the chosen filter sort is actively shown (ie "hot" studies) rather than having to open the filter to see the specified choice |
I guess that depends on the on the screen size, you probably always have cases where names are to long. But we can tweak the layout and font size too make it a bit less likely.
Good point - I don't want the buttons to be visible always, but adjusting the title of the top bar would probably be the best solution. Something like "Study - All - Popular" |
(converted back to a draft, as I'll split some code into smaller independent PRs |
@veloce I'm currently thinking about how we should implement the analysis board for studies. We probably want to reuse as much of the existing
Or maybe there's another approach I'm missing? Let me know what you think when you find the time :) |
I think the Over reusing a controller is not a good idea. I plan to write a dedicated controller for the opening explorer for instance, because almost all the logic of the analysis controller is not needed in the explorer. Once we have several controller that share some logic, we can think about refactoring, using mixins probably. This kind of refactoring is not that easy to do, so we'd better way for things to stabilise. |
That being said, if you fancy that kind of refactoring and want to create a
Is there a direct way to convert the study JSON to a
For this reason, the study notifier should take only the study ID as parameter, and be asynchronous. |
Thanks for the quick and helpful reply!
Ah, the opening explorer was actually the code that gave me this idea of reusing the controller in the first place. Ok, then I agree that we should write a separate study controller, and (maybe) do the refactoring in the future.
Haven't tried yet, but the layout looked similar enough. But maybe it's better to use a dedicated StudyNode class instead, we'll see.
Good hint, will keep this in mind 👍 |
For the broadcast feature, I made a different screen for the analysis board but I reused the analysis controller because I thought the logic was almost the same. I also went for this because the api returns a pgn https://lichess.org/api#tag/Studies/operation/studyChapterPgn so I don't understand why you said tom-anders that you need to pass a |
Oh wow, I must have completely missed that API endpoint when looking through the docs. Currently I'm using |
Marking this as "Ready to Review" again, as I don't think I can split this up further |
I rebased against Here's an updated video: study_list.webm |
Excited for this Tom. The one thing I find that's goofy is the open circle bullets for each chapter. I know that's how it is on mobile web but as Veloce says they don't always have to mirror. The one thing I'd ask is do they serve any point. If those circles get filled in or checked off when a study is completed then they do make some sense. If they don't currently, is that even possible to do even if web doesn't since it adds decent utility? If not, do you think there's a better formatting marker to use instead? I know that's two decently long paragraphs for such a minor formatting marker and no clue why they look so goofy to me lol |
Also, you mentioned splitting this pr and only starting with study list screen itself. I assume the favorite studies and other options of the like are part of a later phase, is that correct? Totally cool and more than happy to have a slightly limited alpha version at first, just curious if that's part of what you were implying earlier? |
I know it's an empty study screen. What I meant by freeze is that the animation starts then stops abruptly at about 25% after it started, it stays blocked during a short time then resume. That's not normal, it should be smooth and continuous all the time. |
Ah, got it, I can reproduce as well. But I still think it's related to the empty screen - If I take #1111 and rebase it onto this branch (Pass |
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.
The search bar is sticky so it should be part of the page header, it will look much better. On Android it is very easy, on iOS we have to workaround a little. You can see how it's done in the opening explorer screen.
], | ||
); | ||
await tester.pumpWidget(app); | ||
await tester.pumpAndSettle(); |
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.
Why is pumpAndSettle
needed here? it is usually needed when animations need to finish, but I prefer put a comment each time we use pump()
or pumpOrSettle
to explain what are we waiting for, to help future readers.
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.
ah this one is needed, I added 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.
(although pump
seems to also be sufficient)
), | ||
); | ||
|
||
await tester.pumpAndSettle(); |
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.
Also explain why there is a pumpAndSettle
at the end.
Would be good to track the requests made and add a check to confirm that the requests match the expected.
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.
Ah, this pumpAndSettle()
was needed because
WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {
requestedNextPage = false;
});
});
causes a crash otherwise. But, thanks to the helpful flutter error message, we can add an if (mounted)
check to fix this instead.
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.
Would be good to track the requests made and add a check to confirm that the requests match the expected.
Added helper variables to track the requests, not sure if this is the most elegant solution though
I must add that another simpler solution is to make the search bar non sticky. This is perhaps even better. |
Done, I wrapped the column with a |
I tested it on a low end device to check if embedding a Turn out that the answer is yes... I suppose the A simple way to deal with it I think: itemBuilder: (context, index) {
if (index == 0) {
return SearchBar();
} else {
final study = studies.studies[index - 1];
....
} |
Ah yes, that seems more elegant anyway. Done. |
e828205
to
946d1e3
Compare
old code would keep requesting pages even if the API returns "nextPage": null.
// If we're not logged in, the only category available is "All" | ||
if (isLoggedIn) ...[ | ||
Filter<StudyCategory>( | ||
// TODO mobile l10n |
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.
This one (and also "Sort by") do not exist in the Web UI and need will mobile-specific translations at some point in the future
@veloce Since studies are such a huge feature, I'd suggest we split it up and start with this PR that only will add the study list screen. This also makes it easier for others to take over development from me if necessary. After review, we can hide the button until the study feature is fully implemented.