Skip to content

Commit

Permalink
Update code open link social
Browse files Browse the repository at this point in the history
  • Loading branch information
anhnhu committed Jun 26, 2024
1 parent 67bc896 commit 48ba966
Showing 1 changed file with 77 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,95 @@
// SPDX-License-Identifier: Apache-2.0

import { AirdropCampaign } from '@subwallet/extension-koni-ui/connector/booka/types';
import { TelegramConnector } from '@subwallet/extension-koni-ui/connector/telegram';
import useTranslation from '@subwallet/extension-koni-ui/hooks/common/useTranslation';
import { ThemeProps } from '@subwallet/extension-koni-ui/types';
import { Button, Icon } from '@subwallet/react-ui';
import CN from 'classnames';
import { TelegramLogo } from 'phosphor-react';
import React from 'react';
import { Browser, TelegramLogo, TwitterLogo } from 'phosphor-react';
import React, { useCallback, useMemo } from 'react';
import styled from 'styled-components';

type Props = ThemeProps & {
airdropInfo: AirdropCampaign
};
const telegramConnector = TelegramConnector.instance;

function Component ({ airdropInfo, className }: Props) {
const { t } = useTranslation();

const openLink = useCallback((link: string) => {
telegramConnector.openLink(link);
}, []);

const buttons = useMemo(() => {
if (airdropInfo.network === 'karura') {
return <>
<Button
icon={(
<Icon
customSize={'16px'}
phosphorIcon={TelegramLogo}
weight={'fill'}
/>
)}
size='xs'
type='ghost'
/>
</>;
}

return (
<>

<Button
icon={(
<Icon
customSize={'16px'}
phosphorIcon={TwitterLogo}
weight={'fill'}
/>
)}
onClick={() => {
openLink('https://twitter.com/dotisded');
}}
size='xs'
type='ghost'
/>

<Button
icon={(
<Icon
customSize={'16px'}
phosphorIcon={TelegramLogo}
weight={'fill'}
/>
)}
onClick={() => {
openLink('https://t.co/bVwz9Afllz');
}}
size='xs'
type='ghost'
/>

<Button
icon={(
<Icon
customSize={'16px'}
phosphorIcon={Browser}
weight={'fill'}
/>
)}
onClick={() => {
openLink('https://www.dotisded.io/');
}}
size='xs'
type='ghost'
/>
</>
);
}, [airdropInfo]);

return (
<div className={CN(className)}>
<div className='__dynamic-content-wrapper'>
Expand Down Expand Up @@ -48,18 +122,7 @@ function Component ({ airdropInfo, className }: Props) {
<div className='__social-label'>
{t('Social')}:
</div>

<Button
icon={(
<Icon
customSize={'16px'}
phosphorIcon={TelegramLogo}
weight={'fill'}
/>
)}
size='xs'
type='ghost'
/>
{buttons}
</div>
</div>
</div>
Expand Down

0 comments on commit 48ba966

Please sign in to comment.