Skip to content

Commit

Permalink
Merge branch 'main' into fix-drop-message
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska authored Dec 16, 2024
2 parents 99578ac + 53a99f7 commit d801c79
Show file tree
Hide file tree
Showing 58 changed files with 146 additions and 610 deletions.
21 changes: 8 additions & 13 deletions dapp/src/DApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import { QueryClientProvider } from "@tanstack/react-query"
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
import { AcreSdkProvider } from "./acre-react/contexts"
import GlobalStyles from "./components/GlobalStyles"
import {
DocsDrawerContextProvider,
WalletConnectionAlertContextProvider,
} from "./contexts"
import { WalletConnectionAlertContextProvider } from "./contexts"
import { useInitApp } from "./hooks"
import { router } from "./router"
import { store } from "./store"
Expand Down Expand Up @@ -65,15 +62,13 @@ function DAppProviders() {
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<AcreSdkProvider>
<DocsDrawerContextProvider>
<WalletConnectionAlertContextProvider>
<ReduxProvider store={store}>
<PostHogProvider>
<DApp />
</PostHogProvider>
</ReduxProvider>
</WalletConnectionAlertContextProvider>
</DocsDrawerContextProvider>
<WalletConnectionAlertContextProvider>
<ReduxProvider store={store}>
<PostHogProvider>
<DApp />
</PostHogProvider>
</ReduxProvider>
</WalletConnectionAlertContextProvider>
</AcreSdkProvider>
</QueryClientProvider>
</WagmiProvider>
Expand Down
1 change: 0 additions & 1 deletion dapp/src/assets/images/mezo-beehive-modal-illustration.svg

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file removed dapp/src/assets/webps/confetti.webp
Binary file not shown.
41 changes: 30 additions & 11 deletions dapp/src/components/ConnectWalletModal/ConnectWalletAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { Box, Link, VStack } from "@chakra-ui/react"
import { AlertStatus, Box, Link, VStack } from "@chakra-ui/react"
import { AnimatePresence, Variants, motion } from "framer-motion"
import { EXTERNAL_HREF } from "#/constants"
import {
Expand All @@ -18,6 +18,15 @@ export enum ConnectionAlert {
Default = "DEFAULT",
}

type ConnectionAlertData = {
title: string
description?: React.ReactNode
status?: AlertStatus
colorScheme?: string
}

type ConnectionAlerts = Record<ConnectionAlert, ConnectionAlertData>

function ContactSupport() {
return (
<Box as="span">
Expand All @@ -36,10 +45,11 @@ function ContactSupport() {
)
}

const CONNECTION_ALERTS = {
const CONNECTION_ALERTS: ConnectionAlerts = {
[ConnectionAlert.Rejected]: {
title: "Wallet connection rejected.",
description: "If you encountered an error, please try again.",
title: "Please connect your wallet to start using Acre",
status: "info",
colorScheme: "blue",
},
[ConnectionAlert.NotSupported]: {
title: "Not supported.",
Expand All @@ -66,16 +76,23 @@ const collapseVariants: Variants = {
expanded: { height: "auto" },
}

type ConnectWalletAlertProps = AlertProps & { type?: ConnectionAlert }
type ConnectWalletAlertProps = Omit<AlertProps, "status"> & {
type?: ConnectionAlert
}

export default function ConnectWalletAlert(props: ConnectWalletAlertProps) {
const { type, status, ...restProps } = props
const { type, ...restProps } = props

const data = type ? CONNECTION_ALERTS[type] : undefined
const {
status = "error",
title,
description,
...restData
} = (type ? CONNECTION_ALERTS[type] : {}) as ConnectionAlertData

return (
<AnimatePresence initial={false}>
{data && (
{type && (
<Box
as={motion.div}
variants={collapseVariants}
Expand All @@ -85,11 +102,13 @@ export default function ConnectWalletAlert(props: ConnectWalletAlertProps) {
overflow="hidden"
w="full"
>
<Alert status={status} mb={6} {...restProps}>
<Alert status={status} mb={6} {...restProps} {...restData}>
<AlertIcon />
<VStack w="full" align="start" spacing={0}>
<AlertTitle textAlign="start">{data.title}</AlertTitle>
<AlertDescription>{data.description}</AlertDescription>
<AlertTitle textAlign="start">{title}</AlertTitle>
{description && (
<AlertDescription>{description}</AlertDescription>
)}
</VStack>
</Alert>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions dapp/src/components/ConnectWalletModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function ConnectWalletModalBase({
}))

const [selectedConnectorId, setSelectedConnectorId] = useState<string>()
const { type, status, resetConnectionAlert } = useWalletConnectionAlert()
const { type, resetConnectionAlert } = useWalletConnectionAlert()
const isSignedMessage = useIsSignedMessage()

const handleButtonOnClick = (connector: OrangeKitConnector) => {
Expand Down Expand Up @@ -59,7 +59,7 @@ export function ConnectWalletModalBase({
<ModalHeader>{`Select your ${isEmbed ? "account" : "wallet"}`}</ModalHeader>

<ModalBody gap={0}>
<ConnectWalletAlert type={type} status={status} />
<ConnectWalletAlert type={type} />

{enabledConnectors.map((connector) => (
<ConnectWalletButton
Expand Down
25 changes: 0 additions & 25 deletions dapp/src/components/DocsDrawer.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions dapp/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Flex, VStack } from "@chakra-ui/react"
import { useIsEmbed, useMobileMode } from "#/hooks"
import { DappMode } from "#/types"
import { usePostHogPageViewCapture } from "#/hooks/posthog"
import DocsDrawer from "./DocsDrawer"
import Header from "./Header"
import ModalRoot from "./ModalRoot"
import MobileModeBanner from "./MobileModeBanner"
Expand Down Expand Up @@ -50,7 +49,6 @@ function Layout() {
>
<Outlet />

<DocsDrawer />
<ModalRoot />
</Flex>

Expand Down

This file was deleted.

35 changes: 0 additions & 35 deletions dapp/src/components/shared/ButtonLink.tsx

This file was deleted.

27 changes: 0 additions & 27 deletions dapp/src/components/shared/IconTag.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions dapp/src/components/shared/NavLink.tsx

This file was deleted.

Loading

0 comments on commit d801c79

Please sign in to comment.