Skip to content

Commit

Permalink
Add Bluesky support for social links and icons
Browse files Browse the repository at this point in the history
Integrated Bluesky social media links into various components such as PersonTileView, MemberCellView, and DetailHeaderBase. Added a new Bluesky icon to the iconfont and updated SocialLinksView to include Bluesky link capabilities.
  • Loading branch information
leewyatt committed Nov 20, 2024
1 parent 91c85b7 commit bf242e8
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public MemberCellView(Member member) {

socialLinksView.setMastodonUrl(member.getMastodon());
socialLinksView.setWebsiteUrl(member.getWebsite());
socialLinksView.setBlueskyUrl(member.getBluesky());

if (StringUtils.isNotBlank(member.getLinkedIn())) {
socialLinksView.setLinkedInUrl("https://www.linkedin.com/in/" + member.getLinkedIn());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dlsc.jfxcentral2.components;

import com.dlsc.jfxcentral2.iconfont.JFXCentralIcon;
import com.dlsc.jfxcentral2.utils.ExternalLinkUtil;
import com.dlsc.jfxcentral2.utils.IkonUtil;
import javafx.beans.InvalidationListener;
Expand All @@ -22,6 +23,7 @@ public class SocialLinksView extends StackPane {
private final Button githubLinkBtn;
private final Button facebookLinkBtn;
private final Button redditLinkBtn;
private final Button blueskyLinkBtn;
private final Pane pane;

public SocialLinksView() {
Expand Down Expand Up @@ -104,6 +106,15 @@ public SocialLinksView(boolean useFlowPane) {
facebookLinkBtn.setFocusTraversable(false);
facebookUrl.addListener(it -> updateLink(facebookLinkBtn, getFacebookUrl()));

blueskyLinkBtn = new Button("BLUESKY", new FontIcon(JFXCentralIcon.BLUESKY));
blueskyLinkBtn.getStyleClass().add("bluesky-link-btn");
blueskyLinkBtn.setMinWidth(Region.USE_PREF_SIZE);
blueskyLinkBtn.setMaxWidth(Double.MAX_VALUE);
blueskyLinkBtn.visibleProperty().bind(blueskyUrlProperty().isNotEmpty());
blueskyLinkBtn.managedProperty().bind(blueskyLinkBtn.visibleProperty());
blueskyLinkBtn.setFocusTraversable(false);
blueskyUrl.addListener(it -> updateLink(blueskyLinkBtn, getBlueskyUrl()));

mailLinkBtn = new Button("MAIL", new FontIcon(IkonUtil.mail));
mailLinkBtn.getStyleClass().add("mail-link-btn");
mailLinkBtn.setMinWidth(Region.USE_PREF_SIZE);
Expand All @@ -123,6 +134,7 @@ public SocialLinksView(boolean useFlowPane) {
mailUrl.addListener(updateViewListener);
facebookUrl.addListener(updateViewListener);
redditUrl.addListener(updateViewListener);
blueskyUrl.addListener(updateViewListener);

updateView();
}
Expand Down Expand Up @@ -155,6 +167,9 @@ private void updateView() {
if (StringUtils.isNotBlank(getRedditUrl())) {
pane.getChildren().add(redditLinkBtn);
}
if (StringUtils.isNotBlank(getBlueskyUrl())) {
pane.getChildren().add(blueskyLinkBtn);
}
if (StringUtils.isNotBlank(getMailUrl())) {
pane.getChildren().add(mailLinkBtn);
}
Expand All @@ -179,6 +194,7 @@ public StringProperty twitterUrlProperty() {
public void setTwitterUrl(String twitterUrl) {
this.twitterUrl.set(twitterUrl);
}

private final StringProperty mastodonUrl = new SimpleStringProperty(this, "mastodonUrl");

public String getMastodonUrl() {
Expand Down Expand Up @@ -276,4 +292,18 @@ public StringProperty githubUrlProperty() {
public void setGithubUrl(String githubUrl) {
this.githubUrl.set(githubUrl);
}

private final StringProperty blueskyUrl = new SimpleStringProperty(this, "blueskyUrl");

public final String getBlueskyUrl() {
return blueskyUrl.get();
}

public final StringProperty blueskyUrlProperty() {
return blueskyUrl;
}

public final void setBlueskyUrl(String blueskyUrl) {
this.blueskyUrl.set(blueskyUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ private void updateShareButton(SocialLinksView socialLinksView) {
String titleWithBody = URLEncoder.encode(shareTitle + " " + shareText, StandardCharsets.UTF_8);
String body = URLEncoder.encode(shareText + " ", StandardCharsets.UTF_8); // extra space for proper formatting on twitter
String bodyWithUrl = URLEncoder.encode(shareText + " https://www.jfx-central.com/" + shareUrl, StandardCharsets.UTF_8);
String bodyWithUrlAndTags = URLEncoder.encode(shareText + " https://www.jfx-central.com/" + shareUrl + " #javafx #java #ux #ui", StandardCharsets.UTF_8);

socialLinksView.setFacebookUrl("https://www.facebook.com/sharer/sharer.php?u=" + url + "&t=" + titleWithBody);
socialLinksView.setTwitterUrl("https://twitter.com/share?text=" + body + "&url=" + url + "&hashtags=javafx,java,ux,ui");
socialLinksView.setLinkedInUrl("https://www.linkedin.com/shareArticle?mini=false&url=" + url + "&title=" + title + "&summary=" + body);
socialLinksView.setMailUrl("mailto:?subject=" + title.replace("+", "%20") + "&body=" + body.replace("+", "%20"));
socialLinksView.setRedditUrl("https://www.reddit.com/r/JavaFX/submit?title=" + title + "&selftext=true&text=" + bodyWithUrl + "&link=" + url);
socialLinksView.setBlueskyUrl("https://bsky.app/intent/compose?text=" + bodyWithUrlAndTags);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ protected List<Node> createExtraNodes() {
socialLinksView.setLinkedInUrl("https://www.linkedin.com/in/" + person.getLinkedIn());
socialLinksView.setWebsiteUrl(person.getWebsite());
socialLinksView.setGithubUrl(person.getGitHub());
socialLinksView.setBlueskyUrl(person.getBluesky());
if (StringUtils.isNotBlank(person.getEmail().trim())) {
socialLinksView.setMailUrl("mailto:" + person.getEmail());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public enum JFXCentralIcon implements Ikon {
YOUTUBE("jfx-icon-youtube", '\ue934'),
TOP_CONTENT("jfx-icon-top-content", '\ue935'),
HANDSHAKE("jfx-icon-handshake", '\ue936'),
TEAM("jfx-icon-team", '\ue937');
TEAM("jfx-icon-team", '\ue937'),
BLUESKY("jfx-icon-bluesky", '\ue938');

private final String description;
private final int icon;
Expand Down
Binary file not shown.
File renamed without changes
File renamed without changes
4 changes: 4 additions & 0 deletions iconfont/svg/057-bluesky.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bf242e8

Please sign in to comment.