Skip to content

Commit 3f12c7f

Browse files
authored
♻️ refactor: Refactor UI components to shared package w/ shadcn/ui (#60)
* ♻️ refactor(ui): Create `cn` utils fn using `tw-merge` and `clsx` * ♻️ chore(student): Use shared UI components in a component * 🔥 chore(ui): Remove unused shared UI components * ✨ feat(ui): Reconfigure `ui` package with `shadcn/ui` * ♻️ refactor(finance): Update imports for new `ui` package * ♻️ refactor(student): Update imports for new `ui` package * 🔥 chore: Remove individual `components.json` for `shadcn/ui` * 💩 chore: Create temp pages to test shared `ui` package * ♻️ refactor(ui): Use shared Tailwind config * 🩹 chore(ui): Reorganize TSConfig file * ⬆️ chore: Update lockfile * ✨ feat(ui): Create components for `finance` service * 🚚 chore(finance): Update import paths to shared `ui` package * 🔥 chore(finance): Remove unused components after refactor * ⬆️ chore: Update lockfile * 🔨 chore: Create script to add `shadcn/ui` components from root * 📌 chore(deps): Standardized deps version mismatch using pnpm catalog * ➖ chore(finance): Remove refactored UI-related dependencies * ✨ feat(ui): Create components for `library` service * 🚚 chore(library): Update import paths to shared `ui` package * 🔥 chore(library): Remove unused components after refactor * ➖ chore(library): Remove refactored UI-related dependencies * ✨ feat(ui): Create components for `student` service * 🚚 chore(student): Update import paths to shared `ui` package * 🔥 chore(student): Remove unused components after refactor * ➖ chore(student): Remove refactored UI-related dependencies * ⬆️ chore: Update lockfile * 🐛 fix(student): Update missing imports * 🔨 chore(ui): Now auto-formats file after adding new component Closes HUB-27, closes HUB-28, closes HUB-29, closes HUB-30
2 parents 8a2f2e9 + 3d51602 commit 3f12c7f

File tree

98 files changed

+329
-2232
lines changed

Some content is hidden

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

98 files changed

+329
-2232
lines changed

apps/finance/package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,12 @@
2424
},
2525
"dependencies": {
2626
"@campus-hub/ui": "workspace:*",
27-
"@radix-ui/react-dialog": "catalog:",
28-
"@radix-ui/react-dropdown-menu": "catalog:",
29-
"@radix-ui/react-slot": "catalog:",
30-
"@radix-ui/react-tooltip": "^1.0.7",
3127
"@t3-oss/env-nextjs": "catalog:",
3228
"@tanstack/react-query": "catalog:",
3329
"@trpc/client": "catalog:",
3430
"@trpc/next": "catalog:",
3531
"@trpc/react-query": "catalog:",
3632
"@trpc/server": "catalog:",
37-
"class-variance-authority": "catalog:",
38-
"clsx": "catalog:",
3933
"date-fns": "catalog:",
4034
"drizzle-orm": "catalog:",
4135
"geist": "catalog:",
@@ -46,10 +40,7 @@
4640
"react": "catalog:react18",
4741
"react-dom": "catalog:react18",
4842
"server-only": "catalog:",
49-
"sonner": "catalog:",
5043
"superjson": "catalog:",
51-
"tailwind-merge": "catalog:",
52-
"tailwindcss-animate": "catalog:",
5344
"tsx": "catalog:",
5445
"zod": "catalog:"
5546
},
@@ -61,7 +52,6 @@
6152
"@types/node": "catalog:",
6253
"@types/react": "catalog:react18",
6354
"@types/react-dom": "catalog:react18",
64-
"autoprefixer": "catalog:",
6555
"dotenv-cli": "catalog:",
6656
"drizzle-kit": "catalog:",
6757
"postcss": "catalog:",

apps/finance/src/app/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from "react";
22
import { GeistSans } from "geist/font/sans";
33

4+
import { Toaster } from "@campus-hub/ui/components/ui/sonner";
5+
46
import { ThemeProvider } from "~/components/theme-provider";
5-
import { Toaster } from "~/components/ui/sonner";
67

78
import "~/styles/globals.css";
89

apps/finance/src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Image from "next/image";
33
import Link from "next/link";
44
import { ArrowRight } from "lucide-react";
55

