From e8d02563598b773dbc482684f52ae08b484c335e Mon Sep 17 00:00:00 2001 From: wilson Date: Thu, 15 Feb 2024 21:46:02 +0000 Subject: [PATCH 1/3] Fixed the social media icon fucntonality --- .../Profile/SocialIcons/SocialIcons.jsx | 77 +++++++++++++------ 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/src/components/Profile/SocialIcons/SocialIcons.jsx b/src/components/Profile/SocialIcons/SocialIcons.jsx index e0b308c5..d291a341 100644 --- a/src/components/Profile/SocialIcons/SocialIcons.jsx +++ b/src/components/Profile/SocialIcons/SocialIcons.jsx @@ -8,6 +8,8 @@ import LinkedInIcon from "@mui/icons-material/LinkedIn"; import GitHubIcon from "@mui/icons-material/GitHub"; import TwitterIcon from "@mui/icons-material/Twitter"; import LinkIcon from "@mui/icons-material/Link"; +import { useSelector } from "react-redux"; + const useStyles = makeStyles(theme => ({ root: { @@ -32,34 +34,65 @@ const useStyles = makeStyles(theme => ({ export default function SocialIcons(props) { const classes = useStyles(); + const profileData = useSelector(({ firebase: { profile } }) => profile); + + console.log(profileData) + + const openSocialMediaLink = (link) => { + window.open(link, "_blank"); + }; + + + const copyPageUrlToClipboard = () => { + const pageUrl = window.location.href; + navigator.clipboard.writeText(pageUrl) + .then(() => { + alert("Profile link copied to clipboard!"); + }) + .catch((error) => { + console.error("Error copying page URL to clipboard:", error); + }); + }; + return ( - - - - openSocialMediaLink(`https://facebook.com/${profileData.link_facebook}`)} + > + + + } + {profileData?.link_linkedin != "" && + - - - - - - - - - + onClick={() => openSocialMediaLink(`https://linkedin.com/in/${profileData.link_linkedin}`)} + > + + + } + {profileData?.link_github != "" && + openSocialMediaLink(`https://github.com/${profileData.link_github}`)} data-testId="GithubIcon"> + + + } + {profileData?.link_twitter != "" && + openSocialMediaLink(`https://twitter.com/${profileData.link_twitter}`)} + > + + + } + From 6b813f01a64f69a4bd3fc39a7d1af25274d8dded Mon Sep 17 00:00:00 2001 From: wilson Date: Thu, 15 Feb 2024 21:49:26 +0000 Subject: [PATCH 2/3] Revert "Fixed the social media icon fucntonality" This reverts commit e8d02563598b773dbc482684f52ae08b484c335e. --- .../Profile/SocialIcons/SocialIcons.jsx | 77 ++++++------------- 1 file changed, 22 insertions(+), 55 deletions(-) diff --git a/src/components/Profile/SocialIcons/SocialIcons.jsx b/src/components/Profile/SocialIcons/SocialIcons.jsx index d291a341..e0b308c5 100644 --- a/src/components/Profile/SocialIcons/SocialIcons.jsx +++ b/src/components/Profile/SocialIcons/SocialIcons.jsx @@ -8,8 +8,6 @@ import LinkedInIcon from "@mui/icons-material/LinkedIn"; import GitHubIcon from "@mui/icons-material/GitHub"; import TwitterIcon from "@mui/icons-material/Twitter"; import LinkIcon from "@mui/icons-material/Link"; -import { useSelector } from "react-redux"; - const useStyles = makeStyles(theme => ({ root: { @@ -34,65 +32,34 @@ const useStyles = makeStyles(theme => ({ export default function SocialIcons(props) { const classes = useStyles(); - const profileData = useSelector(({ firebase: { profile } }) => profile); - - console.log(profileData) - - const openSocialMediaLink = (link) => { - window.open(link, "_blank"); - }; - - - const copyPageUrlToClipboard = () => { - const pageUrl = window.location.href; - navigator.clipboard.writeText(pageUrl) - .then(() => { - alert("Profile link copied to clipboard!"); - }) - .catch((error) => { - console.error("Error copying page URL to clipboard:", error); - }); - }; - return ( - {profileData?.link_facebook != "" && - openSocialMediaLink(`https://facebook.com/${profileData.link_facebook}`)} - > - - - } - {profileData?.link_linkedin != "" && - + + + openSocialMediaLink(`https://linkedin.com/in/${profileData.link_linkedin}`)} - > - - - } - {profileData?.link_github != "" && - openSocialMediaLink(`https://github.com/${profileData.link_github}`)} data-testId="GithubIcon"> - - - } - {profileData?.link_twitter != "" && - openSocialMediaLink(`https://twitter.com/${profileData.link_twitter}`)} - > - - - } - + > + + + + + + + + + From 39cbc328c21f310f9f1275baec13fe738fae1828 Mon Sep 17 00:00:00 2001 From: wilson Date: Thu, 15 Feb 2024 21:52:54 +0000 Subject: [PATCH 3/3] Fixed social media functionality --- .../Profile/SocialIcons/SocialIcons.jsx | 77 +++++++++++++------ 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/src/components/Profile/SocialIcons/SocialIcons.jsx b/src/components/Profile/SocialIcons/SocialIcons.jsx index e0b308c5..d291a341 100644 --- a/src/components/Profile/SocialIcons/SocialIcons.jsx +++ b/src/components/Profile/SocialIcons/SocialIcons.jsx @@ -8,6 +8,8 @@ import LinkedInIcon from "@mui/icons-material/LinkedIn"; import GitHubIcon from "@mui/icons-material/GitHub"; import TwitterIcon from "@mui/icons-material/Twitter"; import LinkIcon from "@mui/icons-material/Link"; +import { useSelector } from "react-redux"; + const useStyles = makeStyles(theme => ({ root: { @@ -32,34 +34,65 @@ const useStyles = makeStyles(theme => ({ export default function SocialIcons(props) { const classes = useStyles(); + const profileData = useSelector(({ firebase: { profile } }) => profile); + + console.log(profileData) + + const openSocialMediaLink = (link) => { + window.open(link, "_blank"); + }; + + + const copyPageUrlToClipboard = () => { + const pageUrl = window.location.href; + navigator.clipboard.writeText(pageUrl) + .then(() => { + alert("Profile link copied to clipboard!"); + }) + .catch((error) => { + console.error("Error copying page URL to clipboard:", error); + }); + }; + return ( - - - - openSocialMediaLink(`https://facebook.com/${profileData.link_facebook}`)} + > + + + } + {profileData?.link_linkedin != "" && + - - - - - - - - - + onClick={() => openSocialMediaLink(`https://linkedin.com/in/${profileData.link_linkedin}`)} + > + + + } + {profileData?.link_github != "" && + openSocialMediaLink(`https://github.com/${profileData.link_github}`)} data-testId="GithubIcon"> + + + } + {profileData?.link_twitter != "" && + openSocialMediaLink(`https://twitter.com/${profileData.link_twitter}`)} + > + + + } +