Skip to content

Commit afa8b54

Browse files
committed
Added Footer for Welcome Tab
1 parent 5196593 commit afa8b54

File tree

3 files changed

+124
-4
lines changed

3 files changed

+124
-4
lines changed

Diff for: src/main/java/org/jabref/gui/Base.css

+29
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,35 @@ We want to have a look that matches our icons in the tool-bar */
17601760
-fx-text-fill: -jr-theme;
17611761
}
17621762

1763+
.welcome-footer-container {
1764+
-fx-padding: 15px;
1765+
-fx-alignment: center;
1766+
-fx-spacing: 15px;
1767+
}
1768+
1769+
.welcome-footer-label {
1770+
-fx-font-size: 2.25em;
1771+
-fx-text-fill: -jr-theme-text;
1772+
-fx-font-family: "Arial";
1773+
}
1774+
1775+
.welcome-footer-link {
1776+
-fx-font-size: 1.2em;
1777+
-fx-text-fill: -jr-theme;
1778+
-fx-font-family: "Arial";
1779+
}
1780+
1781+
.welcome-footer-link:hover {
1782+
-fx-underline: true;
1783+
-fx-text-fill: derive(-jr-theme, -20%);
1784+
}
1785+
1786+
.welcome-footer-version {
1787+
-fx-font-size: 1.2em;
1788+
-fx-text-fill: -jr-theme;
1789+
-fx-font-family: "Arial";
1790+
}
1791+
17631792
/* AboutDialog */
17641793
#aboutDialog .about-heading {
17651794
-fx-font-size: 30;

Diff for: src/main/java/org/jabref/gui/WelcomeTab.java

+90-2
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,23 @@
99
import javafx.scene.control.MenuItem;
1010
import javafx.scene.control.ScrollPane;
1111
import javafx.scene.control.Tab;
12+
import javafx.scene.layout.BorderPane;
1213
import javafx.scene.layout.HBox;
14+
import javafx.scene.layout.Priority;
1315
import javafx.scene.layout.StackPane;
1416
import javafx.scene.layout.VBox;
1517

