Allow Github style mastodon format
This commit is contained in:
parent
41279736f5
commit
30ea06d78e
@ -455,7 +455,7 @@ const config = {
|
||||
social: {
|
||||
linkedin: 'ariful-alam',
|
||||
twitter: 'arif_szn',
|
||||
mastodon: '',
|
||||
mastodon: 'arifszn@mastodon.social',
|
||||
facebook: '',
|
||||
instagram: '',
|
||||
dribbble: '',
|
||||
|
||||
@ -13,7 +13,7 @@ const config = {
|
||||
social: {
|
||||
linkedin: 'ariful-alam',
|
||||
twitter: 'arif_szn',
|
||||
mastodon: '',
|
||||
mastodon: 'arifszn@mastodon.social',
|
||||
facebook: '',
|
||||
instagram: '',
|
||||
dribbble: '',
|
||||
|
||||
@ -29,22 +29,14 @@ const companyLink = (company) => {
|
||||
return `https://github.com/${company.substring(1)}`;
|
||||
};
|
||||
|
||||
const getMastodonValue = (mastodonURL) => {
|
||||
const regex = /(https?:\/\/)?(www\.)?([^\s/]+)\/@(\w+)/;
|
||||
const getFormattedMastodonValue = (mastodonValue, isLink) => {
|
||||
const [username, server] = mastodonValue.split('@');
|
||||
|
||||
const match = mastodonURL.match(regex);
|
||||
|
||||
if (match) {
|
||||
const domain = match[3];
|
||||
const username = match[4];
|
||||
return `${domain}/@${username}`;
|
||||
if (isLink) {
|
||||
return `https://${server}/@${username}`;
|
||||
} else {
|
||||
return `${username}@${server}`;
|
||||
}
|
||||
|
||||
return mastodonURL;
|
||||
};
|
||||
|
||||
const getMastodonLink = (mastodonURL) => {
|
||||
return mastodonURL.replace(/^(https?:\/\/)?(www\.)?/, 'https://');
|
||||
};
|
||||
|
||||
const ListItem = ({ icon, title, value, link, skeleton = false }) => {
|
||||
@ -134,8 +126,8 @@ const Details = ({ profile, loading, social, github }) => {
|
||||
<ListItem
|
||||
icon={<FaMastodon className="mr-2" />}
|
||||
title="Mastodon:"
|
||||
value={getMastodonValue(social.mastodon)}
|
||||
link={getMastodonLink(social.mastodon)}
|
||||
value={getFormattedMastodonValue(social.mastodon, false)}
|
||||
link={getFormattedMastodonValue(social.mastodon, true)}
|
||||
/>
|
||||
)}
|
||||
{social?.linkedin && (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user