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