Skip to content

Commit a77ae69

Browse files
authored
Merge pull request #1696 from aaerhart/mastodon-and-bluesky-to-user-profiles
Mastodon and bluesky to user profiles
2 parents 67e5ad4 + 5c01355 commit a77ae69

File tree

10 files changed

+85
-8
lines changed

10 files changed

+85
-8
lines changed

components/EditProfilePage/PersonalInfoTab.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ type UpdateProfileData = {
1717
linkedIn: string
1818
instagram: string
1919
fb: string
20+
blueSky: string
21+
mastodon: string
2022
publicEmail: string
2123
publicPhone: number
2224
website: string
@@ -54,6 +56,8 @@ async function updateProfile(
5456
await updateSocial("linkedIn", data.linkedIn)
5557
await updateSocial("twitter", data.twitter)
5658
await updateSocial("instagram", data.instagram)
59+
await updateSocial("blueSky", data.blueSky)
60+
await updateSocial("mastodon", data.mastodon)
5761
await updateSocial("fb", data.fb)
5862
await updateAbout(data.aboutYou)
5963
await updateFullName(data.fullName)
@@ -171,6 +175,20 @@ export function PersonalInfoTab({
171175
iconSrc="./linkedin.svg"
172176
{...register("linkedIn")}
173177
/>
178+
<SocialInput
179+
label={t("socialLinks.blueSky")}
180+
defaultValue={social?.blueSky}
181+
className="col-sm-12 col-md-6 mb-1"
182+
iconSrc="./bluesky.svg"
183+
{...register("blueSky")}
184+
/>
185+
<SocialInput
186+
label={t("socialLinks.mastodon")}
187+
defaultValue={social?.mastodon}
188+
className="col-sm-12 col-md-6 mb-1"
189+
iconSrc="./mastodon.svg"
190+
{...register("mastodon")}
191+
/>
174192
{isOrg && (
175193
<>
176194
<SocialInput
@@ -187,6 +205,20 @@ export function PersonalInfoTab({
187205
iconSrc="./facebook.svg"
188206
{...register("fb")}
189207
/>
208+
<SocialInput
209+
label={t("socialLinks.bluesky")}
210+
defaultValue={social?.blueSky}
211+
className="col-sm-12 col-md-6 mb-1"
212+
iconSrc="./bluesky.svg"
213+
{...register("blueSky")}
214+
/>
215+
<SocialInput
216+
label={t("socialLinks.mastodon")}
217+
defaultValue={social?.mastodon}
218+
className="col-sm-12 col-md-6 mb-1"
219+
iconSrc="./mastodon.svg"
220+
{...register("mastodon")}
221+
/>
190222
</>
191223
)}
192224
</div>

components/ProfilePage/ProfileAboutSection.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ export const ProfileAboutSection = ({
1616
twitter,
1717
linkedIn,
1818
instagram,
19-
fb
20-
}: { twitter?: string; linkedIn?: string; instagram?: string; fb?: string } =
21-
profile?.social ?? {}
19+
fb,
20+
blueSky,
21+
mastodon
22+
}: {
23+
twitter?: string
24+
linkedIn?: string
25+
instagram?: string
26+
fb?: string
27+
blueSky?: string
28+
mastodon?: string
29+
} = profile?.social ?? {}
2230
const { t } = useTranslation("profile")
2331
const title = isOrg
2432
? t("aboutUs")
@@ -37,6 +45,8 @@ export const ProfileAboutSection = ({
3745
linkedIn={linkedIn}
3846
instagram={instagram}
3947
fb={fb}
48+
blueSky={blueSky}
49+
mastodon={mastodon}
4050
/>
4151
) : (
4252
<></>

components/ProfilePage/SocialMediaIcons.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ export const SocialMediaIcons = ({
66
twitter,
77
linkedIn,
88
instagram,
9-
fb
9+
fb,
10+
blueSky,
11+
mastodon
1012
}: {
1113
twitter?: string
1214
instagram?: string
1315
fb?: string
1416
linkedIn?: string
17+
blueSky?: string
18+
mastodon?: string
1519
}) => {
1620
const { t } = useTranslation("common")
1721

@@ -49,6 +53,22 @@ export const SocialMediaIcons = ({
4953
</External>
5054
</Col>
5155
)}
56+
57+
{blueSky && (
58+
<Col>
59+
<External plain href={`https://bsky.app.profile/${blueSky}`}>
60+
<Image alt={t("socials.bluesky")} src="/bluesky.svg" />
61+
</External>
62+
</Col>
63+
)}
64+
65+
{mastodon && (
66+
<Col>
67+
<External plain href={`https://mastodon.social/@${mastodon}`}>
68+
<Image alt={t("socials.mastodon")} src="/mastodon.svg" />
69+
</External>
70+
</Col>
71+
)}
5272
</Row>
5373
</div>
5474
)

components/db/profile/profile.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ export function useProfile() {
6565
linkedIn: false,
6666
twitter: false,
6767
instagram: false,
68-
fb: false
68+
fb: false,
69+
blueSky: false,
70+
mastodon: false
6971
},
7072
updatingBillsFollowing: false,
7173
profile

components/db/profile/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export const SOCIAL_NETWORKS = [
1717
"linkedIn",
1818
"twitter",
1919
"instagram",
20-
"fb"
20+
"fb",
21+
"blueSky",
22+
"mastodon"
2123
] as const
2224

2325
export type SocialLinks = Partial<

components/db/profile/urlCleanup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export function cleanSocialLinks(network: keyof SocialLinks, link: string) {
77
const index: number = path.indexOf(".com/") + 5
88
path = path.substring(index)
99
}
10+
if (network === "mastodon" && path.startsWith("@")) {
11+
path = path.substring(1)
12+
}
1013
}
1114

1215
return path

public/bluesky.svg

Lines changed: 1 addition & 0 deletions
Loading

public/locales/en/common.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@
119119
"instagram": "Instagram",
120120
"linkedin": "LinkedIn",
121121
"twitter": "Twitter",
122-
"facebook": "Facebook"
122+
"facebook": "Facebook",
123+
"bluesky": "BlueSky",
124+
"mastodon": "Mastodon"
123125
},
124126
"table": {
125127
"page": "Page {{currentPage}}"

public/locales/en/editProfile.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@
7171
"twitter": "Twitter Username",
7272
"linkedIn": "LinkedIn Url",
7373
"instagram": "Instagram Username",
74-
"facebook": "Facebook Link"
74+
"facebook": "Facebook Link",
75+
"blueSky": "BlueSky Link",
76+
"mastodon": "Mastodon Link"
7577
},
7678
"contact": {
7779
"contactInfo": "Contact Information",

public/mastodon.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)