Skip to content

Commit

Permalink
Merge pull request #173 from chain4travel/suite
Browse files Browse the repository at this point in the history
Suite
  • Loading branch information
aeddaqqa authored Mar 6, 2024
2 parents 7846e01 + ca9c1e5 commit 685d3b2
Show file tree
Hide file tree
Showing 38 changed files with 648 additions and 396 deletions.
45 changes: 33 additions & 12 deletions src/app/Layout/MainLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Box, CircularProgress, Container, Typography } from '@mui/material'
import React, { useContext, useEffect } from 'react'
import { getActiveNetwork, selectAllChains, selectNetworkStatus } from 'store/app-config'
import { useAppDispatch, useAppSelector } from 'store/configureStore'

import { ColorModeContext } from '../../../styles/theme/ThemeProvider'
import Icon from '@mdi/react'
import { NavBar } from 'app/components/NavBar'
import { Outlet } from 'react-router-dom'
import { useAppDispatch, useAppSelector } from 'store/configureStore'
import { Typography, Box, CircularProgress, Container } from '@mui/material'
import { getActiveNetwork, selectAllChains, selectNetworkStatus } from 'store/app-config'
import PageContainer from 'app/components/PageContainer'
import { Status } from 'types'
import { getChains } from 'api'
import PageContainer from 'app/components/PageContainer'
import { ColorModeContext } from '../../../styles/theme/ThemeProvider'
import { mdiAccessPointNetworkOff } from '@mdi/js'
import { selectedTheme } from '../../../store/app-config'

const Content: React.FC = () => {
Expand Down Expand Up @@ -36,14 +39,32 @@ const Content: React.FC = () => {
gap: '20px',
}}
>
<Typography
variant="h4"
component="span"
fontWeight="fontWeightBold"
sx={{ color: 'error.light' }}
<Box
sx={{
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
maxWidth: '500px',
gap: '1rem',
}}
>
Something went wrong, Please Try Again!
</Typography>
<Icon path={mdiAccessPointNetworkOff} size={3} color="#94A2B8" />
<Typography variant="h4" component="span" fontWeight="fontWeightBold">
Something went wrong
</Typography>
<Typography
variant="body1"
component="span"
sx={{
textAlign: 'center',
color: theme => (theme.palette.mode === 'dark' ? '#CBD4E2' : '#64748B'),
}}
>
We have encountered an unexpected issue with our current system. For
uninterrupted service, switch over to the Camino Network.
</Typography>
</Box>
</Box>
</PageContainer>
)
Expand Down
16 changes: 9 additions & 7 deletions src/app/components/CamAmount.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import * as React from 'react'
import { Typography, Tooltip, Box } from '@mui/material'
import { ReactComponent as GasStationOutline } from './assets/gas-station-outline.svg'
import { ReactComponent as ACamIcon } from './assets/a-cam.svg'
import { ReactComponent as NCamIcon } from './assets/n-cam.svg'
import { ReactComponent as CamIcon } from './assets/cam.svg'

import { Box, Tooltip, Typography } from '@mui/material'
import {
getDisplayAmount,
getACamAmount,
customToLocaleString,
getACamAmount,
getDisplayAmount,
roundedToLocaleString,
} from '../../utils/currency-utils'

import { ReactComponent as ACamIcon } from './assets/a-cam.svg'
import { ReactComponent as CamIcon } from './assets/cam.svg'
import { ReactComponent as GasStationOutline } from './assets/gas-station-outline.svg'
import { ICamAmount } from 'types/filesInComponents'
import { ReactComponent as NCamIcon } from './assets/n-cam.svg'
import { useLocation } from 'react-router-dom'

export function AmountIcon({ currency }: { currency: string }) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/CopyTitleCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import DetailsField from 'app/components/DetailsField'
import Icon from '@mdi/react'
import OutlinedContainer from 'app/components/OutlinedContainer'
import OutlinedFilledContainer from 'app/components/OutlinedFilledContainer'
import DetailsField from 'app/components/DetailsField'
import React from 'react'

