Skip to content

Commit

Permalink
Merge pull request #1696 from aaerhart/mastodon-and-bluesky-to-user-p…
Browse files Browse the repository at this point in the history
…rofiles

Mastodon and bluesky to user profiles
  • Loading branch information
mertbagt authored Feb 12, 2025
2 parents 67e5ad4 + 5c01355 commit a77ae69
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 8 deletions.
32 changes: 32 additions & 0 deletions components/EditProfilePage/PersonalInfoTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type UpdateProfileData = {
linkedIn: string
instagram: string
fb: string
blueSky: string
mastodon: string
publicEmail: string
publicPhone: number
website: string
Expand Down Expand Up @@ -54,6 +56,8 @@ async function updateProfile(
await updateSocial("linkedIn", data.linkedIn)
await updateSocial("twitter", data.twitter)
await updateSocial("instagram", data.instagram)
await updateSocial("blueSky", data.blueSky)
await updateSocial("mastodon", data.mastodon)
await updateSocial("fb", data.fb)
await updateAbout(data.aboutYou)
await updateFullName(data.fullName)
Expand Down Expand Up @@ -171,6 +175,20 @@ export function PersonalInfoTab({
iconSrc="./linkedin.svg"
{...register("linkedIn")}
/>
<SocialInput
label={t("socialLinks.blueSky")}
defaultValue={social?.blueSky}
className="col-sm-12 col-md-6 mb-1"
iconSrc="./bluesky.svg"
{...register("blueSky")}
/>
<SocialInput
label={t("socialLinks.mastodon")}
defaultValue={social?.mastodon}
className="col-sm-12 col-md-6 mb-1"
iconSrc="./mastodon.svg"
{...register("mastodon")}
/>
{isOrg && (
<>
<SocialInput
Expand All @@ -187,6 +205,20 @@ export function PersonalInfoTab({
iconSrc="./facebook.svg"
{...register("fb")}
/>
<SocialInput
label={t("socialLinks.bluesky")}
defaultValue={social?.blueSky}
className="col-sm-12 col-md-6 mb-1"
iconSrc="./bluesky.svg"
{...register("blueSky")}
/>
<SocialInput
label={t("socialLinks.mastodon")}
defaultValue={social?.mastodon}
className="col-sm-12 col-md-6 mb-1"
iconSrc="./mastodon.svg"
{...register("mastodon")}
/>
</>
)}
</div>
Expand Down
16 changes: 13 additions & 3 deletions components/ProfilePage/ProfileAboutSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ export const ProfileAboutSection = ({
twitter,
linkedIn,
instagram,
fb
}: { twitter?: string; linkedIn?: string; instagram?: string; fb?: string } =
profile?.social ?? {}
fb,
blueSky,
mastodon
}: {
twitter?: string
linkedIn?: string
instagram?: string
fb?: string
blueSky?: string
mastodon?: string
} = profile?.social ?? {}
const { t } = useTranslation("profile")
const title = isOrg
? t("aboutUs")
Expand All @@ -37,6 +45,8 @@ export const ProfileAboutSection = ({
linkedIn={linkedIn}
instagram={instagram}
fb={fb}
blueSky={blueSky}
mastodon={mastodon}
/>
) : (
<></>
Expand Down
22 changes: 21 additions & 1 deletion components/ProfilePage/SocialMediaIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ export const SocialMediaIcons = ({
twitter,
linkedIn,
instagram,
fb
fb,
blueSky,
mastodon
}: {
twitter?: string
instagram?: string
fb?: string
linkedIn?: string
blueSky?: string
mastodon?: string
}) => {
const { t } = useTranslation("common")

Expand Down Expand Up @@ -49,6 +53,22 @@ export const SocialMediaIcons = ({
</External>
</Col>
)}

{blueSky && (
<Col>
<External plain href={`https://bsky.app.profile/${blueSky}`}>
<Image alt={t("socials.bluesky")} src="/bluesky.svg" />
</External>
</Col>
)}

{mastodon && (
<Col>
<External plain href={`https://mastodon.social/@${mastodon}`}>
<Image alt={t("socials.mastodon")} src="/mastodon.svg" />
</External>
</Col>
)}
</Row>
</div>
)
Expand Down
4 changes: 3 additions & 1 deletion components/db/profile/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export function useProfile() {
linkedIn: false,
twitter: false,
instagram: false,
fb: false
fb: false,
blueSky: false,
mastodon: false
},
updatingBillsFollowing: false,
profile
Expand Down
4 changes: 3 additions & 1 deletion components/db/profile/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const SOCIAL_NETWORKS = [
"linkedIn",
"twitter",
"instagram",
"fb"
"fb",
"blueSky",
"mastodon"
] as const

export type SocialLinks = Partial<
Expand Down
3 changes: 3 additions & 0 deletions components/db/profile/urlCleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export function cleanSocialLinks(network: keyof SocialLinks, link: string) {
const index: number = path.indexOf(".com/") + 5
path = path.substring(index)
}
if (network === "mastodon" && path.startsWith("@")) {
path = path.substring(1)
}
}

return path
Expand Down
1 change: 1 addition & 0 deletions public/bluesky.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@
"instagram": "Instagram",
"linkedin": "LinkedIn",
"twitter": "Twitter",
"facebook": "Facebook"
"facebook": "Facebook",
"bluesky": "BlueSky",
"mastodon": "Mastodon"
},
"table": {
"page": "Page {{currentPage}}"
Expand Down
4 changes: 3 additions & 1 deletion public/locales/en/editProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
"twitter": "Twitter Username",
"linkedIn": "LinkedIn Url",
"instagram": "Instagram Username",
"facebook": "Facebook Link"
"facebook": "Facebook Link",
"blueSky": "BlueSky Link",
"mastodon": "Mastodon Link"
},
"contact": {
"contactInfo": "Contact Information",
Expand Down
3 changes: 3 additions & 0 deletions public/mastodon.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 a77ae69

Please sign in to comment.