Skip to content

feat: add button to create a new study - #3533

Open
tom-anders wants to merge 1 commit into
lichess-org:mainfrom
tom-anders:studyCreate
Open

tom-anders wants to merge 1 commit into
lichess-org:mainfrom
tom-anders:studyCreate

Conversation

@tom-anders

Copy link
Copy Markdown
Collaborator
create-study.webm

based on #3532

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-to-end UI to create a new Study from the Study list (and to add a chapter from within a study), wiring it to the Study API and extending widget tests/helpers to cover the new flows.

Changes:

  • Add a “Create study” FAB on the Study list that opens a new Create Study bottom sheet and navigates to the created study.
  • Introduce new bottom sheets for creating a study (settings) and creating a study chapter (empty/FEN/PGN), backed by new payload types + repository methods.
  • Expand widget test coverage and add shared test utilities for opening bottom sheets and mocking clipboard content.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/view/study/create_study_chapter_bottom_sheet_test.dart New widget tests covering chapter creation flows (empty/FEN/PGN, new/existing study).
test/view/study/create_study_bottom_sheet_test.dart New widget test verifying Create Study defaults and transition to chapter creation.
test/view/play/create_challenge_bottom_sheet_test.dart Refactor tests to use shared bottom-sheet opener helper.
test/view/more/import_pgn_screen_test.dart Switch to shared clipboard mocking helper.
test/test_helpers.dart Add shared mockClipboard helper for widget tests.
test/test_bottom_sheet_opener.dart New shared TestBottomSheetOpener widget + open helper to reduce test boilerplate.
lib/src/view/study/study_list_screen.dart Add FAB entry point to create a new study via bottom sheet.
lib/src/view/study/study_bottom_bar.dart Add “New chapter” action that opens the chapter-creation bottom sheet.
lib/src/view/study/create_study_chapter_bottom_sheet.dart New UI for creating chapters from empty/FEN/PGN + file import, calling repository APIs.
lib/src/view/study/create_study_bottom_sheet.dart New UI for choosing study settings before creating the first chapter.
lib/src/model/study/study.dart Add payload types + enums to support study/chapter creation parameters.
lib/src/model/study/study_repository.dart Add API methods to create chapters, delete chapters, and create a study + replace initial empty chapter.
Suppressed comments (2)

test/view/study/create_study_bottom_sheet_test.dart:66

  • _TestBottomSheetOpener is unused (the test uses TestBottomSheetOpener). Remove this dead code to keep the test file focused and avoid unused-element noise.

This issue also appears on line 82 of the same file.
test/view/study/create_study_bottom_sheet_test.dart:86

  • Remove the remaining unused _TestBottomSheetOpener widget block.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/src/view/study/create_study_chapter_bottom_sheet.dart Outdated
Comment thread lib/src/view/study/create_study_chapter_bottom_sheet.dart
Comment thread lib/src/view/study/create_study_bottom_sheet.dart
Comment thread test/view/study/create_study_chapter_bottom_sheet_test.dart Outdated
@ijm8710

ijm8710 commented Aug 4, 2026

Copy link
Copy Markdown

On web, the create study plus sign button is visible even on the main studies page.

I'd propose that we show "create study" always (within the studies section) so that it's more discoverable.

Thoughts?

@tom-anders
tom-anders force-pushed the studyCreate branch 2 times, most recently from f57d4ce to c72421d Compare August 20, 2026 12:48
@tom-anders
tom-anders marked this pull request as ready for review August 20, 2026 12:48
@tom-anders
tom-anders requested a review from veloce August 20, 2026 12:48
@tom-anders

Copy link
Copy Markdown
Collaborator Author

hmm not sure why the formatting check fails, locally dart format says the file is formatted correctly. Might be a version mismatch? I'm already on flutter SDK 3.47.1 locally

@tom-anders

Copy link
Copy Markdown
Collaborator Author

On web, the create study plus sign button is visible even on the main studies page.

I'd propose that we show "create study" always (within the studies section) so that it's more discoverable.

Thoughts?

Good suggestion I think, added it:

studyButton.webm

@tom-anders

Copy link
Copy Markdown
Collaborator Author

@veloce Finally got around to fixing the formatting issues, sorry about that. It's ready for review now :)

@veloce

veloce commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@tom-anders sorry, now there are conflicts with the new lints, can you solve them please? thanks

@tom-anders

Copy link
Copy Markdown
Collaborator Author

@veloce fixed 👍

@veloce veloce left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! only a small comment.

actions: const [AccountMenuButton()],
),
body: const _Body(),
floatingActionButton: const CreateStudyFloatingActionButton(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put the floating button only in the study list screen. Because the learn screen is not just about studies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants