Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add smart contracts addresses to course info page #40

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 44 additions & 8 deletions packages/ui/src/Course/CourseInfo/CourseInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import {
Stack,
Text,
Image,
Icon,
} from '@chakra-ui/react'
import NextLink from 'next/link'
import { ChainSnapshotWebsite } from '@dae/chains'
import { ChainBlockExplorer, ChainSnapshotWebsite } from '@dae/chains'
import { FiLink, FiBook } from 'react-icons/fi'

export const CourseInfo: React.FC<any> = () => {
const { data, isLoading, error } = useCourseData()
Expand Down Expand Up @@ -56,34 +58,40 @@ export const CourseInfo: React.FC<any> = () => {
const snapshotWebsite =
ChainSnapshotWebsite[data.chain_id as keyof typeof ChainSnapshotWebsite]

const chainBlockExplorer =
ChainBlockExplorer[data.chain_id as keyof ChainBlockExplorer]

return (
<Box padding={8} borderRadius="xl" bg={'white'} boxShadow={'md'}>
<Stack
spacing={8}
spacing={12}
borderRadius="xl"
direction={{ base: 'column', lg: 'row' }}
>
<Center width={{ base: '100%', lg: '30%' }}>
<Image
src={data.image_url}
alt="Green double couch with wooden legs"
borderRadius="lg"
maxHeight={{ base: '300px', lg: '500px' }}
/>
</Center>
<Stack spacing={8} width={'100%'}>
<Stack spacing={4}>
<Stack spacing={2}>
<Box>
<Text fontSize={'3xl'} fontWeight={'semibold'}>
{data.name}
</Text>
</Box>
<Box>
<Text fontWeight={'normal'}>{data.description}</Text>
<Text fontSize={'md'}>{data.description}</Text>
</Box>
</Stack>
<Stack>
<Text fontWeight={'semibold'}>
<Text fontWeight={'semibold'} fontSize={'lg'}>
<Icon as={FiLink} mr={2} boxSize={4} />
Links
</Text>
<Text fontWeight={'medium'}>
Website:{' '}
<Link
fontWeight={'normal'}
Expand All @@ -95,7 +103,7 @@ export const CourseInfo: React.FC<any> = () => {
</Link>
</Text>
{data.media_channel ? (
<Text fontWeight={'semibold'}>
<Text fontWeight={'medium'}>
Media Channel:{' '}
<Link
fontWeight={'normal'}
Expand All @@ -109,7 +117,7 @@ export const CourseInfo: React.FC<any> = () => {
) : (
<></>
)}
<Text fontWeight={'semibold'}>
<Text fontWeight={'medium'}>
Snapshot Space:{' '}
<Link
href={`${snapshotWebsite}/#/${data.snapshot_space_ens}`}
Expand All @@ -121,6 +129,34 @@ export const CourseInfo: React.FC<any> = () => {
</Link>
</Text>
</Stack>
<Stack>
<Text fontWeight={'semibold'} fontSize={'lg'}>
<Icon as={FiBook} mr={2} boxSize={4} />
Smart Contracts
</Text>
<Text fontWeight={'medium'}>
Course:{' '}
<Link
fontWeight={'normal'}
href={`${chainBlockExplorer}/address/${data.address}`}
as={NextLink}
target="_blank"
>
{data.address}
</Link>
</Text>
<Text fontWeight={'medium'}>
Karma:{' '}
<Link
href={`${chainBlockExplorer}/address/${data.karma_access_control_address}`}
as={NextLink}
target="_blank"
fontWeight={'normal'}
>
{data.karma_access_control_address}
</Link>
</Text>
</Stack>
</Stack>
</Stack>
</Box>
Expand Down
Loading