Skip to content

Conversation

Yubo-Cao
Copy link
Collaborator

@Yubo-Cao Yubo-Cao commented Aug 10, 2025

Closes #12664

This PR introduces walkthroughs for add group and search in the library, responsive layout for welcome tab (to make sure the community links footer is always visible), and a donation popup to be shown 7 days after first launch, every 365 days.

Steps to test

  1. Open JabRef
  2. The updated welcome tab should be present.
    1. Resize the window to show responsive layout

    2. Click on the walkthroughs buttons to try them out

    3. Try out donation popup is rather challenging. Modify the code to add a button in the WelcomeTab is one possible way to perform this, as shown below:

      public WelcomeTab(Stage stage,
                        LibraryTabContainer tabContainer,
                        GuiPreferences preferences,
                        AiService aiService,
                        DialogService dialogService,
                        StateManager stateManager,
                        FileUpdateMonitor fileUpdateMonitor,
                        BibEntryTypesManager entryTypesManager,
                        CountingUndoManager undoManager,
                        ClipBoardManager clipBoardManager,
                        TaskExecutor taskExecutor,
                        FileHistoryMenu fileHistoryMenu,
                        BuildInfo buildInfo,
                        WorkspacePreferences workspacePreferences,
                        ThemeManager themeManager) {
          super(Localization.lang("Welcome"));
          setClosable(true);
          this.tabContainer = tabContainer;
          this.preferences = preferences;
          this.aiService = aiService;
          this.dialogService = dialogService;
          this.stateManager = stateManager;
          this.fileUpdateMonitor = fileUpdateMonitor;
          this.entryTypesManager = entryTypesManager;
          this.undoManager = undoManager;
          this.clipBoardManager = clipBoardManager;
          this.taskExecutor = taskExecutor;
          this.fileHistoryMenu = fileHistoryMenu;
          this.buildInfo = buildInfo;
          this.stage = stage;
          this.workspacePreferences = workspacePreferences;
          this.themeManager = themeManager;
          this.recentLibrariesBox = new VBox();
          recentLibrariesBox.getStyleClass().add("welcome-recent-libraries");
      
          Node titles = createTopTitles();
          Node communityBox = createCommunityBox();
          ScrollPane columnsScroll = createColumnsContainerScrollable();
      
          VBox mainStack = new VBox(titles, columnsScroll, communityBox);
          mainStack.getStyleClass().add("welcome-main-container");
          VBox.setVgrow(columnsScroll, Priority.ALWAYS);
      
          VBox container = new VBox(mainStack);
          container.setAlignment(Pos.CENTER);
      
          StackPane rootPane = new StackPane(container);
          setContent(rootPane);
      
          DonationProvider donationProvider = new DonationProvider(rootPane, preferences, dialogService);
          donationProvider.showIfNeeded();
      
          Button button = new Button("Test");
          button.setOnAction(_ -> donationProvider.showToast());
          rootPane.getChildren().add(button);
      }

      Or alternatively, if you are using Windows, Win+R and type in regedit to open the registry editor. Change the value of HKEY_CURRENT_USER\Software\JavaSoft\Prefs\org\jabref\donation/Last/Shown/Epoch/Day to 0 will trigger donation prompt to be shown upon launch.

You can find those feature demos here:

  1. Donation Prompt
  2. Responsive layout and additional walkthrough

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [/] Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

Copy link
Member

@Siedlerchr Siedlerchr left a comment

Choose a reason for hiding this comment

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

just a quick review, need to look more in detail

@subhramit
Copy link
Member

@Yubo-Cao Once you address comments, before marking them as resolved, a good way to check if you have forgotten to push changes is to see if the review window is marked "Outdated".

Copy link
Member

@subhramit subhramit left a comment

Choose a reason for hiding this comment

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

Okay, logic-wise PR looks good
Just remove the extra newlines at the end of some files that are present

@Yubo-Cao Yubo-Cao requested a review from Siedlerchr August 20, 2025 00:19
Comment on lines 1205 to 1210
public DonationPreferences getDonationPreferences() {
DonationPreferences dp = new DonationPreferences(getBoolean(DONATION_NEVER_SHOW), getInt(DONATION_LAST_SHOWN_EPOCH_DAY));
EasyBind.listen(dp.neverShowAgainProperty(), (_, _, nv) -> putBoolean(DONATION_NEVER_SHOW, nv));
EasyBind.listen(dp.lastShownEpochDayProperty(), (_, _, nv) -> putInt(DONATION_LAST_SHOWN_EPOCH_DAY, nv.intValue()));
return dp;
}
Copy link
Member

Choose a reason for hiding this comment

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

DonationPreferences does not use the current cache pattern, which is okay. But it needs to be documented why. Please add a comment.

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to have it consistent with other preferences in case we want to reuse it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed by adding the cache pattern

Copy link
Member

@subhramit subhramit left a comment

Choose a reason for hiding this comment

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

Took another look, a few small things
Please also take a look at the failing jabgui tests

private final SearchDisplayMode previousDisplayMode;

public EnsureSearchSettingsSideEffect() {
var preferences = Injector.instantiateModelOrService(GuiPreferences.class).getSearchPreferences();
Copy link
Member

@subhramit subhramit Aug 20, 2025

Choose a reason for hiding this comment

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

  1. avoid var
  2. name it searchPreferences
  3. make it a class-level variable. Since it is being initialized here in the constructor, use it everywhere below instead of getting each time in the methods where used

Copy link
Member

Choose a reason for hiding this comment

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

Better be explicitly injected in the constructor arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines 1206 to 1209
DonationPreferences dp = new DonationPreferences(getBoolean(DONATION_NEVER_SHOW), getInt(DONATION_LAST_SHOWN_EPOCH_DAY));
EasyBind.listen(dp.neverShowAgainProperty(), (_, _, nv) -> putBoolean(DONATION_NEVER_SHOW, nv));
EasyBind.listen(dp.lastShownEpochDayProperty(), (_, _, nv) -> putInt(DONATION_LAST_SHOWN_EPOCH_DAY, nv.intValue()));
return dp;
Copy link
Member

Choose a reason for hiding this comment

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

Expand abbreviations dp and nv.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@subhramit
Copy link
Member

Can you take a look at the failing test, Yubo

@Yubo-Cao
Copy link
Collaborator Author

Can you take a look at the failing test, Yubo

Got it! The JabRef GUI test used to be always giving out errors (at the beginning), so I almost grow immune to the red checkmarks on it. It turns out that my change required a few more mock parameter to be added to the search preferences, so I modified the test slightly and got that to work.

Copy link

trag-bot bot commented Aug 22, 2025

@trag-bot didn't find any issues in the code! ✅✨

@calixtus calixtus enabled auto-merge August 22, 2025 17:20
@calixtus
Copy link
Member

As soon as the issue @Siedlerchr raised is cleared, this is imho ready to be merged.

@jabref-machine
Copy link
Collaborator

JUnit tests of jablib are failing. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Source Code Tests / Unit tests (pull_request)" and click on it.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@calixtus calixtus added this pull request to the merge queue Aug 22, 2025
Merged via the queue into JabRef:main with commit 00fc407 Aug 22, 2025
71 of 72 checks passed
@github-actions github-actions bot mentioned this pull request Aug 22, 2025
7 tasks
@ThiloteE
Copy link
Member

ThiloteE commented Aug 22, 2025

The "Add group" walkthrough looks unfinished in dark mode: image

@Yubo-Cao Yubo-Cao deleted the more-walkthroughes branch August 22, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve welcome page
7 participants