Skip to content

Commit

Permalink
fix(pages): fixed telegram link on voters page
Browse files Browse the repository at this point in the history
  • Loading branch information
AngeloCG97 committed Jan 3, 2023
1 parent 87a5f22 commit 0f7efce
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/Voters/Body/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ const Body: React.FC<BodyVoters> = ({ searchValue = '' }) => {
[rankSize]
)

const formatTelegramUserId = telegram => {
return telegram?.replace(
telegram?.includes('https://t.me/') ? 'https://t.me/' : '@',
''
)
}

useEffect(() => {
getMembers({
variables: {
Expand Down Expand Up @@ -106,14 +113,13 @@ const Body: React.FC<BodyVoters> = ({ searchValue = '' }) => {
<Image src={telegramLogo} height={14} width={14} />
<a
className={classes.aStyle}
href={`https://www.t.me/${delegate?.profile?.social?.telegram?.replace(
'@',
''
href={`https://www.t.me/${formatTelegramUserId(
delegate?.profile?.social?.telegram
)}`}
rel='noreferrer'
target='_blank'
>
{delegate?.profile?.social?.telegram?.replace('@', '')}
{formatTelegramUserId(delegate?.profile?.social?.telegram)}
</a>
</div>
}
Expand Down

0 comments on commit 0f7efce

Please sign in to comment.