Skip to content

Commit 92896dd

Browse files
committed
Create shared UI library - @workspace/ui (#7855)
created a @workspace/ui package - shared by dashboard and playground. for now it only has button component for testing <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on refactoring the `postcss` and `tailwind` configurations across multiple applications to centralize styles in the `@workspace/ui` package, along with various updates to components and layouts. ### Detailed summary - Deleted `postcss.config.js` files and replaced them with `postcss.config.mjs` referencing `@workspace/ui`. - Updated CSS imports to use `@workspace/ui/global.css`. - Added `tailwindcss` configuration in `@workspace/ui` and updated references. - Introduced new utility functions in `packages/ui/src/lib/utils.ts`. - Modified component imports to utilize centralized components from `@workspace/ui`. - Updated `package.json` files to include `@workspace/ui` as a dependency. - Refactored button components to use a centralized button definition in `@workspace/ui`. - Adjusted TypeScript configurations to align with the new structure. - Enhanced global styles and configurations across multiple applications to ensure consistency. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Added a shared UI package and unified Button component used across apps. - Style - Apps now load shared global styles and animations from the UI package; global CSS and theme tokens consolidated. - Bug Fixes - AI chat header uses a safe fallback when the client ID is missing. - Refactor - Replaced local UI implementations with shared re-exports and composed Tailwind configs. - Chores - Added UI package dependencies, PostCSS delegation, and enabled Next.js transpilation for the UI package; lint/scan ignore lists updated. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent a08b62b commit 92896dd

File tree

47 files changed

+350
-881
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+350
-881
lines changed

apps/dashboard/knip.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
"ignoreDependencies": [
1111
"@thirdweb-dev/service-utils",
1212
"@thirdweb-dev/vault-sdk",
13+
"thirdweb",
1314
"@types/color",
14-
"fast-xml-parser"
15+
"fast-xml-parser",
16+
"@workspace/ui",
17+
"tailwindcss-animate"
1518
],
1619
"next": true,
1720
"project": ["src/**"]

apps/dashboard/next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ const SENTRY_OPTIONS: SentryBuildOptions = {
115115
const FRAMER_ADDITIONAL_LANGUAGES = ["es"];
116116

117117
const baseNextConfig: NextConfig = {
118+
transpilePackages: ["@workspace/ui"],
118119
eslint: {
119120
ignoreDuringBuilds: true,
120121
},
@@ -196,7 +197,6 @@ const baseNextConfig: NextConfig = {
196197
]),
197198
];
198199
},
199-
serverExternalPackages: ["pino-pretty"],
200200
};
201201

