From 3eef910a2447555b40503e3e50ac4322574da616 Mon Sep 17 00:00:00 2001 From: kien-ngo Date: Mon, 23 Sep 2024 01:29:48 +0000 Subject: [PATCH] [Dashboard] Remove HStack (#4749) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem solved Short description of the bug fixed or feature added --- ## PR-Codex overview This PR introduces changes to replace `HStack` with `div` using flex classes in various components for better styling consistency. ### Detailed summary - Replaced `HStack` with `div` using flex classes in multiple components for styling consistency. > The following files were skipped due to too many changes: `apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- apps/dashboard/.eslintrc.js | 1 + .../[team_slug]/(team)/~/usage/UsagePage.tsx | 9 ++--- .../src/components/onboarding/Steps.tsx | 6 ++-- .../settings/Account/AccountForm.tsx | 12 ++++--- .../Account/Billing/DowngradeDialog.tsx | 12 ++++--- .../settings/Account/Billing/Header.tsx | 10 +++--- .../settings/Account/Billing/Plan.tsx | 10 +++--- .../settings/Account/Billing/PlanCard.tsx | 6 ++-- .../settings/Account/Billing/index.tsx | 10 +++--- .../SponsorshipPolicies/index.tsx | 33 +++++++++---------- .../components/snapshot-upload.tsx | 5 ++- .../tabs/nfts/components/airdrop-upload.tsx | 5 ++- .../core-ui/batch-upload/batch-lazy-mint.tsx | 5 ++- .../src/core-ui/batch-upload/batch-table.tsx | 5 ++- 14 files changed, 62 insertions(+), 67 deletions(-) diff --git a/apps/dashboard/.eslintrc.js b/apps/dashboard/.eslintrc.js index d38dd355d6a..d642907f953 100644 --- a/apps/dashboard/.eslintrc.js +++ b/apps/dashboard/.eslintrc.js @@ -56,6 +56,7 @@ module.exports = { "MenuGroup", "MenuItem", "VStack", + "HStack", // also the types "ButtonProps", "BadgeProps", diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/usage/UsagePage.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/usage/UsagePage.tsx index 188ca0d48e0..6804a5d8e88 100644 --- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/usage/UsagePage.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/usage/UsagePage.tsx @@ -2,7 +2,6 @@ import { Spinner } from "@/components/ui/Spinner/Spinner"; import { useAccount, useAccountUsage } from "@3rdweb-sdk/react/hooks/useApi"; -import { HStack } from "@chakra-ui/react"; import { BillingPeriod } from "components/settings/Account/Billing/Period"; import { BillingPlan } from "components/settings/Account/Billing/Plan"; import { Usage } from "components/settings/Account/Usage"; @@ -24,14 +23,10 @@ export const SettingsUsagePage = () => {

Usage

- +
- +
diff --git a/apps/dashboard/src/components/onboarding/Steps.tsx b/apps/dashboard/src/components/onboarding/Steps.tsx index 4e98ef5fdd8..48c4fdf1e8c 100644 --- a/apps/dashboard/src/components/onboarding/Steps.tsx +++ b/apps/dashboard/src/components/onboarding/Steps.tsx @@ -7,7 +7,7 @@ import { useApiKeys, } from "@3rdweb-sdk/react/hooks/useApi"; import { useLoggedInUser } from "@3rdweb-sdk/react/hooks/useLoggedInUser"; -import { Flex, HStack, useBreakpointValue } from "@chakra-ui/react"; +import { Flex, useBreakpointValue } from "@chakra-ui/react"; import { ChakraNextImage } from "components/Image"; import { OPSponsoredChains } from "constants/chains"; import { useTrack } from "hooks/analytics/useTrack"; @@ -282,7 +282,7 @@ export const OnboardingSteps: React.FC = ({ > {title} {description} - +
{isLoggedIn ? ( )} - +
{rightImageDark && !isMobile && theme === "dark" && ( diff --git a/apps/dashboard/src/components/settings/Account/AccountForm.tsx b/apps/dashboard/src/components/settings/Account/AccountForm.tsx index 897500b5822..039e93fb6ca 100644 --- a/apps/dashboard/src/components/settings/Account/AccountForm.tsx +++ b/apps/dashboard/src/components/settings/Account/AccountForm.tsx @@ -1,6 +1,6 @@ import { cn } from "@/lib/utils"; import { type Account, useUpdateAccount } from "@3rdweb-sdk/react/hooks/useApi"; -import { Flex, FormControl, HStack, Input } from "@chakra-ui/react"; +import { Flex, FormControl, Input } from "@chakra-ui/react"; import { zodResolver } from "@hookform/resolvers/zod"; import { ManageBillingButton } from "components/settings/Account/Billing/ManageButton"; import { useTrack } from "hooks/analytics/useTrack"; @@ -219,9 +219,11 @@ export const AccountForm: React.FC = ({ )} - {showBillingButton && } @@ -240,7 +242,7 @@ export const AccountForm: React.FC = ({ {buttonText} )} - + ); diff --git a/apps/dashboard/src/components/settings/Account/Billing/DowngradeDialog.tsx b/apps/dashboard/src/components/settings/Account/Billing/DowngradeDialog.tsx index 4591ad2a800..02451f8ad56 100644 --- a/apps/dashboard/src/components/settings/Account/Billing/DowngradeDialog.tsx +++ b/apps/dashboard/src/components/settings/Account/Billing/DowngradeDialog.tsx @@ -6,7 +6,6 @@ import { AlertDialogHeader, AlertDialogOverlay, Flex, - HStack, Icon, Menu, MenuButton, @@ -65,10 +64,13 @@ export const BillingDowngradeDialog: React.FC = ({ {oldPlanFeatures.map((feat) => ( - +
{Array.isArray(feat) ? feat[0] : feat} - +
))}
@@ -123,7 +125,7 @@ export const BillingDowngradeDialog: React.FC = ({ - +
- +
diff --git a/apps/dashboard/src/components/settings/Account/Billing/Header.tsx b/apps/dashboard/src/components/settings/Account/Billing/Header.tsx index 7e80887a4f3..0c478178bc6 100644 --- a/apps/dashboard/src/components/settings/Account/Billing/Header.tsx +++ b/apps/dashboard/src/components/settings/Account/Billing/Header.tsx @@ -1,4 +1,4 @@ -import { Flex, HStack, Icon } from "@chakra-ui/react"; +import { Flex, Icon } from "@chakra-ui/react"; import { FiAlertCircle, FiCheckCircle, FiInfo } from "react-icons/fi"; import { Badge, Heading, Text } from "tw-components"; @@ -17,7 +17,7 @@ export const BillingHeader: React.FC = ({ Billing Info - +
Manage your payment methods, billing information and invoices. @@ -29,7 +29,7 @@ export const BillingHeader: React.FC = ({ py={1.5} textTransform="capitalize" > - + = ({ ? "Needs verification" : "Invalid payment"} - + - +
); }; diff --git a/apps/dashboard/src/components/settings/Account/Billing/Plan.tsx b/apps/dashboard/src/components/settings/Account/Billing/Plan.tsx index e03e969e454..a14f96fecfa 100644 --- a/apps/dashboard/src/components/settings/Account/Billing/Plan.tsx +++ b/apps/dashboard/src/components/settings/Account/Billing/Plan.tsx @@ -1,5 +1,5 @@ import type { Account } from "@3rdweb-sdk/react/hooks/useApi"; -import { Flex, HStack } from "@chakra-ui/react"; +import { Flex } from "@chakra-ui/react"; import { Badge, Text, TrackedLink } from "tw-components"; import { PLANS } from "utils/pricing"; @@ -20,7 +20,7 @@ export const BillingPlan: React.FC = ({ }) => { return ( - +
Your current plan is @@ -33,9 +33,9 @@ export const BillingPlan: React.FC = ({ > {PLANS[account.plan as keyof typeof PLANS].title} - +
- +
{description && {description}} = ({ Learn more - +
); }; diff --git a/apps/dashboard/src/components/settings/Account/Billing/PlanCard.tsx b/apps/dashboard/src/components/settings/Account/Billing/PlanCard.tsx index b86bef16e6e..33cfbf50a44 100644 --- a/apps/dashboard/src/components/settings/Account/Billing/PlanCard.tsx +++ b/apps/dashboard/src/components/settings/Account/Billing/PlanCard.tsx @@ -1,5 +1,5 @@ import { useAccount, useAccountCredits } from "@3rdweb-sdk/react/hooks/useApi"; -import { Flex, HStack } from "@chakra-ui/react"; +import { Flex } from "@chakra-ui/react"; import { Badge, Card, Heading, Text } from "tw-components"; import { PLANS } from "utils/pricing"; import { CreditsItem } from "./CreditsItem"; @@ -17,7 +17,7 @@ export const BillingPlanCard = () => { return ( - +
Your current plan is { > {PLANS[account.plan as keyof typeof PLANS].title} - +
diff --git a/apps/dashboard/src/components/settings/Account/Billing/index.tsx b/apps/dashboard/src/components/settings/Account/Billing/index.tsx index c32e56a3e81..ef9ebbe6db9 100644 --- a/apps/dashboard/src/components/settings/Account/Billing/index.tsx +++ b/apps/dashboard/src/components/settings/Account/Billing/index.tsx @@ -6,7 +6,7 @@ import { AccountStatus, useUpdateAccountPlan, } from "@3rdweb-sdk/react/hooks/useApi"; -import { Flex, HStack, Icon, useDisclosure } from "@chakra-ui/react"; +import { Flex, Icon, useDisclosure } from "@chakra-ui/react"; import { StepsCard } from "components/dashboard/StepsCard"; import { OnboardingModal } from "components/onboarding/Modal"; import { AccountForm } from "components/settings/Account/AccountForm"; @@ -141,7 +141,7 @@ export const Billing: React.FC = ({ account }) => { return [ { title: ( - +
= ({ account }) => { Edit )} - +
), description: "This information will be used for billing notifications and invoices.", @@ -288,10 +288,10 @@ export const Billing: React.FC = ({ account }) => { color="blue.500" isExternal > - +
Learn more about thirdweb's pricing - +
{downgradePlan && ( diff --git a/apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx b/apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx index e4457fa8885..de47e7733f4 100644 --- a/apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx +++ b/apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx @@ -14,7 +14,6 @@ import { Divider, Flex, FormControl, - HStack, IconButton, Input, Select, @@ -274,7 +273,7 @@ export function AccountAbstractionSettingsPage( > - +
Global spend limits @@ -302,7 +301,7 @@ export function AccountAbstractionSettingsPage( ); }} /> - +
{form.watch("globalLimit") && (
Spend limit - +
*/} per month - +
{ form.getFieldState("globalLimit.maxSpend", form.formState) @@ -347,7 +346,7 @@ export function AccountAbstractionSettingsPage( } > - +
Restrict to specific chains @@ -376,7 +375,7 @@ export function AccountAbstractionSettingsPage( ); }} /> - +
{form.watch("allowedChainIds") && ( - +
Restrict to specific contract addresses @@ -423,7 +422,7 @@ export function AccountAbstractionSettingsPage( ); }} /> - +
{form.watch("allowedContractAddresses") !== null && (