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

fix: minor design changes #194

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
18 changes: 6 additions & 12 deletions src/components/ExplorerTable/ExplorerTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@ import React from "react"
import { Table, TableHead, TableCell, TableBody, TableRow, CircularProgress } from "@mui/material"
import clsx from "clsx"
import { Link } from "react-router-dom"
import {
EnvironmentMetadata,
EvmBridgeConfig,
ExplorerContextState,
ResourceTypes,
SharedConfigDomain,
Transfer,
TransferStatus,
} from "../../types"
import { EnvironmentMetadata, EvmBridgeConfig, ExplorerContextState, ResourceTypes, SharedConfigDomain, Transfer, TransferStatus } from "../../types"
import { renderNetworkIcon, renderStatusIcon } from "../../utils/renderUtils"
import {
filterTransfers,
Expand Down Expand Up @@ -44,7 +36,7 @@ const ExplorerTable: React.FC<ExplorerTable> = ({ state, domainMetadata }: Explo
const { deposit, amount, resource, fromDomainId, toDomainId, id, resourceID, fee, usdValue, timestamp } = transfer
let { status } = transfer

if (deposit && deposit.timestamp && status === "pending" && isAfter(Date.now(), add(new Date(deposit.timestamp), {hours: 2}))) {
if (deposit && deposit.timestamp && status === "pending" && isAfter(Date.now(), add(new Date(deposit.timestamp), { hours: 2 }))) {
status = "failed" as TransferStatus
}

Expand Down Expand Up @@ -90,7 +82,7 @@ const ExplorerTable: React.FC<ExplorerTable> = ({ state, domainMetadata }: Explo
</TableCell>
<TableCell className={clsx(classes.row, classes.dataRow)}>
<div className={classes.accountAddress}>
<span className={classes.statusPill}>
<span>
{renderStatusIcon(status, classes)} {displayStatus(status)}
</span>
</div>
Expand All @@ -112,7 +104,9 @@ const ExplorerTable: React.FC<ExplorerTable> = ({ state, domainMetadata }: Explo
<TableCell className={clsx(classes.row, classes.dataRow)}>
<span className={classes.amountInfo}>
<span>
{type !== undefined ? formatTransferType(resourceID !== VITE_NATIVE_TOKEN_TRANSFER_RESOURCE_ID ? (type as ResourceTypes) : ResourceTypes.NATIVE) : "-"}
{type !== undefined
? formatTransferType(resourceID !== VITE_NATIVE_TOKEN_TRANSFER_RESOURCE_ID ? (type as ResourceTypes) : ResourceTypes.NATIVE)
: "-"}
</span>
</span>
</TableCell>
Expand Down
1 change: 1 addition & 0 deletions src/components/ExplorerTable/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const useStyles = makeStyles()(theme => {
},
},
row: {
padding: "20px",
fontWeight: 400,
fontSize: 14,
verticalAlign: "middle",
Expand Down
32 changes: 12 additions & 20 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
import { AppBar, Box, Container, Toolbar, Typography } from "@mui/material"
import { useStyles } from "./styles"
import TopBarNetworkConnect from "../TopBarNetworkComponent"
import { useExplorer } from "../../context"
import { useStyles } from "./styles"

export default function Header() {
const { classes } = useStyles()
const explorerContext = useExplorer()
const { explorerContextState } = explorerContext

return (
<AppBar position="static" color="transparent" className={classes.root}>
<Container maxWidth="xl" className={classes.mainAppBar}>
<Toolbar disableGutters className={classes.toolBar}>
<div className={classes.title}>
<a href="/" className={classes.logo}>
<img src="/assets/images/logo1.svg" alt="logo" />
</a>
<Box
sx={{
display: { xs: "flex", sm: "flex", md: "flex" },
height: 70,
}}
>
<Typography variant="h3" className={classes.titleContent}>
Sygma Protocol Explorer
</Typography>
</Box>
</div>
</Toolbar>
<div className={classes.connectButtonContainer}>
<Box display={"flex"} flexGrow={"2"}>
<a href="/" className={classes.logo}>
<img src="/assets/images/logo1.svg" alt="logo" />
</a>
<Typography marginTop={"5px"} variant="h5" className={classes.titleContent}>
Sygma Protocol Explorer
</Typography>
</Box>
<Box display={"flex"} flexGrow={"1"} justifyContent={"end"}>
<TopBarNetworkConnect
walletConnecting={false}
homeConfig={undefined}
Expand All @@ -39,7 +31,7 @@ export default function Header() {
explorerContextDispatcher={explorerContext.explorerContextDispatcher}
explorerContextState={explorerContextState}
/>
</div>
</Box>
</Container>
</AppBar>
)
Expand Down
1 change: 1 addition & 0 deletions src/components/Header/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const useStyles = makeStyles()(theme => {
flexDirection: "row",
justifyContent: "space-between",
marginTop: 25,
marginBottom: 25,
},
toolBar: {
display: "flex",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function TopBarNetworkConnect({ getAccount, getChainId, chainId,
<section className={classes.state}>
{window.ethereum !== undefined &&
(!isReady ? (
<Button fullWidth variant="contained" onClick={handleClickOpen} sx={{ px: 3, fontSize: 18 }}>
<Button fullWidth variant="contained" onClick={handleClickOpen} sx={{ px: 3 }}>
Connect Wallet
</Button>
) : (
Expand All @@ -82,13 +82,13 @@ export default function TopBarNetworkConnect({ getAccount, getChainId, chainId,
borderRadius: 10,
}}
>
<Typography variant="h6" className={classes.address}>
<Typography variant="button" className={classes.address}>
{currentChainId !== undefined && (
<img src={`/assets/icons/${getIconNamePerChainId(currentChainId)}`} alt={"native token icon"} className={classes.indicator} />
)}
</Typography>
<div className={classes.accountInfo}>
<Typography variant="h6" className={classes.address}>
<Typography variant="button" textTransform={"lowercase"} className={classes.address}>
{shortenAddress(localAddress!)}
</Typography>
<div className={classes.logoutContainer}>
Expand Down
6 changes: 2 additions & 4 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
}
8 changes: 4 additions & 4 deletions src/pages/ExplorerPage/ExplorerPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from "react"
import { Alert, Button, Container, Paper } from "@mui/material"
import { Alert, Box, Button, Container, Paper } from "@mui/material"

import { ethers } from "ethers"
import { ExplorerTable } from "../../components"
Expand Down Expand Up @@ -38,11 +38,11 @@ const ExplorerPage = (): JSX.Element => {

return (
<Container sx={{ display: "grid", gridTemplateRows: "1fr 15fr" }}>
<div>
<Button variant="contained" className={classes.refreshTableButton} onClick={handleRefreshTable}>
<Box display={"flex"} justifyContent={"end"} marginBottom={"10px"}>
<Button variant="contained" onClick={handleRefreshTable}>
Refresh Table
</Button>
</div>
</Box>
<Paper
elevation={3}
sx={{
Expand Down
Loading