From bab4fb1fff4264d4453ef18815c8a7b62f09d54f Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Wed, 8 Jan 2025 17:29:02 +0900 Subject: [PATCH] Sunset remain chakra components except layout --- packages/keychain/package.json | 1 + .../keychain/src/components/Animation.tsx | 27 ---- .../ControllerErrorAlert.stories.tsx | 27 +++- .../keychain/src/components/ErrorAlert.tsx | 81 +++++------- .../keychain/src/components/ErrorBoundary.tsx | 34 +---- packages/keychain/src/components/Fees.tsx | 36 ++--- .../Funding/AmountSelection.stories.tsx | 17 +++ .../components/Funding/AmountSelection.tsx | 31 +++-- .../components/Funding/DepositEth.stories.tsx | 27 ++++ .../src/components/Funding/DepositEth.tsx | 110 +++++++--------- .../Funding/PurchaseCredits.stories.tsx | 21 +++ .../components/Funding/PurchaseCredits.tsx | 11 +- .../components/Settings/Delegate.stories.tsx | 16 +++ .../src/components/Settings/Delegate.tsx | 21 ++- .../components/Settings/Recovery.stories.tsx | 16 +++ .../src/components/Settings/Recovery.tsx | 29 ++--- .../src/components/SignMessage.stories.tsx | 83 ++++++++++++ .../keychain/src/components/SignMessage.tsx | 123 +++++++----------- packages/keychain/src/components/app.tsx | 5 +- .../connect/SessionConsent.stories.tsx | 34 +++++ .../src/components/connect/SessionConsent.tsx | 26 ++-- .../connect/create/CreateController.tsx | 19 ++- .../components/connect/create/StatusTray.tsx | 71 ++++------ packages/keychain/src/components/index.ts | 1 - .../layout/Container/Header/index.tsx | 5 +- .../keychain/src/components/slot/consent.tsx | 9 +- .../keychain/src/components/slot/index.tsx | 3 + pnpm-lock.yaml | 9 +- 28 files changed, 489 insertions(+), 404 deletions(-) delete mode 100644 packages/keychain/src/components/Animation.tsx create mode 100644 packages/keychain/src/components/Funding/AmountSelection.stories.tsx create mode 100644 packages/keychain/src/components/Funding/DepositEth.stories.tsx create mode 100644 packages/keychain/src/components/Funding/PurchaseCredits.stories.tsx create mode 100644 packages/keychain/src/components/Settings/Delegate.stories.tsx create mode 100644 packages/keychain/src/components/Settings/Recovery.stories.tsx create mode 100644 packages/keychain/src/components/SignMessage.stories.tsx create mode 100644 packages/keychain/src/components/connect/SessionConsent.stories.tsx diff --git a/packages/keychain/package.json b/packages/keychain/package.json index 2a17360cd..bfcc6d6e8 100644 --- a/packages/keychain/package.json +++ b/packages/keychain/package.json @@ -83,6 +83,7 @@ "jsdom": "^25.0.1", "playwright": "^1.47.1", "postcss": "^8.4.35", + "postcss-import": "^16.1.0", "prettier": "^2.7.1", "rollup-plugin-visualizer": "^5.12.0", "start-server-and-test": "^2.0.9", diff --git a/packages/keychain/src/components/Animation.tsx b/packages/keychain/src/components/Animation.tsx deleted file mode 100644 index 2e9a2be2e..000000000 --- a/packages/keychain/src/components/Animation.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Box, Flex } from "@chakra-ui/react"; -import { ReactElement } from "react"; - -export function FullPageAnimation({ - show, - View, -}: { - show: boolean; - View: ReactElement; -}) { - return ( - - {View} - - ); -} diff --git a/packages/keychain/src/components/ControllerErrorAlert.stories.tsx b/packages/keychain/src/components/ControllerErrorAlert.stories.tsx index c2d4414c2..6bb923615 100644 --- a/packages/keychain/src/components/ControllerErrorAlert.stories.tsx +++ b/packages/keychain/src/components/ControllerErrorAlert.stories.tsx @@ -1,6 +1,5 @@ import type { Meta, StoryObj } from "@storybook/react"; import { ControllerErrorAlert as CtrlErrAlert } from "./ErrorAlert"; -import { VStack } from "@chakra-ui/react"; import { ErrorCode } from "@cartridge/account-wasm/controller"; import { starknetTransactionExecutionErrorTestCases } from "@/utils/errors"; @@ -17,7 +16,7 @@ export const All: Story = {}; function ControllerErrorAlert() { return ( - +
@@ -37,6 +36,28 @@ function ControllerErrorAlert() { }} /> ))} - + + + + +
); } diff --git a/packages/keychain/src/components/ErrorAlert.tsx b/packages/keychain/src/components/ErrorAlert.tsx index ce4869ba1..aad025c27 100644 --- a/packages/keychain/src/components/ErrorAlert.tsx +++ b/packages/keychain/src/components/ErrorAlert.tsx @@ -9,8 +9,8 @@ import { AccordionTrigger, AccordionContent, cn, + Separator, } from "@cartridge/ui-next"; -import { Text, HStack, VStack, Divider } from "@chakra-ui/react"; import React, { ReactElement, useCallback, @@ -269,27 +269,25 @@ export function ControllerErrorAlert({ description = ; } catch { title = "Execution error"; - description = {error.data}; + description = error.data; } break; case ErrorCode.StarknetValidationFailure: { const parsedError = parseValidationError(error); title = parsedError.summary; copyText = parsedError.raw; - description = ( - - {Object.entries(parsedError.details).map(([key, value]) => ( - - {key}: {typeof value === "bigint" ? value.toString() : value} - - ))} - - ); + description = + typeof parsedError.details === "string" ? ( + parsedError.details + ) : ( +
+ {Object.entries(parsedError.details).map(([key, value]) => ( +
+ {key}: {typeof value === "bigint" ? value.toString() : value} +
+ ))} +
+ ); variant = "warning"; isExpanded = true; break; @@ -330,27 +328,17 @@ function StackTraceDisplay({ ); return ( - +
{stackTrace.map((trace, i, arr) => ( - +
{Object.entries(trace).map( ([key, value]) => value && ( - - +
+
{key} - +
{key === "address" || key === "class" ? ( ) : key === "selector" ? ( - +
{formatAddress(value as string, { size: "sm", })} - +
) : ( - - {(value as string[]).map((line, index) => ( - +
+ {(value as string[]).map((line, i) => ( +
{line} - +
))} - +
)} - +
), )} - - {i !== arr.length - 1 && } +
+ {i !== arr.length - 1 && }
))} - +
); } diff --git a/packages/keychain/src/components/ErrorBoundary.tsx b/packages/keychain/src/components/ErrorBoundary.tsx index 34464b2e6..11aa73462 100644 --- a/packages/keychain/src/components/ErrorBoundary.tsx +++ b/packages/keychain/src/components/ErrorBoundary.tsx @@ -1,7 +1,6 @@ import React, { PropsWithChildren, useEffect } from "react"; import { Container, Content, Footer } from "./layout"; import { AlertIcon, ExternalIcon, Button } from "@cartridge/ui-next"; -import { HStack, Text } from "@chakra-ui/react"; import { useConnection } from "@/hooks/connection"; import { CARTRIDGE_DISCORD_LINK } from "@/const"; import { usePostHog } from "posthog-js/react"; @@ -48,33 +47,12 @@ export function ErrorPage({ error }: { error: Error }) { icon={} > - - - {error.message} - - +
+

{error.message}

+
- - - Get help - +
+

Get help

Cartridge Discord
-
+