mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-02-08 13:05:15 -05:00
* Remove unused pages / components * Add WrapItem around components inside Wrap component New version of Chakra requires WrapItem around any components that have Wrap * Update LoginButton to link to own profile and show Avatar (#285) * Update LoginButton to link to own profile and show Avatar * Change SetupUsername to explicitly mention "username"
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import { Button, Wrap, WrapItem } from '@metafam/ds';
|
|
import { PlayerFragmentFragment } from 'graphql/autogen/types';
|
|
import React from 'react';
|
|
import { FaEthereum, FaGithub, FaTwitter } from 'react-icons/fa';
|
|
|
|
import { formatAddress } from '../../utils/playerHelpers';
|
|
|
|
type Props = {
|
|
player: PlayerFragmentFragment;
|
|
};
|
|
|
|
export const PlayerContacts: React.FC<Props> = ({ player }) => {
|
|
return (
|
|
<Wrap>
|
|
{player.Accounts.map((acc) => {
|
|
if (acc.type === 'TWITTER') {
|
|
const link = `https://twitter.com/${acc.identifier}`;
|
|
return (
|
|
<WrapItem key={link}>
|
|
<Button
|
|
as="a"
|
|
href={link}
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
size="xs"
|
|
colorScheme="twitter"
|
|
leftIcon={<FaTwitter />}
|
|
>
|
|
{acc.identifier}
|
|
</Button>
|
|
</WrapItem>
|
|
);
|
|
}
|
|
if (acc.type === 'GITHUB') {
|
|
const link = `https://github.com/${acc.identifier}`;
|
|
return (
|
|
<WrapItem key={link}>
|
|
<Button
|
|
as="a"
|
|
href={link}
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
size="xs"
|
|
colorScheme="blackAlpha"
|
|
backgroundColor="black"
|
|
leftIcon={<FaGithub />}
|
|
>
|
|
{acc.identifier}
|
|
</Button>
|
|
</WrapItem>
|
|
);
|
|
}
|
|
return null;
|
|
})}
|
|
{player.ethereum_address ? (
|
|
<WrapItem>
|
|
<Button
|
|
as="a"
|
|
href={`https://etherscan.com/address/${player.ethereum_address}`}
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
size="xs"
|
|
colorScheme="blackAlpha"
|
|
leftIcon={<FaEthereum />}
|
|
>
|
|
{formatAddress(player.ethereum_address)}
|
|
</Button>
|
|
</WrapItem>
|
|
) : null}
|
|
</Wrap>
|
|
);
|
|
};
|