import React, { useState, useEffect } from 'react'
import styled from 'styled-components'
import { useDispatch } from 'react-redux'
import { uccnDetail, indexInfo } from 'services/user'
import { Flex, Heading, Text, Box, Button, Image, Link, useModal } from '@pancakeswap/uikit'
import { useTranslation } from 'contexts/Localization'
import { usePriceHccUsdt } from 'state/hooks'
import UnOpenModel from './UnOpenModel'
import FlexItemCom from './FlexItemCom'
const FirstPage = styled.div`
background-image: url('/images/home/bg.svg');
background-size: cover;
background-repeat: no-repeat;
padding: 0.9rem 0 0.8rem 0;
`
const StyledPage = styled(Box)`
padding-top: 16px;
padding-bottom: 16px;
${({ theme }) => theme.mediaQueries.sm} {
padding-top: 24px;
padding-bottom: 24px;
width: 80%;
}
${({ theme }) => theme.mediaQueries.lg} {
padding-top: 32px;
padding-bottom: 32px;
width: 80%;
}
`
const HeaderText = styled(Text)`
font-size: 52px;
color: #1fc7d4;
margin-bottom: 20px;
`
const DetailText = styled(Text)`
font-size: 18px;
color: #666666;
`
const FlexDiv = styled(Flex)`
justify-content: space-between;
align-items: center;
flex-direction: row-reverse;
flex-wrap: wrap;
${({ theme }) => theme.mediaQueries.xs} {
justify-content: center;
}
${({ theme }) => theme.mediaQueries.lg} {
}
`
const ImageDiv = styled.img`
${({ theme }) => theme.mediaQueries.xs} {
justify-content: center;
width: 215px;
height: 215px;
margin-bottom: 20px;
}
${({ theme }) => theme.mediaQueries.lg} {
width: 315px;
height: 315px;
margin-bottom: 0px;
}
`
const BtnFlex = styled(Flex)`
align-items: center;
flex-wrap: wrap;
margin-top: 60px;
${({ theme }) => theme.mediaQueries.xs} {
margin-top: 30px;
}
${({ theme }) => theme.mediaQueries.lg} {
margin-top: 60px;
}
`
const RadiusBtn = styled(Link)`
border-radius: 50px;
width: 170px;
height: 60px;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20px;
margin-bottom: 10px;
color: #fff;
text-align: center;
background: linear-gradient(269deg, #1fc8d3 0%, #1fd4b0 100%);
${({ theme }) => theme.mediaQueries.xs} {
width: 140px;
height: 50px;
}
${({ theme }) => theme.mediaQueries.lg} {
width: 170px;
height: 60px;
}
`
const WhiteBtn = styled(Button)`
border-radius: 50px;
width: 140px;
height: 30px;
border: 1px solid #1fc7d4;
color: #1fc7d4;
background-color: #fff;
margin: 0px 35px 10px 0;
${({ theme }) => theme.mediaQueries.xs} {
width: 140px;
height: 50px;
}
${({ theme }) => theme.mediaQueries.lg} {
width: 170px;
height: 60px;
}
`
const BtnImage = styled(Image)`
width: 34px;
height: 34px;
border-radius: 50%;
margin-right: 12px;
cursor: pointer;
& > img {
border-radius: 50%;
}
`
const ScoreDiv = styled(Flex)`
margin-top: 118px;
background: #fff;
box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.15);
opacity: 1;
border-radius: 15px;
padding: 44px 0;
justify-content: space-between;
display: none;
${({ theme }) => theme.mediaQueries.xs} {
margin-top: 50px;
padding: 30px 0;
flex-direction: column;
}
${({ theme }) => theme.mediaQueries.lg} {
margin-top: 127px;
padding: 59px 0;
flex-direction: unset;
}
`
const InfoDiv = styled.div``
const FristCom: React.FC = () => {
const { t } = useTranslation()
const dispatch = useDispatch()
const [detail, setDetail] = useState({
externalLinkList: [],
userCount: '',
volume: '',
market: 0,
})
const [onUnOpenModel] = useModal()
const hccPriceUsdt = usePriceHccUsdt()
const [linkList, setLinkList] = useState([])
const getDetail = async () => {
const data = await indexInfo()
const list = data.externalLinkList.map((item, index) => {
const links = Object.keys(item.linkMap).map((key) => {
return { name: key, link: item.linkMap[key], icon: item.iconResource.url }
})
return { icon: item.iconResource.url, name: item.name, list: links, key: index + item.name }
})
setLinkList(list)
setDetail(data)
}
useEffect(() => {
getDetail()
}, [])
const openLink = (link) => {
window.open(link)
}
return (
<>
Hi City Coin
{/*
Hi City Coin
*/}
{t('Hcc Info')}
{t('Hcc Nft')}
{t('Hcc BTC')}
{t('IDO Exchange')}
{t('social contact demo')}
{linkList?.map((item, index) => {
return index < 6 ? (
openLink(item.list[0].link)}
/>
) : (
''
)
})}
>
)
}
export default FristCom