202202
function getConfig(): NextConfig {

apps/dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@thirdweb-dev/vault-sdk": "workspace:*",
2929
"@vercel/functions": "2.2.2",
3030
"@vercel/og": "^0.6.8",
31+
"@workspace/ui": "workspace:*",
3132
"abitype": "1.0.8",
3233
"class-variance-authority": "^0.7.1",
3334
"clsx": "^2.1.1",

apps/dashboard/postcss.config.js

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

apps/dashboard/postcss.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from "@workspace/ui/postcss.config";

apps/dashboard/src/@/components/sponsored-transactions-table/SponsoredTransactionsTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22
import { keepPreviousData, useQuery } from "@tanstack/react-query";
33
import { useState } from "react";
4-
import type { ThirdwebClient } from "thirdweb/dist/types/client/client";
4+
import type { ThirdwebClient } from "thirdweb";
55
import { analyticsServerProxy } from "@/actions/proxies";
66
import {
77
type SponsoredTransaction,
Lines changed: 3 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,3 @@
1-
import { Slot } from "@radix-ui/react-slot";
2-
import { cva, type VariantProps } from "class-variance-authority";
3-
import * as React from "react";
4-
5-
import { cn } from "@/lib/utils";
6-
7-
const buttonVariants = cva(
8-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
9-
{
10-
defaultVariants: {
11-
size: "default",
12-
variant: "default",
13-
},
14-
variants: {
15-
size: {
16-
default: "h-10 px-4 py-2",
17-
icon: "h-10 w-10",
18-
lg: "h-11 rounded-md px-8",
19-
sm: "h-9 rounded-md px-3",
20-
},
21-
variant: {
22-
default: "bg-foreground text-background hover:bg-foreground/90",
23-
destructive:
24-
"bg-destructive hover:bg-destructive/90 text-destructive-foreground ",
25-
ghost: "hover:bg-accent hover:text-accent-foreground",
26-
link: "underline-offset-4 hover:underline",
27-
outline:
28-
"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
29-
primary: "bg-primary hover:bg-primary/90 text-primary-foreground ",
30-
secondary:
31-
"bg-secondary hover:bg-secondary/80 text-secondary-foreground ",
32-
upsell:
33-
"bg-green-600 text-white hover:bg-green-700 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5 transition-all duration-200",
34-
},
35-
},
36-
},
37-
);
38-
39-
export interface ButtonProps
40-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
41-
VariantProps<typeof buttonVariants> {
42-
asChild?: boolean;
43-
}
44-
45-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
46-
({ className, variant, size, asChild = false, disabled, ...props }, ref) => {
47-
const Comp = asChild ? Slot : "button";
48-
49-
// "button" elements automatically handle the `disabled` attribute.
50-
// For non-button elements rendered via `asChild` (e.g. <a>), we still want
51-
// to visually convey the disabled state and prevent user interaction.
52-
// We do that by conditionally adding the same utility classes that the
53-
// `disabled:` pseudo-variant would normally apply and by setting
54-
// `aria-disabled` for accessibility.
55-
const disabledClass = disabled ? "pointer-events-none opacity-50" : "";
56-
57-
const btnOnlyProps =
58-
Comp === "button"
59-
? {
60-
type:
61-
(props as React.ButtonHTMLAttributes<HTMLButtonElement>).type ||
62-
("button" as const),
63-
}
64-
: undefined;
65-
66-
return (
67-
<Comp
68-
aria-disabled={disabled ? true : undefined}
69-
className={cn(
70-
buttonVariants({ className, size, variant }),
71-
disabledClass,
72-
)}
73-
disabled={disabled}
74-
ref={ref}
75-
{...props}
76-
{...btnOnlyProps}
77-
/>
78-
);
79-
},
80-
);
81-
Button.displayName = "Button";
82-
83-
export { Button, buttonVariants };
1+
"use client";
2+
export type { ButtonProps } from "@workspace/ui/components/button";
3+
export { Button, buttonVariants } from "@workspace/ui/components/button";

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// FIXME: export listing status type
2-
import type { ListingStatus } from "thirdweb/dist/types/extensions/marketplace/types";
1+
import type { ListingStatus } from "thirdweb/extensions/marketplace";
32

43
export const LISTING_STATUS: Record<ListingStatus, string> = {
54
ACTIVE: "Active",

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/claim-conditions-form/hooks.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import {
55
toUnits,
66
} from "thirdweb";
77
import { getContract } from "thirdweb/contract";
8-
import type { OverrideEntry } from "thirdweb/dist/types/utils/extensions/drops/types";
9-
import type { Prettify } from "thirdweb/dist/types/utils/type-utils";
108
import { getContractMetadata } from "thirdweb/extensions/common";
119
import * as ERC20Ext from "thirdweb/extensions/erc20";
1210
import * as ERC721Ext from "thirdweb/extensions/erc721";
1311
import * as ERC1155Ext from "thirdweb/extensions/erc1155";
1412
import { download } from "thirdweb/storage";
13+
import type { OverrideEntry } from "thirdweb/utils";
1514
import { maxUint256 } from "thirdweb/utils";
1615
import type { z } from "zod";
1716
import type {
@@ -26,20 +25,15 @@ type SnapshotEntry = {
2625
currencyAddress?: string | undefined;
2726
};
2827

29-
type CombinedClaimCondition = Prettify<
30-
Omit<
31-
LegacyClaimCondition,
32-
"price" | "waitInSeconds" | "availableSupply" | "currencyMetadata"
33-
> & {
34-
price: bigint;
35-
currencyMetadata: Omit<
36-
LegacyClaimCondition["currencyMetadata"],
37-
"value"
38-
> & {
39-
value: bigint;
40-
};
41-
}
42-
>;
28+
type CombinedClaimCondition = Omit<
29+
LegacyClaimCondition,
30+
"price" | "waitInSeconds" | "availableSupply" | "currencyMetadata"
31+
> & {
32+
price: bigint;
33+
currencyMetadata: Omit<LegacyClaimCondition["currencyMetadata"], "value"> & {
34+
value: bigint;
35+
};
36+
};
4337

4438
type Options =
4539
| {

apps/dashboard/src/app/(app)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "../../global.css";
1+
import "@workspace/ui/global.css";
22
import type { Metadata } from "next";
33
import { Inter } from "next/font/google";
44
import NextTopLoader from "nextjs-toploader";

0 commit comments

Comments
 (0)