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

🌓 Dark mode fixes #599

Merged
merged 13 commits into from
Sep 7, 2023
Merged
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
1 change: 1 addition & 0 deletions src/components/Forms/FormikInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const FormikInput: FC<
isInvalid={isError}
errorBorderColor="red.300"
placeholder={placeholder}
_placeholder={{ color: useColorModeValue("gray.400", "gray.500") }}
{...field}
value={meta.value}
/>
Expand Down
10 changes: 8 additions & 2 deletions src/components/OutlineListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { FC } from "react"
import { ListItem, ListItemProps } from "@threshold-network/components"
import {
ListItem,
ListItemProps,
useColorModeValue,
} from "@threshold-network/components"

export const OutlineListItem: FC<ListItemProps> = ({ ...props }) => {
const borderColor = useColorModeValue("gray.100", "gray.700")

return (
<ListItem
display="flex"
justifyContent="space-between"
alignItems="center"
borderColor="gray.100"
borderColor={borderColor}
borderWidth="1px"
borderStyle="solid"
borderRadius="6px"
Expand Down
7 changes: 5 additions & 2 deletions src/components/Step/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Badge,
ImageProps,
Image,
useColorModeValue,
} from "@threshold-network/components"

type Sizes = "sm" | "md" | "lg"
Expand Down Expand Up @@ -125,6 +126,7 @@ export const Step: FC<StepProps> = ({
...restProps
}) => {
const { size } = useStepsContext()
const activeBorderColor = useColorModeValue("brand.500", "brand.300")

return (
<StepContext.Provider
Expand All @@ -139,7 +141,7 @@ export const Step: FC<StepProps> = ({
w="full"
borderLeftWidth="4px"
borderLeftStyle="solid"
borderColor={isActive || isComplete ? "brand.500" : "gray.300"}
borderColor={isActive || isComplete ? activeBorderColor : "gray.300"}
{...restProps}
>
{children}
Expand All @@ -153,11 +155,12 @@ export const StepIndicator: FC<ComponentProps<typeof LabelSm>> = ({
...restProps
}) => {
const { size } = useStepContext()
const textColor = useColorModeValue("brand.500", "brand.300")

const Label = stepSizeMap[size].label.component

return (
<Label color="brand.500" {...restProps}>
<Label color={textColor} {...restProps}>
{children}
</Label>
)
Expand Down
15 changes: 12 additions & 3 deletions src/components/TransactionDetails/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { ComponentProps, FC } from "react"
import { BodySm, ListItem, Skeleton } from "@threshold-network/components"
import {
BodySm,
ListItem,
Skeleton,
useColorModeValue,
} from "@threshold-network/components"
import { InlineTokenBalance } from "../TokenBalance"

type TransactionDetailsItemProps = {
Expand All @@ -12,10 +17,12 @@ export const TransactionDetailsItem: FC<TransactionDetailsItemProps> = ({
value,
children,
}) => {
const valueTextColor = useColorModeValue("gray.700", "gray.300")

return (
<ListItem display="flex" justifyContent="space-between" alignItems="center">
<BodySm color="gray.500">{label}</BodySm>
{value ? <BodySm color="gray.700">{value}</BodySm> : children}
{value ? <BodySm color={valueTextColor}>{value}</BodySm> : children}
</ListItem>
)
}
Expand All @@ -29,10 +36,12 @@ type TransactionDetailsAmountItemProps = Omit<
export const TransactionDetailsAmountItem: FC<
TransactionDetailsAmountItemProps
> = ({ label, tokenAmount, ...restProps }) => {
const tokenBalanceTextColor = useColorModeValue("gray.700", "gray.300")

return (
<TransactionDetailsItem label={label}>
<Skeleton isLoaded={!!tokenAmount}>
<BodySm color="gray.700">
<BodySm color={tokenBalanceTextColor}>
<InlineTokenBalance
withSymbol
tokenAmount={tokenAmount || "0"}
Expand Down
5 changes: 4 additions & 1 deletion src/components/tBTC/RecentDeposits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
LinkBox,
LinkOverlay,
Link,
useColorModeValue,
} from "@threshold-network/components"
import shortenAddress from "../../utils/shortenAddress"
import Identicon from "../Identicon"
Expand Down Expand Up @@ -38,6 +39,8 @@ const RecentDepositItem: FC<RecentDeposit> = ({
date,
txHash,
}) => {
const tokenBalanceTextColor = useColorModeValue("brand.500", "brand.300")

return (
<LinkBox as={OutlineListItem}>
<LinkOverlay
Expand All @@ -63,7 +66,7 @@ const RecentDepositItem: FC<RecentDeposit> = ({
tokenAmount={amount}
withSymbol
tokenSymbol="tBTC"
color="brand.500"
color={tokenBalanceTextColor}
/>
</BodySm>
</LinkOverlay>
Expand Down
12 changes: 8 additions & 4 deletions src/pages/tBTC/Bridge/DepositDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ import {
LabelSm,
List,
ListItem,
Skeleton,
Stack,
StackDivider,
Icon,
Divider,
SkeletonText,
SkeletonCircle,
BodySm,
BodyXs,
Alert,
AlertDescription,
AlertIcon,
useColorModeValue,
} from "@threshold-network/components"
import { IoCheckmarkSharp, IoTime as TimeIcon } from "react-icons/all"
import { InlineTokenBalance } from "../../../components/TokenBalance"
Expand Down Expand Up @@ -90,6 +88,8 @@ export const DepositDetails: PageComponent = () => {
const { mintingRequestedTxHash, mintingFinalizedTxHash } =
useSubscribeToOptimisticMintingEvents(depositKey)

const depositStatusTextColor = useColorModeValue("brand.500", "brand.300")

// Cache the location state in component state.
const [locationStateCache] = useState<{ shouldStartFromFirstStep?: boolean }>(
(state as { shouldStartFromFirstStep?: boolean }) || {}
Expand Down Expand Up @@ -208,7 +208,11 @@ export const DepositDetails: PageComponent = () => {
<BridgeProcessCardTitle />
<Flex mb="4" alignItems="center" textStyle="bodyLg">
<BodyLg>
<Box as="span" fontWeight="600" color="brand.500">
<Box
as="span"
fontWeight="600"
color={depositStatusTextColor}
>
{mintingProgressStep === "completed"
? "Minted"
: "Minting"}
Expand Down
10 changes: 8 additions & 2 deletions src/pages/tBTC/Bridge/Minting/ProvideData.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { FC, Ref, useRef, useState } from "react"
import { FormikErrors, FormikProps, withFormik } from "formik"
import { Button, BodyMd } from "@threshold-network/components"
import {
Button,
BodyMd,
useColorModeValue,
} from "@threshold-network/components"
import { useTbtcState } from "../../../../hooks/useTbtcState"
import { BridgeProcessCardTitle } from "../components/BridgeProcessCardTitle"
import { BridgeProcessCardSubTitle } from "../components/BridgeProcessCardSubTitle"
Expand Down Expand Up @@ -107,6 +111,8 @@ export const ProvideDataComponent: FC<{
const { setDepositDataInLocalStorage } = useTBTCDepositDataFromLocalStorage()
const depositTelemetry = useDepositTelemetry(threshold.tbtc.bitcoinNetwork)

const textColor = useColorModeValue("gray.500", "gray.300")

const onSubmit = async (values: FormValues) => {
if (account && !isSameETHAddress(values.ethAddress, account)) {
throw new Error(
Expand Down Expand Up @@ -167,7 +173,7 @@ export const ProvideDataComponent: FC<{
stepText="Step 1"
subTitle="Generate a Deposit Address"
/>
<BodyMd color="gray.500" mb={12}>
<BodyMd color={textColor} mb={12}>
Based on these two addresses, the system will generate for you a unique
BTC deposit address. There is no minting limit.
</BodyMd>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { ComponentProps, FC } from "react"
import { BodyLg, Box } from "@threshold-network/components"
import { BodyLg, Box, useColorModeValue } from "@threshold-network/components"

export const BridgeProcessCardSubTitle: FC<
{
stepText: string
subTitle?: string
} & ComponentProps<typeof BodyLg>
> = ({ stepText, subTitle, children, ...restProps }) => {
const mainTextColor = useColorModeValue("brand.500", "brand.300")

return (
<BodyLg mb={4} {...restProps}>
<Box as="span" fontWeight="bold" color="brand.500">
<Box as="span" fontWeight="bold" color={mainTextColor}>
{stepText}
</Box>
{subTitle ? ` - ${subTitle}` : children}
Expand Down
9 changes: 6 additions & 3 deletions src/pages/tBTC/Bridge/components/BridgeProcessEmptyState.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useEffect } from "react"
import { H5 } from "@threshold-network/components"
import { H5, useColorModeValue } from "@threshold-network/components"
import { BridgeProcessCardTitle } from "./BridgeProcessCardTitle"
import SubmitTxButton from "../../../../components/SubmitTxButton"
import {
Expand All @@ -18,6 +18,10 @@ export const BridgeProcessEmptyState: FC<{
}> = ({ title, bridgeProcess = "mint" }) => {
const [tvlInUSD, fetchTvl, tvl] = useFetchTvl()
const [deposits] = useFetchRecentDeposits(3)
const protocolHistoryBackgroundColor = useColorModeValue(
"linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 117.78%)",
"linear-gradient(360deg, #333A47 0%, rgba(255, 255, 255, 0) 117.78%)"
)

useEffect(() => {
fetchTvl()
Expand All @@ -40,8 +44,7 @@ export const BridgeProcessEmptyState: FC<{
width: "100%",
height: "100px",
opacity: "0.9",
background:
"linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 117.78%)",
background: protocolHistoryBackgroundColor,
}}
/>
<ProtocolHistoryViewMoreLink mt="7" />
Expand Down
5 changes: 4 additions & 1 deletion src/pages/tBTC/Bridge/components/BridgeProcessStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
CircularProgress,
CircularProgressLabel,
Flex,
useColorModeValue,
} from "@threshold-network/components"
import ViewInBlockExplorer, {
Chain as ViewInBlockExplorerChain,
Expand Down Expand Up @@ -38,6 +39,8 @@ export const BridgeProcessStep: FC<BridgeProcessStepProps> = ({
icon,
children,
}) => {
const titleTextColor = useColorModeValue("gray.700", "gray.300")

useEffect(() => {
if (!isCompleted) return

Expand All @@ -51,7 +54,7 @@ export const BridgeProcessStep: FC<BridgeProcessStepProps> = ({
return (
<Flex flexDirection="column" alignItems="center" height="100%">
<BodyLg
color="gray.700"
color={titleTextColor}
mt="8"
alignSelf="flex-start"
fontSize="20px"
Expand Down
22 changes: 14 additions & 8 deletions src/pages/tBTC/Explorer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
Th,
Thead,
Tr,
useColorModeValue,
} from "@threshold-network/components"
import { PageComponent } from "../../../types"
import tBTCExplorerBg from "../../../static/images/tBTC-explorer-bg.svg"
Expand Down Expand Up @@ -117,21 +118,21 @@ export const ExplorerPage: PageComponent = () => {
<LabelSm as="header">History</LabelSm>
<TableContainer mt="6">
<Table variant="simple">
<Thead color="gray.500">
<Thead>
<Tr>
<Th paddingLeft={12}>
<LabelXs color="gray.500">
<TBTCText /> amount
</LabelXs>
</Th>
<Th>
<LabelXs>Wallet Address</LabelXs>
<LabelXs color="gray.500">Wallet Address</LabelXs>
</Th>
<Th>
<LabelXs>TX Hash</LabelXs>
<LabelXs color="gray.500">TX Hash</LabelXs>
</Th>
<Th textAlign={"right"}>
<LabelXs>Timestamp</LabelXs>
<LabelXs color="gray.500">Timestamp</LabelXs>
</Th>
</Tr>
</Thead>
Expand All @@ -151,11 +152,13 @@ const renderHistoryRow = (item: RecentDeposit) => (
)

const HistoryRow: FC<RecentDeposit> = ({ txHash, address, amount, date }) => {
const oddRowBackgroundColor = useColorModeValue("gray.50", "gray.700")

return (
<LinkBox
as={Tr}
key={`latest-mints-${txHash}`}
_odd={{ backgroundColor: "gray.50" }}
_odd={{ backgroundColor: oddRowBackgroundColor }}
sx={{ td: { borderBottom: "none" } }}
transform="scale(1)"
>
Expand Down Expand Up @@ -211,16 +214,19 @@ const SimpleMetricBox: FC<{ value: string; label: string }> = ({
}

const MetricBox: FC = ({ children }) => {
const borderColor = useColorModeValue("gray.100", "gray.500")
const backgroundColor = useColorModeValue("white", "gray.700")

return (
<Box
border="1px solid"
borderColor="gray.100"
borderColor={borderColor}
p="3.25rem"
bg="white"
bg={backgroundColor}
textAlign="center"
borderRadius="2"
minWidth="294px"
color="grat.700"
color="gray.700"
>
{children}
</Box>
Expand Down
Loading