Skip to content

Commit

Permalink
Merge branch 'main' into kien/pack-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
kien-ngo authored Sep 22, 2024
2 parents 57db1f8 + d936d4e commit 58bb138
Show file tree
Hide file tree
Showing 457 changed files with 11,044 additions and 9,859 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-otters-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Fix jsdoc for getClaimParams
5 changes: 4 additions & 1 deletion apps/dashboard/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,7 @@ UNTHREAD_GROWTH_TIER_ID=""
UNTHREAD_PRO_TIER_ID=""

# Demo Engine
NEXT_PUBLIC_DEMO_ENGINE_URL=""
NEXT_PUBLIC_DEMO_ENGINE_URL=""

# API server secret (required for thirdweb.com SIWE login). Copy from Vercel.
API_SERVER_SECRET=""
9 changes: 6 additions & 3 deletions apps/dashboard/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:@next/next/recommended",
"plugin:promise/recommended",
"plugin:storybook/recommended",
],
rules: {
Expand All @@ -16,6 +14,11 @@ module.exports = {
message:
'Are you *sure* you need to use "useEffect" here? If you loading any async function prefer using "useQuery".',
},
{
selector: "CallExpression[callee.name='createContext']",
message:
'Are you *sure* you need to use a "Context"? In almost all cases you should prefer passing props directly.',
},
{
selector: "CallExpression[callee.name='defineChain']",
message:
Expand Down Expand Up @@ -98,7 +101,7 @@ module.exports = {
],
},
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "import", "react-compiler"],
plugins: ["@typescript-eslint", "react-compiler"],
parserOptions: {
ecmaVersion: 2019,
ecmaFeatures: {
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const ContentSecurityPolicy = `
style-src 'self' 'unsafe-inline' https://vercel.live;
font-src 'self' https://vercel.live https://assets.vercel.com;
frame-src * data:;
script-src 'self' 'unsafe-eval' 'unsafe-inline' 'wasm-unsafe-eval' 'inline-speculation-rules' *.thirdweb.com *.thirdweb-dev.com vercel.live js.stripe.com pg.paper.xyz portal.usecontext.io;
script-src 'self' 'unsafe-eval' 'unsafe-inline' 'wasm-unsafe-eval' 'inline-speculation-rules' *.thirdweb.com *.thirdweb-dev.com vercel.live js.stripe.com;
connect-src * data: blob:;
worker-src 'self' blob:;
block-all-mixed-content;
Expand Down
18 changes: 8 additions & 10 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"format": "biome format ./src --write",
"lint": "biome check ./src && knip && eslint ./src",
"fix": "biome check ./src --fix && eslint ./src --fix",
"typecheck": "tsc --noEmit",
"gen:theme-typings": "chakra-cli tokens src/theme/index.ts",
"postinstall": "pnpm run gen:theme-typings",
"postbuild": "next-sitemap",
Expand Down Expand Up @@ -68,15 +69,14 @@
"ipaddr.js": "^2.2.0",
"lottie-react": "^2.4.0",
"lucide-react": "0.441.0",
"next": "14.2.11",
"next": "14.2.12",
"next-plausible": "^3.12.0",
"next-seo": "^6.5.0",
"next-themes": "^0.3.0",
"nextjs-toploader": "^1.6.12",
"papaparse": "^5.4.1",
"pluralize": "^8.0.0",
"posthog-js": "1.161.5",
"posthog-js-opensource": "npm:[email protected]",
"posthog-js": "1.67.1",
"prism-react-renderer": "^2.3.1",
"prismjs": "^1.29.0",
"qrcode": "^1.5.3",
Expand Down Expand Up @@ -108,8 +108,8 @@
"devDependencies": {
"@chakra-ui/cli": "^2.4.1",
"@chromatic-com/storybook": "2.0.2",
"@next/bundle-analyzer": "14.2.11",
"@next/eslint-plugin-next": "14.2.11",
"@next/bundle-analyzer": "14.2.12",
"@next/eslint-plugin-next": "14.2.12",
"@playwright/test": "1.47.1",
"@storybook/addon-essentials": "8.3.1",
"@storybook/addon-interactions": "8.3.1",
Expand All @@ -125,7 +125,7 @@
"@types/papaparse": "^5.3.14",
"@types/pluralize": "^0.0.33",
"@types/qrcode": "^1.5.5",
"@types/react": "^18.3.6",
"@types/react": "^18.3.7",
"@types/react-dom": "^18",
"@types/react-table": "^7.7.20",
"@types/spdx-correct": "^3.1.3",
Expand All @@ -136,14 +136,12 @@
"checkly": "^4.8.1",
"eslint": "8.57.0",
"eslint-config-biome": "1.8.3",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-promise": "^6.2.0",
"eslint-plugin-react-compiler": "0.0.0-experimental-9ed098e-20240725",
"eslint-plugin-react-compiler": "0.0.0-experimental-ca16900-20240916",
"eslint-plugin-storybook": "^0.8.0",
"next-sitemap": "^4.2.3",
"postcss": "8.4.47",
"storybook": "8.3.1",
"tailwindcss": "3.4.11",
"tailwindcss": "3.4.12",
"typescript": "5.6.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Story() {
description="This is a description"
buttonLabel="Some Action"
buttonOnClick={() => {}}
isLoading={false}
isPending={false}
confirmationDialog={{
title: "This is confirmation title",
description: "This is confirmation description",
Expand All @@ -50,7 +50,7 @@ function Story() {
description="This is a description"
buttonLabel="Some Action"
buttonOnClick={() => {}}
isLoading={true}
isPending={true}
confirmationDialog={{
title: "This is confirmation title",
description: "This is confirmation description",
Expand Down
10 changes: 5 additions & 5 deletions apps/dashboard/src/@/components/blocks/DangerSettingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function DangerSettingCard(props: {
description: string;
buttonLabel: string;
buttonOnClick: () => void;
isLoading: boolean;
isPending: boolean;
confirmationDialog: {
title: string;
description: string;
Expand All @@ -39,9 +39,9 @@ export function DangerSettingCard(props: {
<Button
variant="destructive"
className="bg-red-600 hover:bg-red-600/80 text-white font-semibold gap-2"
disabled={props.isLoading}
disabled={props.isPending}
>
{props.isLoading && <Spinner className="size-3" />}
{props.isPending && <Spinner className="size-3" />}
{props.buttonLabel}
</Button>
</DialogTrigger>
Expand All @@ -66,9 +66,9 @@ export function DangerSettingCard(props: {
variant="destructive"
className="bg-red-600 hover:bg-red-600/80 text-white font-semibold gap-2"
onClick={props.buttonOnClick}
disabled={props.isLoading}
disabled={props.isPending}
>
{props.isLoading && <Spinner className="size-3" />}
{props.isPending && <Spinner className="size-3" />}
{props.buttonLabel}
</Button>
</DialogFooter>
Expand Down
36 changes: 36 additions & 0 deletions apps/dashboard/src/@/components/blocks/FormFieldSetup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Label } from "@/components/ui/label";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { AsteriskIcon, InfoIcon } from "lucide-react";

export function FormFieldSetup(props: {
htmlFor: string;
label: string;
errorMessage: React.ReactNode | undefined;
children: React.ReactNode;
tooltip: React.ReactNode | undefined;
isRequired: boolean;
}) {
return (
<div>
<div className="mb-2 inline-flex gap-1 items-center">
<Label htmlFor={props.htmlFor}>{props.label}</Label>

{props.isRequired && (
<AsteriskIcon className="text-destructive-text size-3.5" />
)}

{props.tooltip && (
<ToolTipLabel label={props.tooltip}>
<InfoIcon className="text-muted-foreground size-3.5" />
</ToolTipLabel>
)}
</div>
{props.children}
{props.errorMessage && (
<p className="text-destructive-text text-sm mt-1">
{props.errorMessage}
</p>
)}
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function Story() {
}}
saveButton={{
disabled: false,
isLoading: false,
isPending: false,
onClick: () => {},
}}
noPermissionText={"You do not have permission to edit this"}
Expand All @@ -100,7 +100,7 @@ function Story() {
}}
saveButton={{
disabled: false,
isLoading: false,
isPending: false,
onClick: () => {},
}}
noPermissionText={undefined}
Expand All @@ -119,7 +119,7 @@ function Story() {
}}
saveButton={{
disabled: true,
isLoading: false,
isPending: false,
onClick: () => {},
}}
noPermissionText={undefined}
Expand All @@ -138,7 +138,7 @@ function Story() {
}}
saveButton={{
disabled: false,
isLoading: true,
isPending: true,
onClick: () => {},
}}
noPermissionText={undefined}
Expand Down
12 changes: 7 additions & 5 deletions apps/dashboard/src/@/components/blocks/SettingsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ export function SettingsCard(props: {
errorText: string | undefined;
noPermissionText: string | undefined;
saveButton?: {
onClick: () => void;
onClick?: () => void;
disabled: boolean;
isLoading: boolean;
isPending: boolean;
type?: "submit";
};
}) {
return (
Expand Down Expand Up @@ -58,11 +59,12 @@ export function SettingsCard(props: {
size="sm"
className="gap-2"
onClick={props.saveButton.onClick}
disabled={props.saveButton.disabled || props.saveButton.isLoading}
disabled={props.saveButton.disabled || props.saveButton.isPending}
variant="outline"
type={props.saveButton.type}
>
{props.saveButton.isLoading && <Spinner className="size-3" />}
{props.saveButton.isLoading ? "Saving" : "Save"}
{props.saveButton.isPending && <Spinner className="size-3" />}
{props.saveButton.isPending ? "Saving" : "Save"}
</Button>
)}
</div>
Expand Down
79 changes: 79 additions & 0 deletions apps/dashboard/src/@/components/blocks/multi-select.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import type { Meta, StoryObj } from "@storybook/react";
import { useMemo, useState } from "react";
import { BadgeContainer, mobileViewport } from "../../../stories/utils";
import { MultiSelect } from "./multi-select";

const meta = {
title: "blocks/MultiSelect",
component: Story,
parameters: {
nextjs: {
appDirectory: true,
},
},
} satisfies Meta<typeof Story>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Desktop: Story = {
args: {},
};

export const Mobile: Story = {
args: {},
parameters: {
viewport: mobileViewport("iphone14"),
},
};

function createList(len: number) {
return Array.from({ length: len }, (_, i) => ({
value: `${i}`,
label: `Item ${i}`,
}));
}

function Story() {
return (
<div className="py-6 max-w-[600px] mx-auto w-full px-4 flex flex-col gap-6">
<VariantTest defaultValues={[]} storyLabel="5 items" listLen={5} />
<VariantTest defaultValues={[]} storyLabel="5000 items" listLen={5000} />
<VariantTest
defaultValues={["1", "3", "5"]}
storyLabel="20 items, 3 selected by default"
listLen={20}
/>
<VariantTest
defaultValues={["1", "2", "3", "4", "5", "6", "7"]}
storyLabel="20 items, 7 selected, show max 3"
listLen={20}
maxCount={3}
/>
</div>
);
}

function VariantTest(props: {
defaultValues: string[];
maxCount?: number;
storyLabel: string;
listLen: number;
}) {
const list = useMemo(() => createList(props.listLen), [props.listLen]);
const [values, setValues] = useState<string[]>(props.defaultValues);

return (
<BadgeContainer label={props.storyLabel}>
<MultiSelect
selectedValues={values}
options={list}
onSelectedValuesChange={(values) => {
setValues(values);
}}
placeholder="Select items"
maxCount={props.maxCount}
/>
</BadgeContainer>
);
}
Loading

0 comments on commit 58bb138

Please sign in to comment.