|
| 1 | +import { FC } from 'react' |
| 2 | +import { Link as RouterLink } from 'react-router-dom' |
| 3 | +import { useTranslation } from 'react-i18next' |
| 4 | +import { ArrowRight } from 'lucide-react' |
| 5 | +import { useGetRuntimeStatus } from '../../../oasis-nexus/api' |
| 6 | +import { Button } from '@oasisprotocol/ui-library/src/components/ui/button' |
| 7 | +import { Tooltip } from '@oasisprotocol/ui-library/src/components/tooltip' |
| 8 | +import { Link } from '@oasisprotocol/ui-library/src/components/link' |
| 9 | +import { RouteUtils } from '../../utils/route-utils' |
| 10 | +import { useRuntimeFreshness } from '../../components/OfflineBanner/hook' |
| 11 | +import { pontusx } from '../../utils/externalLinks' |
| 12 | +import { EcosystemCard } from './EcosystemCard' |
| 13 | +import pontusxBg from './images/pontusx-bg.svg' |
| 14 | + |
| 15 | +export const PontusXCard: FC = () => { |
| 16 | + const { t } = useTranslation() |
| 17 | + const pontusxStatusQuery = useGetRuntimeStatus('testnet', 'pontusxtest') |
| 18 | + const { outOfDate: pontusxOutOfDate } = useRuntimeFreshness({ |
| 19 | + network: 'testnet', |
| 20 | + layer: 'pontusxtest', |
| 21 | + }) |
| 22 | + |
| 23 | + return ( |
| 24 | + <EcosystemCard |
| 25 | + isLoading={pontusxStatusQuery.isLoading} |
| 26 | + description={ |
| 27 | + <> |
| 28 | + {t('home.ecosystem.pontusx')} <span className="italic">{t('home.ecosystem.comingSoon')}</span> |
| 29 | + </> |
| 30 | + } |
| 31 | + title={ |
| 32 | + <span> |
| 33 | + {t('common.pontusx')}{' '} |
| 34 | + <span className="text-sm text-muted-foreground font-normal"> |
| 35 | + {t('home.ecosystem.by')} |
| 36 | + <Tooltip |
| 37 | + title={ |
| 38 | + <> |
| 39 | + {t('home.ecosystem.deltaDAODescription')}{' '} |
| 40 | + <Link |
| 41 | + textColor="inherit" |
| 42 | + variant="underline" |
| 43 | + href={pontusx.homepage} |
| 44 | + rel="noopener noreferrer" |
| 45 | + target="_blank" |
| 46 | + > |
| 47 | + {t('home.ecosystem.visitSite')} |
| 48 | + </Link> |
| 49 | + </> |
| 50 | + } |
| 51 | + > |
| 52 | + <span className="italic underline">{t('home.ecosystem.deltaDAO')}</span> |
| 53 | + </Tooltip> |
| 54 | + </span> |
| 55 | + </span> |
| 56 | + } |
| 57 | + background={pontusxBg} |
| 58 | + layer="pontusxtest" |
| 59 | + outOfDate={pontusxOutOfDate} |
| 60 | + latestBlock={pontusxStatusQuery?.data?.data?.latest_block} |
| 61 | + activeNodes={pontusxStatusQuery?.data?.data?.active_nodes} |
| 62 | + footer={ |
| 63 | + <> |
| 64 | + <Button variant="secondary" size="lg" className="flex-1"> |
| 65 | + <RouterLink to={RouteUtils.getDashboardRoute({ network: 'testnet', layer: 'pontusxtest' })}> |
| 66 | + {t('common.testnet')} |
| 67 | + </RouterLink> |
| 68 | + <ArrowRight /> |
| 69 | + </Button> |
| 70 | + <Button variant="link" size="lg" className="flex-1"> |
| 71 | + <RouterLink to={RouteUtils.getDashboardRoute({ network: 'testnet', layer: 'pontusxdev' })}> |
| 72 | + {t('common.devnet')} |
| 73 | + </RouterLink> |
| 74 | + </Button> |
| 75 | + </> |
| 76 | + } |
| 77 | + /> |
| 78 | + ) |
| 79 | +} |
| 80 | + |
| 81 | +export const PontusXFallbackCard: FC = () => { |
| 82 | + const { t } = useTranslation() |
| 83 | + |
| 84 | + return ( |
| 85 | + <EcosystemCard |
| 86 | + description={t('home.ecosystem.pontusx')} |
| 87 | + title={t('common.pontusx')} |
| 88 | + background={pontusxBg} |
| 89 | + layer="pontusxtest" |
| 90 | + /> |
| 91 | + ) |
| 92 | +} |
0 commit comments