export default function CopyTitleCard({
label,
Expand Down
17 changes: 9 additions & 8 deletions src/app/components/DetailsField.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { mdiInformationOutline, mdiOpenInNew } from '@mdi/js'
import Icon from '@mdi/react'
import { Box, Button, Chip, Grid, Tooltip, Typography } from '@mui/material'
import React from 'react'
import { Link } from 'react-router-dom'
import { IDetailsField, IField } from 'types/filesInComponents'
import { roundedToLocaleString } from '../../utils/currency-utils'
import { mdiInformationOutline, mdiOpenInNew } from '@mdi/js'
import moment, { currentDateFormat } from '../../utils/helpers/moment'
import useWidth from '../hooks/useWidth'

import { CamAmount } from './CamAmount'
import CopyToClipboardButton from './CopyToClipboardButton'
import Icon from '@mdi/react'
import { Link } from 'react-router-dom'
import React from 'react'
import { roundedToLocaleString } from '../../utils/currency-utils'
import useWidth from '../hooks/useWidth'

function DetailsField({
field,
Expand Down Expand Up @@ -47,7 +48,7 @@ function DetailsField({
{!isMobile && (
<>
{tooltip?.toLowerCase() || getTooltip(field?.toLowerCase()) ? (
<Grid item xs={2}>
<Grid item xs={2} sx={{ display: 'grid', alignItems: 'center' }}>
<Tooltip title={getTooltip(field?.toLowerCase()) as string}>
{icon || (
<Icon
Expand All @@ -58,7 +59,7 @@ function DetailsField({
</Tooltip>
</Grid>
) : (
<Grid item xs={2}>
<Grid item xs={2} sx={{ display: 'grid', alignItems: 'center' }}>
{icon}
</Grid>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/FilledCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { FC } from 'react'

import { Paper } from '@mui/material'

interface BlockCardProps {
Expand All @@ -18,7 +19,6 @@ const FilledCard: FC<BlockCardProps> = React.forwardRef((props, ref) => {
gap: '10px',
display: 'flex',
flexDirection: 'column',
backgroundColor: 'primary.light',
backgroundImage: 'none',
}}
ref={ref}
Expand Down
7 changes: 5 additions & 2 deletions src/app/components/MainButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'

import { Button } from '@mui/material'

function MainButton({
Expand All @@ -17,13 +18,15 @@ function MainButton({
variant={variant}
onClick={onClick}
sx={{
borderRadius: '12px',
padding: '.55rem 2rem',
borderRadius: '8px',
padding: '0.55rem 2rem',
backgroundColor: variant === 'outlined' ? 'transparent' : 'secondary.main',
color: variant === 'outlined' ? 'secondary.main' : 'white',
borderColor: variant === 'outlined' ? 'secondary.main' : '',
boxShadow: 'none',
borderWidth: '1.5px',
textTransform: 'capitalize',
fontWeight: 600,
'&:hover': {
boxShadow: 'none',
backgroundColor: variant === 'outlined' ? 'transparent' : 'secondary.main',
Expand Down
23 changes: 9 additions & 14 deletions src/app/components/NavBar/Links.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useEffect, useState } from 'react'
import React, { useMemo } from 'react'
import { useLocation, useNavigate } from 'react-router-dom'

import Box from '@mui/material/Box'
import { ChainType } from 'utils/types/chain-type'
import { RoutesConfig } from 'utils/route-paths'
import { STATISTICS_LINK } from '../../../utils/types/statistics-type'
import Tab from '@mui/material/Tab'
import Tabs from '@mui/material/Tabs'
import { getChainTypeFromUrl } from 'utils/route-utils'
import { RoutesConfig } from 'utils/route-paths'
import { ChainType } from 'utils/types/chain-type'
import { STATISTICS_LINK } from '../../../utils/types/statistics-type'

function a11yProps(index: number) {
return {
Expand All @@ -32,22 +31,18 @@ const activeTab = (path: string): number => {
export default function Links() {
const routes = RoutesConfig()
const location = useLocation()
const [value, setValue] = useState(activeTab(getChainTypeFromUrl()))
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
if (location.pathname !== routes.MAINNET) {
if (newValue === 0) navigate(routes.CCHAIN)
else if (newValue === 1) navigate(routes.XCHAIN)
else if (newValue === 2) navigate(routes.PCHAIN)
else if (newValue === 5) navigate(routes.STATISTICS)
if (newValue !== 3 && newValue !== 4) setValue(newValue)
}
}
useEffect(() => {
if (location.pathname === routes.MAINNET) setValue(0)
else if (location.pathname === routes.CCHAIN) setValue(0)
else if (location.pathname === routes.XCHAIN) setValue(1)
else if (location.pathname === routes.PCHAIN) setValue(2)
else if (location.pathname === routes.STATISTICS) setValue(5)

const activeChainTab = useMemo(() => {
let activeChain = location.pathname.split('/')[3]
return activeTab(activeChain)
}, [location])

let navigate = useNavigate()
Expand All @@ -61,7 +56,7 @@ export default function Links() {
}}
>
<Tabs
value={value}
value={activeChainTab}
onChange={handleChange}
textColor="secondary"
// remove the underline
Expand Down
50 changes: 30 additions & 20 deletions src/app/components/NavBar/SearchInput.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
import React, { useEffect, useState } from 'react'
import OutlinedInput from '@mui/material/OutlinedInput'
import InputAdornment from '@mui/material/InputAdornment'
import SearchIcon from '@mui/icons-material/Search'
import {
Avatar,
ClickAwayListener,
ListItemIcon,
MenuItem,
MenuList,
useTheme,
} from '@mui/material'
import Box from '@mui/material/Box'
import Typography from '@mui/material/Typography'
import InputAdornment from '@mui/material/InputAdornment'
import Modal from '@mui/material/Modal'
import OutlinedInput from '@mui/material/OutlinedInput'
import Typography from '@mui/material/Typography'
import { getChainID } from 'api/utils'
import useWidth from 'app/hooks/useWidth'
import axios, { AxiosError, AxiosResponse } from 'axios'
import { MenuItem, MenuList, ListItemIcon, Avatar, ClickAwayListener } from '@mui/material'
import { useTheme } from '@mui/material'
import { ISearchMenu, SearchMenuItem } from 'types/search-menu'
import { debounce } from './utils/debounce'
import React, { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useAppSelector } from 'store/configureStore'
import { selectMagellanAddress } from 'store/app-config'
import { searchApi } from 'utils/magellan-api-utils'
import { useAppSelector } from 'store/configureStore'
import {
MagellanAddressResponse,
MagellanAddressSearchResult,
MagellanCBlockSearchResult,
MagellanCTransactionSearchResult,
MagellanSearchResultElementType,
MagellanXPTransactionSearchResult,
MagellanCTransactionSearchResult,
MagellanCBlockSearchResult,
MagellanAddressSearchResult,
MagellanAddressResponse,
} from 'types/magellan-types'
import { ISearchMenu, SearchMenuItem } from 'types/search-menu'
import { searchApi } from 'utils/magellan-api-utils'
import { RoutesConfig } from 'utils/route-paths'
import {
GetBlockDetailsPath,
GetAddressDetailsPath,
GetBlockDetailsPath,
GetTransactionDetailsPath,
} from 'utils/route-utils'

import { ChainType } from 'utils/types/chain-type'
import { getChainID } from 'api/utils'
import { RoutesConfig } from 'utils/route-paths'
import { debounce } from './utils/debounce'

function OutlinedSearchInput() {
const routesConfig = RoutesConfig()
Expand Down Expand Up @@ -241,9 +248,13 @@ function OutlinedSearchInput() {
height: '100%',
borderRadius: '8px',
p: '8px 16px',
backgroundColor: 'primary.light',
backgroundColor: 'card.background',
boxShadow: 0,
backgroundImage: 'none',
borderWidth: '1px',
borderColor: 'card.border',
borderStyle: 'solid',
color: 'primary.contrastText',
borderWidth: '0px',
fontSize: '15px',
lineHeight: '24px',
fontWeight: 500,
Expand Down Expand Up @@ -374,7 +385,6 @@ const SearchResultMenu = ({ children }: { children?: React.ReactNode }) => {
}

const SearchResultMenuList = ({ menuItems }: { menuItems: SearchMenuItem[] }) => {
console.log(menuItems)
const navigate = useNavigate()
return (
<MenuList>
Expand Down
1 change: 1 addition & 0 deletions src/app/components/OutlinedContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'

import { Box } from '@mui/material'

export default function OutlinedContainer({
Expand Down
6 changes: 4 additions & 2 deletions src/app/components/OverviewCards/OverviewCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Box, Card, CardContent, Typography } from '@mui/material'
import React, { FC } from 'react'
import { Card, CardContent, Box, Typography } from '@mui/material'
import { Status } from 'types'

import LoadingWrapper from 'app/components/LoadingWrapper'
import { Status } from 'types'

type OverviewCardProps = {
title: string
Expand Down Expand Up @@ -32,6 +33,7 @@ const OverviewCard: FC<OverviewCardProps> = ({
p: '1rem 2rem',
borderRadius: '12px',
cursor: onClick ? 'pointer' : 'default',
borderColor: 'card.border',
}}
onClick={onClick}
>
Expand Down
Loading

0 comments on commit 685d3b2

Please sign in to comment.