Skip to content
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

Fix #12272 - Show a welcome screen if no database is open #12461

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

oops-shlok
Copy link

@oops-shlok oops-shlok commented Feb 4, 2025

Describe the changes you have made here: what, why, ...
"Closes #12272"
"Closes #12272".

Mandatory checks

  • I own the copyright of the code submitted and I licence 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 (for UI changes)
  • 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.
Screen.Recording.2025-02-04.at.3.49.55.PM.mov
Screenshot 2025-02-04 at 3 49 48 PM Screenshot 2025-02-04 at 3 48 51 PM

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Your code currently does not meet JabRef's code guidelines.
We use OpenRewrite to ensure "modern" Java coding practices.
The issues found can be automatically fixed.
Please execute the gradle task rewriteRun, check the results, commit, and push.

You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite".

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

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.

Copy link
Member

@calixtus calixtus 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 from my cellphone. A more deeper look will follow.

-fx-font-family: "Arial";
}

.description-label {
Copy link
Member

@calixtus calixtus Feb 4, 2025

Choose a reason for hiding this comment

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

Please use a more explicit selector name for the CSS class, as this may interfere with other places similar or the same classes are used. Use welcome-* like above and ahead as a prefix.

/* AboutDialog */
#aboutDialog .about-heading {
-fx-font-size: 30;
-fx-font-size: 31;
Copy link
Member

Choose a reason for hiding this comment

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

Why this change?

@@ -230,11 +258,27 @@ private void initLayout() {
setTop(head);

splitPane.getItems().addAll(tabbedPane);
contentPane.getChildren().addAll(welcomePage, splitPane);
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 suggest to implement this as a separate tab and not as a static background. Take vscode as an example.
This way, the welcome page can be kept shown and revisited later if the user wants to work on a library in parallel. I think implementation would be straightforward as a new tab.
This would also take a lot of complexity out of the node tree.


private void updateContent() {
boolean hasOpenDatabases = !stateManager.getOpenDatabases().isEmpty();
welcomePage.setVisible(!hasOpenDatabases);
Copy link
Member

Choose a reason for hiding this comment

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

If the welcome page is the most 'lowest' node in a StackPane, it should automatically be hidden if a library is shown above. This is the whole purpose of a StackPane to deal with this. So there should be no need for messing with visibility stuff here...

import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.util.FileUpdateMonitor;

public class WelcomePage extends VBox {
Copy link
Member

Choose a reason for hiding this comment

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

Extends Tab?

welcomeLabel.getStyleClass().add("welcome-label");

Label descriptionLabel = new Label(Localization.lang("Stay on top of your Literature"));
descriptionLabel.getStyleClass().add("description-label");
Copy link
Member

Choose a reason for hiding this comment

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

Explicit class names

return createBox(Pos.TOP_LEFT, welcomeLabel, descriptionLabel);
}

private VBox createStartBox(JabRefFrame frame, GuiPreferences preferences, AiService aiService, DialogService dialogService, StateManager stateManager, FileUpdateMonitor fileUpdateMonitor, BibEntryTypesManager entryTypesManager, CountingUndoManager undoManager, ClipBoardManager clipBoardManager, TaskExecutor taskExecutor) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not class variables? I don't see any need for method injection.

}

private VBox createBox(Pos alignment, Node... nodes) {
VBox box = new VBox(5);
Copy link
Member

Choose a reason for hiding this comment

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

Why fixed count for initialization?

}
}

private VBox createBox(Pos alignment, Node... nodes) {
Copy link
Member

Choose a reason for hiding this comment

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

CreateAlignedVBox?

@oops-shlok
Copy link
Author

Hi @calixtus! Saw all the comments with respect to the PR. Will resolve them asap. Thanks for the review!

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.

Show a welcome screen if no database is open
2 participants