Skip to content

Commit fa7fe1e

Browse files
committed
Remove tw-components Checkbox CORE-419 (#5890)
CORE-419
1 parent 9bc7884 commit fa7fe1e

File tree

6 files changed

+43
-77
lines changed

6 files changed

+43
-77
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/components/create-account-button.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"use client";
22

33
import { Button } from "@/components/ui/button";
4-
import { Card } from "@/components/ui/card";
4+
import { ToolTipLabel } from "@/components/ui/tooltip";
55
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
6-
import { Tooltip } from "@chakra-ui/react";
76
import { TransactionButton } from "components/buttons/TransactionButton";
87
import type { ThirdwebContract } from "thirdweb";
98
import * as ERC4337Ext from "thirdweb/extensions/erc4337";
@@ -53,23 +52,11 @@ export const CreateAccountButton: React.FC<CreateAccountButtonProps> = ({
5352

5453
if (isAccountDeployedQuery.data && accountsForAddressQuery.data?.length) {
5554
return (
56-
<Tooltip
57-
label={
58-
<Card className="bg-card px-4 py-2">
59-
<p>You can only initialize one account per EOA.</p>
60-
</Card>
61-
}
62-
bg="transparent"
63-
boxShadow="none"
64-
bgColor="backgroundHighlight"
65-
borderRadius="lg"
66-
placement="right"
67-
shouldWrapChildren
68-
>
55+
<ToolTipLabel label="You can only initialize one account per EOA.">
6956
<Button variant="primary" disabled>
7057
Account Created
7158
</Button>
72-
</Tooltip>
59+
</ToolTipLabel>
7360
);
7461
}
7562

apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/access-tokens/components/add-access-token-button.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Checkbox, CheckboxWithLabel } from "@/components/ui/checkbox";
12
import { PlainTextCodeBlock } from "@/components/ui/code/plaintext-code";
23
import { useEngineCreateAccessToken } from "@3rdweb-sdk/react/hooks/useEngine";
34
import {
@@ -14,7 +15,7 @@ import { useTrack } from "hooks/analytics/useTrack";
1415
import { useTxNotifications } from "hooks/useTxNotifications";
1516
import { CirclePlusIcon } from "lucide-react";
1617
import { useState } from "react";
17-
import { Button, Checkbox, Text } from "tw-components";
18+
import { Button, Text } from "tw-components";
1819

1920
interface AddAccessTokenButtonProps {
2021
instanceUrl: string;
@@ -92,12 +93,13 @@ export const AddAccessTokenButton: React.FC<AddAccessTokenButtonProps> = ({
9293
<Text color="red.500">
9394
This access token will not be shown again.
9495
</Text>
95-
<Checkbox
96-
checked={hasStoredToken}
97-
onChange={(e) => setHasStoredToken(e.target.checked)}
98-
>
99-
I have securely stored this access token.
100-
</Checkbox>
96+
<CheckboxWithLabel>
97+
<Checkbox
98+
checked={hasStoredToken}
99+
onCheckedChange={(val) => setHasStoredToken(!!val)}
100+
/>
101+
<span>I have securely stored this access token.</span>
102+
</CheckboxWithLabel>
101103
</div>
102104
</ModalBody>
103105

apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/contract-subscriptions/components/add-contract-subscription-button.tsx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

33
import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors";
4+
import { Checkbox, CheckboxWithLabel } from "@/components/ui/checkbox";
45
import { useThirdwebClient } from "@/constants/thirdweb.client";
56
import {
67
type AddContractSubscriptionInput,
@@ -36,7 +37,6 @@ import { getContract, isAddress } from "thirdweb";
3637
import {
3738
Button,
3839
Card,
39-
Checkbox,
4040
FormErrorMessage,
4141
FormHelperText,
4242
FormLabel,
@@ -327,8 +327,8 @@ const ModalBodyInputData = ({
327327
<Checkbox
328328
{...form.register("processEventLogs")}
329329
checked={form.getValues("processEventLogs")}
330-
onChange={(e) => {
331-
const { checked } = e.target;
330+
onCheckedChange={(val) => {
331+
const checked = !!val;
332332
form.setValue("processEventLogs", checked);
333333
if (checked) {
334334
processEventLogsDisclosure.onOpen();
@@ -380,21 +380,22 @@ const ModalBodyInputData = ({
380380
</div>
381381
</Collapse>
382382

383-
<Checkbox
384-
{...form.register("processTransactionReceipts")}
385-
checked={form.getValues("processTransactionReceipts")}
386-
onChange={(e) => {
387-
const { checked } = e.target;
388-
form.setValue("processTransactionReceipts", checked);
389-
if (checked) {
390-
processTransactionReceiptsDisclosure.onOpen();
391-
} else {
392-
processTransactionReceiptsDisclosure.onClose();
393-
}
394-
}}
395-
>
383+
<CheckboxWithLabel>
384+
<Checkbox
385+
{...form.register("processTransactionReceipts")}
386+
checked={form.getValues("processTransactionReceipts")}
387+
onCheckedChange={(val) => {
388+
const checked = !!val;
389+
form.setValue("processTransactionReceipts", checked);
390+
if (checked) {
391+
processTransactionReceiptsDisclosure.onOpen();
392+
} else {
393+
processTransactionReceiptsDisclosure.onClose();
394+
}
395+
}}
396+
/>
396397
<Text>Transaction Receipts</Text>
397-
</Checkbox>
398+
</CheckboxWithLabel>
398399
{/* Shows all/specific functions if processing transaction receipts */}
399400
<Collapse in={processTransactionReceiptsDisclosure.isOpen}>
400401
<div className="flex flex-col gap-2 px-4">

apps/dashboard/src/core-ui/batch-upload/batch-lazy-mint.tsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"use client";
22

3+
import { Checkbox, CheckboxWithLabel } from "@/components/ui/checkbox";
34
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
45
import {
56
Alert,
67
AlertIcon,
7-
Box,
88
Flex,
99
FormControl,
1010
Input,
@@ -24,7 +24,6 @@ import type { CreateDelayedRevealBatchParams } from "thirdweb/extensions/erc721"
2424
import type { NFTInput } from "thirdweb/utils";
2525
import {
2626
Button,
27-
Checkbox,
2827
FormErrorMessage,
2928
FormHelperText,
3029
FormLabel,
@@ -196,7 +195,7 @@ export const BatchLazyMint: ComponentWithChildren<
196195
/>
197196
<div className="border-border border-t">
198197
<div className="flex flex-col items-center justify-between p-0 md:flex-row md:p-4">
199-
<Box ref={paginationPortalRef} />
198+
<div ref={paginationPortalRef} />
200199
<div className="mt-4 flex w-full flex-row items-center gap-2 md:mt-0 md:w-auto">
201200
<Button
202201
borderRadius="md"
@@ -251,15 +250,14 @@ export const BatchLazyMint: ComponentWithChildren<
251250
/>
252251
{form.watch("revealType") && (
253252
<>
254-
<Checkbox {...form.register("shuffle")} mt={3}>
255-
<Flex gap={1} flexDir={{ base: "column", md: "row" }}>
256-
<Text>Shuffle the order of the NFTs before uploading.</Text>
257-
<Text fontStyle="italic">
258-
This is an off-chain operation and is not provable.
259-
</Text>
260-
</Flex>
261-
</Checkbox>
262-
<Box maxW={{ base: "100%", md: "61%" }}>
253+
<CheckboxWithLabel>
254+
<Checkbox {...form.register("shuffle")} className="mt-3" />
255+
<div className="flex flex-col items-center gap-1 md:flex-row">
256+
<p>Shuffle the order of the NFTs before uploading.</p>
257+
<em>This is an off-chain operation and is not provable.</em>
258+
</div>
259+
</CheckboxWithLabel>
260+
<div className="w-full md:w-[61%]">
263261
<TransactionButton
264262
txChainID={props.chainId}
265263
className="mt-4 w-full"
@@ -274,7 +272,7 @@ export const BatchLazyMint: ComponentWithChildren<
274272
: `Upload ${nftMetadatas.length} NFTs`}
275273
</TransactionButton>
276274
{props.children}
277-
</Box>
275+
</div>
278276
<Text size="body.sm" mt={2}>
279277
<TrackedLink
280278
href="https://support.thirdweb.com/dashboard/n5evQ4EfEjEifczEQaZ1hL/batch-upload-troubleshooting/5WMQFqfaUTU1C8NM8FtJ2X"
@@ -406,7 +404,7 @@ const SelectReveal: React.FC<SelectRevealProps> = ({
406404
}
407405
>
408406
<FormLabel>Image</FormLabel>
409-
<Box width={{ base: "auto", md: "350px" }}>
407+
<div className="w-auto md:w-[350px]">
410408
<FileInput
411409
accept={{ "image/*": [] }}
412410
value={imageUrl}
@@ -416,7 +414,7 @@ const SelectReveal: React.FC<SelectRevealProps> = ({
416414
}
417415
className="rounded border border-border transition-all duration-200"
418416
/>
419-
</Box>
417+
</div>
420418
<FormHelperText>
421419
You can optionally upload an image as the placeholder.
422420
</FormHelperText>

apps/dashboard/src/tw-components/checkbox.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

apps/dashboard/src/tw-components/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export * from "./button";
22
export * from "./card";
3-
export * from "./checkbox";
43
export * from "./form";
54
export * from "./heading";
65
export * from "./link";

0 commit comments

Comments
 (0)