6-
import { buttonVariants } from "@campus-hub/ui/button";
6+
import { buttonVariants } from "@campus-hub/ui/components/ui/button";
77

88
import { Footer } from "~/components/footer";
99

apps/finance/src/app/pay/invoice/[id]/loading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Skeleton } from "~/components/ui/skeleton";
1+
import { Skeleton } from "@campus-hub/ui/components/ui/skeleton";
22

33
export default function Loading() {
44
return (

apps/finance/src/app/pay/invoice/[id]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import Link from "next/link";
22
import { format } from "date-fns";
33
import { ArrowLeft } from "lucide-react";
44

5-
import { Badge } from "@campus-hub/ui/badge";
6-
import { buttonVariants } from "@campus-hub/ui/button";
5+
import { Badge } from "@campus-hub/ui/components/ui/badge";
6+
import { buttonVariants } from "@campus-hub/ui/components/ui/button";
77

88
import type { invoice } from "~/server/db/schema/main-schema";
99
import { env } from "~/env";

apps/finance/src/app/pay/invoice/[id]/pay-invoice-button.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import { useRouter } from "next/navigation";
55
import { CreditCard } from "lucide-react";
66
import { toast } from "sonner";
77

8-
import { Button } from "@campus-hub/ui/button";
9-
10-
import type { invoice } from "~/server/db/schema/main-schema";
8+
import { Button } from "@campus-hub/ui/components/ui/button";
119
import {
1210
Dialog,
1311
DialogContent,
1412
DialogDescription,
1513
DialogHeader,
1614
DialogTitle,
1715
DialogTrigger,
18-
} from "~/components/ui/dialog";
16+
} from "@campus-hub/ui/components/ui/dialog";
17+
18+
import type { invoice } from "~/server/db/schema/main-schema";
1919
import { api } from "~/trpc/react";
2020

2121
type Invoice = typeof invoice.$inferSelect;

apps/finance/src/app/pay/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Image from "next/image";
22
import Link from "next/link";
33

4-
import { buttonVariants } from "@campus-hub/ui/button";
4+
import { buttonVariants } from "@campus-hub/ui/components/ui/button";
55

66
import { Footer } from "~/components/footer";
77
import { ThemeToggle } from "~/components/theme-toggle";

apps/finance/src/app/test/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Link from "next/link";
2+
3+
import { Button } from "@campus-hub/ui/components/ui/button";
4+
5+
export default function Page() {
6+
return (
7+
<div>
8+
<h1>Home</h1>
9+
<Link href="/test/about">About</Link>
10+
<Button>Click me</Button>
11+
</div>
12+
);
13+
}

apps/finance/src/components/finance-invoice-form.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { useState } from "react";
44
import { useRouter } from "next/navigation";
55
import { Check, Copy } from "lucide-react";
66

7-
import { Button } from "@campus-hub/ui/button";
8-
9-
import { Input } from "~/components/ui/input";
7+
import { Button } from "@campus-hub/ui/components/ui/button";
8+
import { Input } from "@campus-hub/ui/components/ui/input";
109
import {
1110
Tooltip,
1211
TooltipContent,
1312
TooltipProvider,
1413
TooltipTrigger,
15-
} from "~/components/ui/tooltip";
14+
} from "@campus-hub/ui/components/ui/tooltip";
15+
1616
import { sleep } from "~/lib/utils";
1717

1818
export default function FinanceInvoiceForm() {

apps/finance/src/components/theme-toggle.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ import * as React from "react";
44
import { Moon, Sun } from "lucide-react";
55
import { useTheme } from "next-themes";
66

7-
import { Button } from "@campus-hub/ui/button";
8-
7+
import { Button } from "@campus-hub/ui/components/ui/button";
98
import {
109
DropdownMenu,
1110
DropdownMenuContent,
1211
DropdownMenuItem,
1312
DropdownMenuTrigger,
14-
} from "~/components/ui/dropdown-menu";
13+
} from "@campus-hub/ui/components/ui/dropdown-menu";
1514

1615
export function ThemeToggle() {
1716
const { setTheme } = useTheme();

apps/finance/src/components/ui/dialog.tsx

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

0 commit comments

Comments
 (0)