18+
import org.jabref.gui.actions.StandardActions;
19+
import org.jabref.gui.edit.OpenBrowserAction;
1620
import org.jabref.gui.frame.FileHistoryMenu;
21+
import org.jabref.gui.icon.IconTheme;
1722
import org.jabref.gui.importer.NewDatabaseAction;
1823
import org.jabref.gui.importer.actions.OpenDatabaseAction;
1924
import org.jabref.gui.preferences.GuiPreferences;
2025
import org.jabref.gui.undo.CountingUndoManager;
2126
import org.jabref.logic.ai.AiService;
2227
import org.jabref.logic.l10n.Localization;
28+
import org.jabref.logic.util.BuildInfo;
2329
import org.jabref.logic.util.TaskExecutor;
2430
import org.jabref.model.entry.BibEntryTypesManager;
2531
import org.jabref.model.util.FileUpdateMonitor;
@@ -38,6 +44,7 @@ public class WelcomeTab extends Tab {
3844
private final ClipBoardManager clipBoardManager;
3945
private final TaskExecutor taskExecutor;
4046
private final FileHistoryMenu fileHistoryMenu;
47+
private final BuildInfo buildInfo;
4148

4249
public WelcomeTab(LibraryTabContainer tabContainer,
4350
GuiPreferences preferences,
@@ -49,7 +56,8 @@ public WelcomeTab(LibraryTabContainer tabContainer,
4956
CountingUndoManager undoManager,
5057
ClipBoardManager clipBoardManager,
5158
TaskExecutor taskExecutor,
52-
FileHistoryMenu fileHistoryMenu) {
59+
FileHistoryMenu fileHistoryMenu,
60+
BuildInfo buildInfo) {
5361

5462
super(Localization.lang("Welcome"));
5563
setClosable(true);
@@ -65,6 +73,7 @@ public WelcomeTab(LibraryTabContainer tabContainer,
6573
this.clipBoardManager = clipBoardManager;
6674
this.taskExecutor = taskExecutor;
6775
this.fileHistoryMenu = fileHistoryMenu;
76+
this.buildInfo = buildInfo;
6877

6978
this.recentLibrariesBox = new VBox(5);
7079

@@ -94,7 +103,14 @@ public WelcomeTab(LibraryTabContainer tabContainer,
94103
welcomePageContainer.getChildren().addAll(welcomeBox, startBox, recentBox);
95104
welcomeMainContainer.getChildren().add(welcomePageContainer);
96105

97-
setContent(welcomeMainContainer);
106+
BorderPane rootLayout = new BorderPane();
107+
rootLayout.setCenter(welcomeMainContainer);
108+
rootLayout.setBottom(createFooter());
109+
110+
VBox container = new VBox();
111+
container.getChildren().add(rootLayout);
112+
VBox.setVgrow(rootLayout, Priority.ALWAYS);
113+
setContent(container);
98114
}
99115

100116
private VBox createWelcomeBox() {
@@ -159,4 +175,76 @@ private VBox createVBoxContainer(Node... nodes) {
159175
box.getChildren().addAll(nodes);
160176
return box;
161177
}
178+
179+
private VBox createFooter() {
180+
Label communityLabel = new Label(Localization.lang("Community"));
181+
communityLabel.getStyleClass().add("welcome-footer-label");
182+
183+
HBox iconLinksContainer = new HBox(15);
184+
iconLinksContainer.setAlignment(Pos.CENTER);
185+
186+
Hyperlink onlineHelpLink = createFooterLink(Localization.lang("Online help"), StandardActions.HELP, IconTheme.JabRefIcons.HELP);
187+
Hyperlink forumLink = createFooterLink(Localization.lang("Forum for support"), StandardActions.OPEN_FORUM, IconTheme.JabRefIcons.FORUM);
188+
Hyperlink mastodonLink = createFooterLink(Localization.lang("Mastodon"), StandardActions.OPEN_MASTODON, IconTheme.JabRefIcons.MASTODON);
189+
Hyperlink linkedInLink = createFooterLink(Localization.lang("LinkedIn"), StandardActions.OPEN_LINKEDIN, IconTheme.JabRefIcons.LINKEDIN);
190+
Hyperlink donationLink = createFooterLink(Localization.lang("Donation"), StandardActions.DONATE, IconTheme.JabRefIcons.DONATE);
191+
192+
iconLinksContainer.getChildren().addAll(onlineHelpLink, forumLink, mastodonLink, linkedInLink, donationLink);
193+
194+
HBox textLinksContainer = new HBox(15);
195+
textLinksContainer.setAlignment(Pos.CENTER);
196+
197+
Hyperlink devVersionLink = createFooterLink(Localization.lang("Download Development version"), StandardActions.OPEN_DEV_VERSION_LINK, null);
198+
Hyperlink changelogLink = createFooterLink(Localization.lang("CHANGELOG"), StandardActions.OPEN_CHANGELOG, null);
199+
200+
textLinksContainer.getChildren().addAll(devVersionLink, changelogLink);
201+
202+
HBox versionContainer = new HBox(15);
203+
versionContainer.setAlignment(Pos.CENTER);
204+
Label versionLabel = new Label(Localization.lang("Current JabRef Version: ") + buildInfo.version);
205+
versionLabel.getStyleClass().add("welcome-footer-version");
206+
versionContainer.getChildren().add(versionLabel);
207+
208+
VBox footerBox = new VBox(10);
209+
footerBox.setAlignment(Pos.CENTER);
210+
footerBox.getChildren().addAll(communityLabel, iconLinksContainer, textLinksContainer, versionContainer);
211+
footerBox.setPadding(new Insets(10, 0, 10, 0));
212+
footerBox.getStyleClass().add("welcome-footer-container");
213+
214+
return footerBox;
215+
}
216+
217+
private Hyperlink createFooterLink(String text, StandardActions action, IconTheme.JabRefIcons icon) {
218+
Hyperlink link = new Hyperlink(text);
219+
link.getStyleClass().add("welcome-footer-link");
220+
221+
String url = switch (action) {
222+
case HELP ->
223+
"https://help.jabref.org/";
224+
case OPEN_FORUM ->
225+
"https://discourse.jabref.org/";
226+
case OPEN_MASTODON ->
227+
"https://foojay.social/@jabref";
228+
case OPEN_LINKEDIN ->
229+
"https://linkedin.com/company/jabref/";
230+
case DONATE ->
231+
"https://donate.jabref.org";
232+
case OPEN_DEV_VERSION_LINK ->
233+
"https://builds.jabref.org/master/";
234+
case OPEN_CHANGELOG ->
235+
"https://github.com/JabRef/jabref/blob/main/CHANGELOG.md";
236+
default ->
237+
null;
238+
};
239+
240+
if (url != null) {
241+
link.setOnAction(e -> new OpenBrowserAction(url, dialogService, preferences.getExternalApplicationsPreferences()).execute());
242+
}
243+
244+
if (icon != null) {
245+
link.setGraphic(icon.getGraphicNode());
246+
}
247+
248+
return link;
249+
}
162250
}

Diff for: src/main/java/org/jabref/gui/frame/JabRefFrame.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import org.jabref.logic.ai.AiService;
5252
import org.jabref.logic.journals.JournalAbbreviationRepository;
5353
import org.jabref.logic.os.OS;
54+
import org.jabref.logic.util.BuildInfo;
5455
import org.jabref.logic.util.TaskExecutor;
5556
import org.jabref.model.database.BibDatabaseContext;
5657
import org.jabref.model.entry.BibEntryTypesManager;
@@ -241,7 +242,8 @@ private void initLayout() {
241242
undoManager,
242243
clipBoardManager,
243244
taskExecutor,
244-
fileHistory
245+
fileHistory,
246+
new BuildInfo()
245247
);
246248

247249
tabbedPane.getTabs().add(welcomeTab);
@@ -482,7 +484,8 @@ public void showWelcomeTab() {
482484
undoManager,
483485
clipBoardManager,
484486
taskExecutor,
485-
fileHistory
487+
fileHistory,
488+
new BuildInfo()
486489
);
487490
tabbedPane.getTabs().add(welcomeTab);
488491
tabbedPane.getSelectionModel().select(welcomeTab);

0 commit comments

Comments
 (0)