prettier setup
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
// This configuration only applies to the package manager root.
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
module.exports = {
|
||||
ignorePatterns: ["apps/**", "packages/**"],
|
||||
extends: ["@workspace/eslint-config/library.js"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
ignorePatterns: ['apps/**', 'packages/**'],
|
||||
extends: ['@workspace/eslint-config/library.js'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: true,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
11
.prettierignore
Normal file
11
.prettierignore
Normal file
@@ -0,0 +1,11 @@
|
||||
node_modules/
|
||||
build/
|
||||
dist/
|
||||
.next/
|
||||
out/
|
||||
coverage/
|
||||
.DS_Store
|
||||
pnpm-lock.yaml
|
||||
*.env
|
||||
*.log
|
||||
.turbo/
|
||||
8
.prettierrc
Normal file
8
.prettierrc
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 100,
|
||||
"tabWidth": 2,
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -1,3 +1,5 @@
|
||||
{
|
||||
"tailwindCSS.experimental.configFile": "packages/ui/src/styles/globals.css"
|
||||
"tailwindCSS.experimental.configFile": "packages/ui/src/styles/globals.css",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
}
|
||||
|
||||
@@ -27,5 +27,5 @@ Your `tailwind.config.ts` and `globals.css` are already set up to use the compon
|
||||
To use the components in your app, import them from the `ui` package.
|
||||
|
||||
```tsx
|
||||
import { Button } from "@workspace/ui/components/button"
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
```
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
import { handlers } from "@workspace/auth";
|
||||
import { handlers } from '@workspace/auth';
|
||||
export const { GET, POST } = handlers;
|
||||
|
||||
@@ -1,121 +1,119 @@
|
||||
import localFont from "next/font/local"
|
||||
import localFont from 'next/font/local';
|
||||
|
||||
import "@workspace/ui/globals.css"
|
||||
import { Providers } from "@/components/providers"
|
||||
import '@workspace/ui/globals.css';
|
||||
import { Providers } from '@/components/providers';
|
||||
|
||||
const firaSans = localFont({
|
||||
src: [
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Thin.ttf",
|
||||
weight: "100",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Thin.ttf',
|
||||
weight: '100',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ThinItalic.ttf",
|
||||
weight: "100",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-ThinItalic.ttf',
|
||||
weight: '100',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ExtraLight.ttf",
|
||||
weight: "200",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-ExtraLight.ttf',
|
||||
weight: '200',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ExtraLightItalic.ttf",
|
||||
weight: "200",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-ExtraLightItalic.ttf',
|
||||
weight: '200',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Light.ttf",
|
||||
weight: "300",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Light.ttf',
|
||||
weight: '300',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-LightItalic.ttf",
|
||||
weight: "300",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-LightItalic.ttf',
|
||||
weight: '300',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Regular.ttf",
|
||||
weight: "400",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Regular.ttf',
|
||||
weight: '400',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Italic.ttf",
|
||||
weight: "400",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-Italic.ttf',
|
||||
weight: '400',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Medium.ttf",
|
||||
weight: "500",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Medium.ttf',
|
||||
weight: '500',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-MediumItalic.ttf",
|
||||
weight: "500",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-MediumItalic.ttf',
|
||||
weight: '500',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-SemiBold.ttf",
|
||||
weight: "600",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-SemiBold.ttf',
|
||||
weight: '600',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-SemiBoldItalic.ttf",
|
||||
weight: "600",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-SemiBoldItalic.ttf',
|
||||
weight: '600',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Bold.ttf",
|
||||
weight: "700",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Bold.ttf',
|
||||
weight: '700',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-BoldItalic.ttf",
|
||||
weight: "700",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-BoldItalic.ttf',
|
||||
weight: '700',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ExtraBold.ttf",
|
||||
weight: "800",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-ExtraBold.ttf',
|
||||
weight: '800',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ExtraBoldItalic.ttf",
|
||||
weight: "800",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-ExtraBoldItalic.ttf',
|
||||
weight: '800',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Black.ttf",
|
||||
weight: "900",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Black.ttf',
|
||||
weight: '900',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-BlackItalic.ttf",
|
||||
weight: "900",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-BlackItalic.ttf',
|
||||
weight: '900',
|
||||
style: 'italic',
|
||||
},
|
||||
],
|
||||
variable: "--font-sans",
|
||||
})
|
||||
variable: '--font-sans',
|
||||
});
|
||||
|
||||
const marcellus = localFont({
|
||||
src: "../fonts/Marcellus/Marcellus-Regular.ttf",
|
||||
variable: "--font-marcellus",
|
||||
})
|
||||
src: '../fonts/Marcellus/Marcellus-Regular.ttf',
|
||||
variable: '--font-marcellus',
|
||||
});
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<body
|
||||
className={`${firaSans.variable} ${marcellus.variable} font-sans antialiased `}
|
||||
>
|
||||
<body className={`${firaSans.variable} ${marcellus.variable} font-sans antialiased `}>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import Login from "@/components/login";
|
||||
import Studs from "@/components/studs";
|
||||
import { db, admins } from "@workspace/db";
|
||||
import { auth, signIn, signOut } from "@workspace/auth";
|
||||
import Login from '@/components/login';
|
||||
import Studs from '@/components/studs';
|
||||
import { db, admins } from '@workspace/db';
|
||||
import { auth, signIn, signOut } from '@workspace/auth';
|
||||
|
||||
async function getStudents() {
|
||||
"use server";
|
||||
'use server';
|
||||
const s = await db.select().from(admins);
|
||||
console.log(s);
|
||||
}
|
||||
|
||||
async function logIn() {
|
||||
"use server";
|
||||
await signIn("google");
|
||||
'use server';
|
||||
await signIn('google');
|
||||
}
|
||||
|
||||
async function logOut() {
|
||||
"use server";
|
||||
'use server';
|
||||
await signOut();
|
||||
}
|
||||
|
||||
@@ -24,9 +24,7 @@ export default async function Page() {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-svh">
|
||||
<div className="flex flex-col items-center justify-center gap-4">
|
||||
<h1 className="text-2xl font-bold">
|
||||
Hello admin {session?.user?.name}
|
||||
</h1>
|
||||
<h1 className="text-2xl font-bold">Hello admin {session?.user?.name}</h1>
|
||||
{!session?.user && <Login action={logIn} />}
|
||||
<Studs action={getStudents} logOut={logOut} />
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { signIn } from "@workspace/auth";
|
||||
import { Button } from "@workspace/ui/components/button";
|
||||
'use client';
|
||||
import { signIn } from '@workspace/auth';
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
|
||||
export default function Login({ action }: { action: () => Promise<void> }) {
|
||||
return (
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
"use client";
|
||||
'use client';
|
||||
|
||||
import * as React from "react";
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||
import * as React from 'react';
|
||||
import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
||||
|
||||
export function Providers({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<NextThemesProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
enableSystem
|
||||
enableColorScheme
|
||||
>
|
||||
<NextThemesProvider attribute="class" defaultTheme="system" enableSystem enableColorScheme>
|
||||
{children}
|
||||
</NextThemesProvider>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button } from "@workspace/ui/components/button";
|
||||
import { auth } from "@workspace/auth";
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
import { auth } from '@workspace/auth';
|
||||
|
||||
export default async function Studs({
|
||||
action,
|
||||
@@ -12,7 +12,9 @@ export default async function Studs({
|
||||
if (!session?.user) return null;
|
||||
return (
|
||||
<div className="flex gap-2">
|
||||
<Button onClick={action} variant="outline">Click me</Button>
|
||||
<Button onClick={action} variant="outline">
|
||||
Click me
|
||||
</Button>
|
||||
<Button onClick={logOut}>Sign Out</Button>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { nextJsConfig } from "@workspace/eslint-config/next-js"
|
||||
import { nextJsConfig } from '@workspace/eslint-config/next-js';
|
||||
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
export default nextJsConfig
|
||||
export default nextJsConfig;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { auth } from "@workspace/auth";
|
||||
import { auth } from '@workspace/auth';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
export default auth((req: any) => {
|
||||
// If the user is unauthenticated or an admin, allow the request.
|
||||
if (!req.auth || req.auth.user?.role === "ADMIN") {
|
||||
if (!req.auth || req.auth.user?.role === 'ADMIN') {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// Otherwise, redirect to the student app.
|
||||
const studentUrl = process.env.STUDENT_URL ?? "http://localhost:3000"
|
||||
const studentUrl = process.env.STUDENT_URL ?? 'http://localhost:3000';
|
||||
|
||||
return NextResponse.redirect(new URL(studentUrl, req.url));
|
||||
}) as any;
|
||||
|
||||
export const config = {
|
||||
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
|
||||
}
|
||||
matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
|
||||
};
|
||||
|
||||
12
apps/admin/next-auth.d.ts
vendored
12
apps/admin/next-auth.d.ts
vendored
@@ -1,19 +1,19 @@
|
||||
import "next-auth";
|
||||
import 'next-auth';
|
||||
|
||||
declare module "next-auth" {
|
||||
declare module 'next-auth' {
|
||||
interface Session {
|
||||
user: {
|
||||
role?: "ADMIN" | "USER";
|
||||
role?: 'ADMIN' | 'USER';
|
||||
adminId?: number;
|
||||
studentId?: number;
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
}
|
||||
declare module "next-auth/jwt" {
|
||||
declare module 'next-auth/jwt' {
|
||||
interface JWT {
|
||||
role?: "ADMIN" | "USER";
|
||||
role?: 'ADMIN' | 'USER';
|
||||
adminId?: number;
|
||||
studentId?: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
transpilePackages: ["@workspace/ui", "@workspace/db", "@workspace/auth"],
|
||||
transpilePackages: ['@workspace/ui', '@workspace/db', '@workspace/auth'],
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^5.1.1",
|
||||
"@workspace/auth": "workspace:*",
|
||||
"@workspace/db": "workspace:*",
|
||||
"@workspace/ui": "workspace:*",
|
||||
@@ -22,9 +21,7 @@
|
||||
"next-auth": "^4.24.11",
|
||||
"next-themes": "^0.4.4",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-hook-form": "^7.58.1",
|
||||
"zod": "^3.24.2"
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20",
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { default } from "@workspace/ui/postcss.config";
|
||||
export { default } from '@workspace/ui/postcss.config';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"@/*": ["./*"],
|
||||
"@workspace/ui/*": ["../../packages/ui/src/*"],
|
||||
"@workspace/db/*": ["../../packages/db/src/*"],
|
||||
"@workspace/auth/*": ["../../packages/auth/src/*"],
|
||||
"@workspace/auth/*": ["../../packages/auth/src/*"]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
@@ -14,12 +14,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"next.config.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"include": ["next-env.d.ts", "next.config.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
import { handlers } from "@workspace/auth";
|
||||
import { handlers } from '@workspace/auth';
|
||||
export const { GET, POST } = handlers;
|
||||
|
||||
@@ -1,121 +1,119 @@
|
||||
import localFont from "next/font/local"
|
||||
import localFont from 'next/font/local';
|
||||
|
||||
import "@workspace/ui/globals.css"
|
||||
import { Providers } from "@/components/providers"
|
||||
import '@workspace/ui/globals.css';
|
||||
import { Providers } from '@/components/providers';
|
||||
|
||||
const firaSans = localFont({
|
||||
src: [
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Thin.ttf",
|
||||
weight: "100",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Thin.ttf',
|
||||
weight: '100',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ThinItalic.ttf",
|
||||
weight: "100",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-ThinItalic.ttf',
|
||||
weight: '100',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ExtraLight.ttf",
|
||||
weight: "200",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-ExtraLight.ttf',
|
||||
weight: '200',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ExtraLightItalic.ttf",
|
||||
weight: "200",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-ExtraLightItalic.ttf',
|
||||
weight: '200',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Light.ttf",
|
||||
weight: "300",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Light.ttf',
|
||||
weight: '300',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-LightItalic.ttf",
|
||||
weight: "300",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-LightItalic.ttf',
|
||||
weight: '300',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Regular.ttf",
|
||||
weight: "400",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Regular.ttf',
|
||||
weight: '400',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Italic.ttf",
|
||||
weight: "400",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-Italic.ttf',
|
||||
weight: '400',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Medium.ttf",
|
||||
weight: "500",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Medium.ttf',
|
||||
weight: '500',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-MediumItalic.ttf",
|
||||
weight: "500",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-MediumItalic.ttf',
|
||||
weight: '500',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-SemiBold.ttf",
|
||||
weight: "600",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-SemiBold.ttf',
|
||||
weight: '600',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-SemiBoldItalic.ttf",
|
||||
weight: "600",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-SemiBoldItalic.ttf',
|
||||
weight: '600',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Bold.ttf",
|
||||
weight: "700",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Bold.ttf',
|
||||
weight: '700',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-BoldItalic.ttf",
|
||||
weight: "700",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-BoldItalic.ttf',
|
||||
weight: '700',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ExtraBold.ttf",
|
||||
weight: "800",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-ExtraBold.ttf',
|
||||
weight: '800',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-ExtraBoldItalic.ttf",
|
||||
weight: "800",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-ExtraBoldItalic.ttf',
|
||||
weight: '800',
|
||||
style: 'italic',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-Black.ttf",
|
||||
weight: "900",
|
||||
style: "normal",
|
||||
path: '../fonts/Fira-sans/FiraSans-Black.ttf',
|
||||
weight: '900',
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
path: "../fonts/Fira-sans/FiraSans-BlackItalic.ttf",
|
||||
weight: "900",
|
||||
style: "italic",
|
||||
path: '../fonts/Fira-sans/FiraSans-BlackItalic.ttf',
|
||||
weight: '900',
|
||||
style: 'italic',
|
||||
},
|
||||
],
|
||||
variable: "--font-sans",
|
||||
})
|
||||
variable: '--font-sans',
|
||||
});
|
||||
|
||||
const marcellus = localFont({
|
||||
src: "../fonts/Marcellus/Marcellus-Regular.ttf",
|
||||
variable: "--font-marcellus",
|
||||
})
|
||||
src: '../fonts/Marcellus/Marcellus-Regular.ttf',
|
||||
variable: '--font-marcellus',
|
||||
});
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<body
|
||||
className={`${firaSans.variable} ${marcellus.variable} font-sans antialiased `}
|
||||
>
|
||||
<body className={`${firaSans.variable} ${marcellus.variable} font-sans antialiased `}>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import Login from "@/components/login";
|
||||
import Studs from "@/components/studs";
|
||||
import { db, admins } from "@workspace/db";
|
||||
import { auth, signIn, signOut } from "@workspace/auth";
|
||||
import Login from '@/components/login';
|
||||
import Studs from '@/components/studs';
|
||||
import { db, admins } from '@workspace/db';
|
||||
import { auth, signIn, signOut } from '@workspace/auth';
|
||||
|
||||
async function getStudents() {
|
||||
"use server";
|
||||
'use server';
|
||||
const s = await db.select().from(admins);
|
||||
console.log(s);
|
||||
}
|
||||
|
||||
async function logIn() {
|
||||
"use server";
|
||||
await signIn("google");
|
||||
'use server';
|
||||
await signIn('google');
|
||||
}
|
||||
|
||||
async function logOut() {
|
||||
"use server";
|
||||
'use server';
|
||||
await signOut();
|
||||
}
|
||||
|
||||
export default async function Page() {
|
||||
const session = await auth()
|
||||
const session = await auth();
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-svh">
|
||||
<div className="flex flex-col items-center justify-center gap-4">
|
||||
|
||||
@@ -1,151 +1,176 @@
|
||||
"use client"
|
||||
'use client';
|
||||
|
||||
import { useState } from "react"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import * as z from "zod"
|
||||
import { Button } from "@workspace/ui/components/button"
|
||||
import { Input } from "@workspace/ui/components/input"
|
||||
import { Textarea } from "@workspace/ui/components/textarea"
|
||||
import { Progress } from "@workspace/ui/components/progress"
|
||||
import { Separator } from "@workspace/ui/components/separator"
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, FormDescription } from "@workspace/ui/components/form"
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@workspace/ui/components/select"
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@workspace/ui/components/card"
|
||||
import { useState } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import * as z from 'zod';
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
import { Input } from '@workspace/ui/components/input';
|
||||
import { Textarea } from '@workspace/ui/components/textarea';
|
||||
import { Progress } from '@workspace/ui/components/progress';
|
||||
import { Separator } from '@workspace/ui/components/separator';
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
FormDescription,
|
||||
} from '@workspace/ui/components/form';
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@workspace/ui/components/select';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@workspace/ui/components/card';
|
||||
|
||||
// Form schema
|
||||
const formSchema = z.object({
|
||||
// Personal Details
|
||||
firstName: z.string().min(1, "First name is required"),
|
||||
lastName: z.string().min(1, "Last name is required"),
|
||||
firstName: z.string().min(1, 'First name is required'),
|
||||
lastName: z.string().min(1, 'Last name is required'),
|
||||
fathersName: z.string().optional(),
|
||||
mothersName: z.string().optional(),
|
||||
email: z.string().email("Invalid email address"),
|
||||
rollNumber: z.string().min(1, "Roll number is required"),
|
||||
phoneNumber: z.string().min(10, "Phone number must be at least 10 digits"),
|
||||
address: z.string().min(1, "Address is required"),
|
||||
email: z.string().email('Invalid email address'),
|
||||
rollNumber: z.string().min(1, 'Roll number is required'),
|
||||
phoneNumber: z.string().min(10, 'Phone number must be at least 10 digits'),
|
||||
address: z.string().min(1, 'Address is required'),
|
||||
|
||||
// Academic Details
|
||||
degree: z.string().min(1, "Degree is required"),
|
||||
year: z.string().min(1, "Year is required"),
|
||||
branch: z.string().min(1, "Branch is required"),
|
||||
ssc: z.string().min(1, "SSC percentage is required"),
|
||||
hsc: z.string().min(1, "HSC percentage is required"),
|
||||
degree: z.string().min(1, 'Degree is required'),
|
||||
year: z.string().min(1, 'Year is required'),
|
||||
branch: z.string().min(1, 'Branch is required'),
|
||||
ssc: z.string().min(1, 'SSC percentage is required'),
|
||||
hsc: z.string().min(1, 'HSC percentage is required'),
|
||||
|
||||
// Semester Grades
|
||||
sem1: z.string().min(1, "Semester 1 grade is required"),
|
||||
sem1KT: z.string().min(1, "Semester 1 KT status is required"),
|
||||
sem2: z.string().min(1, "Semester 2 grade is required"),
|
||||
sem2KT: z.string().min(1, "Semester 2 KT status is required"),
|
||||
sem1: z.string().min(1, 'Semester 1 grade is required'),
|
||||
sem1KT: z.string().min(1, 'Semester 1 KT status is required'),
|
||||
sem2: z.string().min(1, 'Semester 2 grade is required'),
|
||||
sem2KT: z.string().min(1, 'Semester 2 KT status is required'),
|
||||
|
||||
// Additional Details
|
||||
linkedin: z.string().url("Invalid LinkedIn URL"),
|
||||
github: z.string().url("Invalid GitHub URL"),
|
||||
linkedin: z.string().url('Invalid LinkedIn URL'),
|
||||
github: z.string().url('Invalid GitHub URL'),
|
||||
skills: z.string().optional(),
|
||||
})
|
||||
});
|
||||
|
||||
type FormData = z.infer<typeof formSchema>
|
||||
type FormData = z.infer<typeof formSchema>;
|
||||
|
||||
const steps = [
|
||||
{
|
||||
id: 1,
|
||||
title: "Personal Details",
|
||||
fields: ["firstName", "lastName", "fathersName", "mothersName", "email", "rollNumber", "phoneNumber", "address"],
|
||||
title: 'Personal Details',
|
||||
fields: [
|
||||
'firstName',
|
||||
'lastName',
|
||||
'fathersName',
|
||||
'mothersName',
|
||||
'email',
|
||||
'rollNumber',
|
||||
'phoneNumber',
|
||||
'address',
|
||||
],
|
||||
},
|
||||
{ id: 2, title: "Academic Details", fields: ["degree", "year", "branch", "ssc", "hsc"] },
|
||||
{ id: 3, title: "Semester Grades", fields: ["sem1", "sem1KT", "sem2", "sem2KT"] },
|
||||
{ id: 4, title: "Additional Details", fields: ["linkedin", "github", "skills"] },
|
||||
]
|
||||
{ id: 2, title: 'Academic Details', fields: ['degree', 'year', 'branch', 'ssc', 'hsc'] },
|
||||
{ id: 3, title: 'Semester Grades', fields: ['sem1', 'sem1KT', 'sem2', 'sem2KT'] },
|
||||
{ id: 4, title: 'Additional Details', fields: ['linkedin', 'github', 'skills'] },
|
||||
];
|
||||
|
||||
export default function StudentRegistrationForm() {
|
||||
const [currentStep, setCurrentStep] = useState(1)
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
const [currentStep, setCurrentStep] = useState(1);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
const form = useForm<FormData>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
fathersName: "",
|
||||
mothersName: "",
|
||||
email: "",
|
||||
rollNumber: "",
|
||||
phoneNumber: "",
|
||||
address: "",
|
||||
degree: "",
|
||||
year: "",
|
||||
branch: "",
|
||||
ssc: "",
|
||||
hsc: "",
|
||||
sem1: "",
|
||||
sem1KT: "",
|
||||
sem2: "",
|
||||
sem2KT: "",
|
||||
linkedin: "",
|
||||
github: "",
|
||||
skills: "",
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
fathersName: '',
|
||||
mothersName: '',
|
||||
email: '',
|
||||
rollNumber: '',
|
||||
phoneNumber: '',
|
||||
address: '',
|
||||
degree: '',
|
||||
year: '',
|
||||
branch: '',
|
||||
ssc: '',
|
||||
hsc: '',
|
||||
sem1: '',
|
||||
sem1KT: '',
|
||||
sem2: '',
|
||||
sem2KT: '',
|
||||
linkedin: '',
|
||||
github: '',
|
||||
skills: '',
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
const validateCurrentStep = async () => {
|
||||
const currentStepData = steps.find((step) => step.id === currentStep)
|
||||
if (!currentStepData) return false
|
||||
const currentStepData = steps.find((step) => step.id === currentStep);
|
||||
if (!currentStepData) return false;
|
||||
|
||||
const result = await form.trigger(currentStepData.fields as any)
|
||||
return result
|
||||
}
|
||||
const result = await form.trigger(currentStepData.fields as any);
|
||||
return result;
|
||||
};
|
||||
|
||||
const nextStep = async () => {
|
||||
const isValid = await validateCurrentStep()
|
||||
const isValid = await validateCurrentStep();
|
||||
if (isValid && currentStep < steps.length) {
|
||||
setCurrentStep(currentStep + 1)
|
||||
setCurrentStep(currentStep + 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const prevStep = () => {
|
||||
if (currentStep > 1) {
|
||||
setCurrentStep(currentStep - 1)
|
||||
setCurrentStep(currentStep - 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = async (data: FormData) => {
|
||||
setIsSubmitting(true)
|
||||
setIsSubmitting(true);
|
||||
try {
|
||||
// Simulate API call
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
console.log("Form submitted:", data)
|
||||
alert("Form submitted successfully!")
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
console.log('Form submitted:', data);
|
||||
alert('Form submitted successfully!');
|
||||
} catch (error) {
|
||||
console.error("Submission error:", error)
|
||||
alert("Submission failed. Please try again.")
|
||||
console.error('Submission error:', error);
|
||||
alert('Submission failed. Please try again.');
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const renderStep = () => {
|
||||
switch (currentStep) {
|
||||
case 1:
|
||||
return <PersonalDetailsStep form={form} />
|
||||
return <PersonalDetailsStep form={form} />;
|
||||
case 2:
|
||||
return <AcademicDetailsStep form={form} />
|
||||
return <AcademicDetailsStep form={form} />;
|
||||
case 3:
|
||||
return <SemesterGradesStep form={form} />
|
||||
return <SemesterGradesStep form={form} />;
|
||||
case 4:
|
||||
return <AdditionalDetailsStep form={form} />
|
||||
return <AdditionalDetailsStep form={form} />;
|
||||
default:
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const progress = (currentStep / steps.length) * 100
|
||||
const progress = (currentStep / steps.length) * 100;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen py-8">
|
||||
<div className="max-w-3xl mx-auto px-4">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-2xl font-bold text-center">Student Registration Form</CardTitle>
|
||||
<CardTitle className="text-2xl font-bold text-center">
|
||||
Student Registration Form
|
||||
</CardTitle>
|
||||
<div className="space-y-2">
|
||||
<div className="flex justify-between text-sm text-muted-foreground">
|
||||
<span>
|
||||
@@ -162,13 +187,18 @@ export default function StudentRegistrationForm() {
|
||||
{renderStep()}
|
||||
|
||||
<div className="flex justify-between pt-6">
|
||||
<Button type="button" variant="outline" onClick={prevStep} disabled={currentStep === 1}>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={prevStep}
|
||||
disabled={currentStep === 1}
|
||||
>
|
||||
Previous
|
||||
</Button>
|
||||
|
||||
{currentStep === steps.length ? (
|
||||
<Button type="submit" disabled={isSubmitting}>
|
||||
{isSubmitting ? "Submitting..." : "Submit"}
|
||||
{isSubmitting ? 'Submitting...' : 'Submit'}
|
||||
</Button>
|
||||
) : (
|
||||
<Button type="button" onClick={nextStep}>
|
||||
@@ -182,7 +212,7 @@ export default function StudentRegistrationForm() {
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function PersonalDetailsStep({ form }: { form: any }) {
|
||||
@@ -308,30 +338,30 @@ function PersonalDetailsStep({ form }: { form: any }) {
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function AcademicDetailsStep({ form }: { form: any }) {
|
||||
const degreeOptions = [
|
||||
{ value: "btech", label: "B.Tech" },
|
||||
{ value: "be", label: "B.E." },
|
||||
{ value: "bsc", label: "B.Sc" },
|
||||
{ value: "bca", label: "BCA" },
|
||||
]
|
||||
{ value: 'btech', label: 'B.Tech' },
|
||||
{ value: 'be', label: 'B.E.' },
|
||||
{ value: 'bsc', label: 'B.Sc' },
|
||||
{ value: 'bca', label: 'BCA' },
|
||||
];
|
||||
|
||||
const yearOptions = [
|
||||
{ value: "2024", label: "2024" },
|
||||
{ value: "2025", label: "2025" },
|
||||
{ value: "2026", label: "2026" },
|
||||
{ value: "2027", label: "2027" },
|
||||
]
|
||||
{ value: '2024', label: '2024' },
|
||||
{ value: '2025', label: '2025' },
|
||||
{ value: '2026', label: '2026' },
|
||||
{ value: '2027', label: '2027' },
|
||||
];
|
||||
|
||||
const branchOptions = [
|
||||
{ value: "cse", label: "Computer Science" },
|
||||
{ value: "it", label: "Information Technology" },
|
||||
{ value: "ece", label: "Electronics & Communication" },
|
||||
{ value: "mechanical", label: "Mechanical" },
|
||||
]
|
||||
{ value: 'cse', label: 'Computer Science' },
|
||||
{ value: 'it', label: 'Information Technology' },
|
||||
{ value: 'ece', label: 'Electronics & Communication' },
|
||||
{ value: 'mechanical', label: 'Mechanical' },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
@@ -443,16 +473,16 @@ function AcademicDetailsStep({ form }: { form: any }) {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SemesterGradesStep({ form }: { form: any }) {
|
||||
const ktOptions = [
|
||||
{ value: "0", label: "0 KT" },
|
||||
{ value: "1", label: "1 KT" },
|
||||
{ value: "2", label: "2 KT" },
|
||||
{ value: "3+", label: "3+ KT" },
|
||||
]
|
||||
{ value: '0', label: '0 KT' },
|
||||
{ value: '1', label: '1 KT' },
|
||||
{ value: '2', label: '2 KT' },
|
||||
{ value: '3+', label: '3+ KT' },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
@@ -538,7 +568,7 @@ function SemesterGradesStep({ form }: { form: any }) {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function AdditionalDetailsStep({ form }: { form: any }) {
|
||||
@@ -594,5 +624,5 @@ function AdditionalDetailsStep({ form }: { form: any }) {
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1,24 +1,20 @@
|
||||
"use client";
|
||||
import { signIn } from "@workspace/auth";
|
||||
import { Button } from "@workspace/ui/components/button";
|
||||
'use client';
|
||||
import { signIn } from '@workspace/auth';
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
|
||||
export default function Login({logIn}: {logIn: () => Promise<void>}) {
|
||||
export default function Login({ logIn }: { logIn: () => Promise<void> }) {
|
||||
return (
|
||||
<form action={logIn}>
|
||||
<Button
|
||||
type="submit"
|
||||
variant="outline"
|
||||
className="w-full h-12"
|
||||
>
|
||||
<div className="absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/10 to-primary/0 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700 ease-out pointer-events-none" />
|
||||
<img
|
||||
src="https://static.cdnlogo.com/logos/g/35/google-icon.svg"
|
||||
alt="Google logo"
|
||||
className="w-5 h-5 transition-transform duration-200"
|
||||
/>
|
||||
<span className="relative z-10 font-medium transition-colors duration-200 group-hover:text-foreground">
|
||||
Sign in with Google
|
||||
</span>
|
||||
<Button type="submit" variant="outline" className="w-full h-12">
|
||||
<div className="absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/10 to-primary/0 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700 ease-out pointer-events-none" />
|
||||
<img
|
||||
src="https://static.cdnlogo.com/logos/g/35/google-icon.svg"
|
||||
alt="Google logo"
|
||||
className="w-5 h-5 transition-transform duration-200"
|
||||
/>
|
||||
<span className="relative z-10 font-medium transition-colors duration-200 group-hover:text-foreground">
|
||||
Sign in with Google
|
||||
</span>
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
"use client";
|
||||
'use client';
|
||||
|
||||
import * as React from "react";
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||
import * as React from 'react';
|
||||
import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
||||
|
||||
export function Providers({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<NextThemesProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
enableSystem
|
||||
enableColorScheme
|
||||
>
|
||||
<NextThemesProvider attribute="class" defaultTheme="system" enableSystem enableColorScheme>
|
||||
{children}
|
||||
</NextThemesProvider>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button } from "@workspace/ui/components/button";
|
||||
import { auth } from "@workspace/auth";
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
import { auth } from '@workspace/auth';
|
||||
|
||||
export default async function Studs({
|
||||
action,
|
||||
@@ -12,7 +12,9 @@ export default async function Studs({
|
||||
if (!session?.user) return null;
|
||||
return (
|
||||
<div className="flex gap-2">
|
||||
<Button onClick={action} variant="outline">Click me</Button>
|
||||
<Button onClick={action} variant="outline">
|
||||
Click me
|
||||
</Button>
|
||||
<Button onClick={logOut}>Sign Out</Button>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { nextJsConfig } from "@workspace/eslint-config/next-js"
|
||||
import { nextJsConfig } from '@workspace/eslint-config/next-js';
|
||||
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
export default nextJsConfig
|
||||
export default nextJsConfig;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { auth } from "@workspace/auth";
|
||||
import { auth } from '@workspace/auth';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
export default auth((req: any) => {
|
||||
// If the user is unauthenticated or a student, allow the request.
|
||||
if (!req.auth || req.auth.user?.role === "USER") {
|
||||
if (!req.auth || req.auth.user?.role === 'USER') {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// Otherwise, redirect to the admin app.
|
||||
const adminURL = process.env.ADMIN_URL ?? "http://localhost:3001"
|
||||
const adminURL = process.env.ADMIN_URL ?? 'http://localhost:3001';
|
||||
|
||||
return NextResponse.redirect(new URL(adminURL, req.url));
|
||||
}) as any;
|
||||
|
||||
export const config = {
|
||||
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
|
||||
}
|
||||
matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
|
||||
};
|
||||
|
||||
12
apps/student/next-auth.d.ts
vendored
12
apps/student/next-auth.d.ts
vendored
@@ -1,9 +1,9 @@
|
||||
import "next-auth";
|
||||
import 'next-auth';
|
||||
|
||||
declare module "next-auth" {
|
||||
declare module 'next-auth' {
|
||||
interface Session {
|
||||
user: {
|
||||
role?: "ADMIN" | "USER";
|
||||
role?: 'ADMIN' | 'USER';
|
||||
adminId?: number;
|
||||
studentId?: number;
|
||||
[key: string]: any;
|
||||
@@ -11,10 +11,10 @@ declare module "next-auth" {
|
||||
}
|
||||
}
|
||||
|
||||
declare module "next-auth/jwt" {
|
||||
declare module 'next-auth/jwt' {
|
||||
interface JWT {
|
||||
role?: "ADMIN" | "USER";
|
||||
role?: 'ADMIN' | 'USER';
|
||||
adminId?: number;
|
||||
studentId?: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
transpilePackages: ["@workspace/ui", "@workspace/auth", "@workspace/db"],
|
||||
transpilePackages: ['@workspace/ui', '@workspace/auth', '@workspace/db'],
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^5.1.1",
|
||||
"@workspace/ui": "workspace:*",
|
||||
"@workspace/db": "workspace:*",
|
||||
"@workspace/auth": "workspace:*",
|
||||
@@ -20,7 +21,9 @@
|
||||
"next-auth": "^4.24.11",
|
||||
"next-themes": "^0.4.4",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
"react-dom": "^19.0.0",
|
||||
"react-hook-form": "^7.58.1",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20",
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { default } from "@workspace/ui/postcss.config";
|
||||
export { default } from '@workspace/ui/postcss.config';
|
||||
|
||||
@@ -14,12 +14,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"next.config.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"include": ["next-env.d.ts", "next.config.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import NextAuth, { type NextAuthConfig } from "next-auth";
|
||||
import Google from "next-auth/providers/google";
|
||||
import { db, admins, students } from "@workspace/db";
|
||||
import { eq } from "drizzle-orm";
|
||||
import NextAuth, { type NextAuthConfig } from 'next-auth';
|
||||
import Google from 'next-auth/providers/google';
|
||||
import { db, admins, students } from '@workspace/db';
|
||||
import { eq } from 'drizzle-orm';
|
||||
|
||||
const authConfig: NextAuthConfig = {
|
||||
providers: [Google],
|
||||
@@ -9,16 +9,12 @@ const authConfig: NextAuthConfig = {
|
||||
async jwt({ token, account, user, profile }) {
|
||||
// Only check DB on first sign in
|
||||
if (account && user && user.email) {
|
||||
const admin = await db
|
||||
.select()
|
||||
.from(admins)
|
||||
.where(eq(admins.email, user.email))
|
||||
.limit(1);
|
||||
const admin = await db.select().from(admins).where(eq(admins.email, user.email)).limit(1);
|
||||
if (admin.length > 0 && admin[0]) {
|
||||
token.role = "ADMIN";
|
||||
token.role = 'ADMIN';
|
||||
token.adminId = admin[0].id;
|
||||
} else {
|
||||
token.role = "USER";
|
||||
token.role = 'USER';
|
||||
const student = await db
|
||||
.select()
|
||||
.from(students)
|
||||
@@ -27,9 +23,9 @@ const authConfig: NextAuthConfig = {
|
||||
if (student.length > 0 && student[0]) {
|
||||
token.studentId = student[0].id;
|
||||
} else {
|
||||
const nameParts = user.name?.split(" ") ?? [];
|
||||
const firstName = nameParts[0] || "";
|
||||
const lastName = nameParts.slice(1).join(" ") || "";
|
||||
const nameParts = user.name?.split(' ') ?? [];
|
||||
const firstName = nameParts[0] || '';
|
||||
const lastName = nameParts.slice(1).join(' ') || '';
|
||||
const newStudent = await db
|
||||
.insert(students)
|
||||
.values({
|
||||
@@ -49,7 +45,7 @@ const authConfig: NextAuthConfig = {
|
||||
},
|
||||
async session({ session, token }) {
|
||||
if (token?.role) {
|
||||
session.user.role = token.role as "ADMIN" | "USER";
|
||||
session.user.role = token.role as 'ADMIN' | 'USER';
|
||||
}
|
||||
if (token?.adminId) {
|
||||
session.user.adminId = token.adminId as number;
|
||||
|
||||
14
packages/auth/types.d.ts
vendored
14
packages/auth/types.d.ts
vendored
@@ -1,20 +1,20 @@
|
||||
import "next-auth";
|
||||
import "next-auth/jwt";
|
||||
import 'next-auth';
|
||||
import 'next-auth/jwt';
|
||||
|
||||
declare module "next-auth" {
|
||||
declare module 'next-auth' {
|
||||
interface Session {
|
||||
user: {
|
||||
role?: "ADMIN" | "USER";
|
||||
role?: 'ADMIN' | 'USER';
|
||||
adminId?: number;
|
||||
studentId?: number;
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
}
|
||||
declare module "next-auth/jwt" {
|
||||
declare module 'next-auth/jwt' {
|
||||
interface JWT {
|
||||
role?: "ADMIN" | "USER";
|
||||
role?: 'ADMIN' | 'USER';
|
||||
adminId?: number;
|
||||
studentId?: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { config } from "dotenv";
|
||||
import { defineConfig } from "drizzle-kit";
|
||||
import { config } from 'dotenv';
|
||||
import { defineConfig } from 'drizzle-kit';
|
||||
|
||||
config({ path: "../../.env" });
|
||||
config({ path: '../../.env' });
|
||||
|
||||
export default defineConfig({
|
||||
schema: "./schema.ts",
|
||||
out: "./migrations",
|
||||
dialect: "postgresql",
|
||||
schema: './schema.ts',
|
||||
out: './migrations',
|
||||
dialect: 'postgresql',
|
||||
dbCredentials: {
|
||||
url: process.env.DATABASE_URL!,
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { drizzle } from "drizzle-orm/neon-http";
|
||||
import { drizzle } from 'drizzle-orm/neon-http';
|
||||
|
||||
export const db = drizzle(process.env.DATABASE_URL!);
|
||||
|
||||
export * from "./schema";
|
||||
export * from './schema';
|
||||
|
||||
@@ -60,12 +60,8 @@
|
||||
"name": "applications_job_id_jobs_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "jobs",
|
||||
"columnsFrom": [
|
||||
"job_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["job_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -73,12 +69,8 @@
|
||||
"name": "applications_student_id_students_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -86,12 +78,8 @@
|
||||
"name": "applications_resume_id_resumes_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "resumes",
|
||||
"columnsFrom": [
|
||||
"resume_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["resume_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -157,12 +145,8 @@
|
||||
"name": "certificates_student_id_students_id_fk",
|
||||
"tableFrom": "certificates",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -303,12 +287,8 @@
|
||||
"name": "grades_student_id_students_id_fk",
|
||||
"tableFrom": "grades",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -398,12 +378,8 @@
|
||||
"name": "internships_student_id_students_id_fk",
|
||||
"tableFrom": "internships",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -535,12 +511,8 @@
|
||||
"name": "jobs_company_id_companies_id_fk",
|
||||
"tableFrom": "jobs",
|
||||
"tableTo": "companies",
|
||||
"columnsFrom": [
|
||||
"company_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["company_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -607,12 +579,8 @@
|
||||
"name": "projects_student_id_students_id_fk",
|
||||
"tableFrom": "projects",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -672,12 +640,8 @@
|
||||
"name": "resumes_student_id_students_id_fk",
|
||||
"tableFrom": "resumes",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -843,4 +807,4 @@
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,12 +60,8 @@
|
||||
"name": "applications_job_id_jobs_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "jobs",
|
||||
"columnsFrom": [
|
||||
"job_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["job_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -73,12 +69,8 @@
|
||||
"name": "applications_student_id_students_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -86,12 +78,8 @@
|
||||
"name": "applications_resume_id_resumes_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "resumes",
|
||||
"columnsFrom": [
|
||||
"resume_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["resume_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -157,12 +145,8 @@
|
||||
"name": "certificates_student_id_students_id_fk",
|
||||
"tableFrom": "certificates",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -303,12 +287,8 @@
|
||||
"name": "grades_student_id_students_id_fk",
|
||||
"tableFrom": "grades",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -398,12 +378,8 @@
|
||||
"name": "internships_student_id_students_id_fk",
|
||||
"tableFrom": "internships",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -535,12 +511,8 @@
|
||||
"name": "jobs_company_id_companies_id_fk",
|
||||
"tableFrom": "jobs",
|
||||
"tableTo": "companies",
|
||||
"columnsFrom": [
|
||||
"company_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["company_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -607,12 +579,8 @@
|
||||
"name": "projects_student_id_students_id_fk",
|
||||
"tableFrom": "projects",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -672,12 +640,8 @@
|
||||
"name": "resumes_student_id_students_id_fk",
|
||||
"tableFrom": "resumes",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -843,4 +807,4 @@
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,7 @@
|
||||
"admins_email_unique": {
|
||||
"name": "admins_email_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"email"
|
||||
]
|
||||
"columns": ["email"]
|
||||
}
|
||||
},
|
||||
"policies": {},
|
||||
@@ -107,12 +105,8 @@
|
||||
"name": "applications_job_id_jobs_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "jobs",
|
||||
"columnsFrom": [
|
||||
"job_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["job_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -120,12 +114,8 @@
|
||||
"name": "applications_student_id_students_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -133,12 +123,8 @@
|
||||
"name": "applications_resume_id_resumes_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "resumes",
|
||||
"columnsFrom": [
|
||||
"resume_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["resume_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -204,12 +190,8 @@
|
||||
"name": "certificates_student_id_students_id_fk",
|
||||
"tableFrom": "certificates",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -350,12 +332,8 @@
|
||||
"name": "grades_student_id_students_id_fk",
|
||||
"tableFrom": "grades",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -445,12 +423,8 @@
|
||||
"name": "internships_student_id_students_id_fk",
|
||||
"tableFrom": "internships",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -582,12 +556,8 @@
|
||||
"name": "jobs_company_id_companies_id_fk",
|
||||
"tableFrom": "jobs",
|
||||
"tableTo": "companies",
|
||||
"columnsFrom": [
|
||||
"company_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["company_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -654,12 +624,8 @@
|
||||
"name": "projects_student_id_students_id_fk",
|
||||
"tableFrom": "projects",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -719,12 +685,8 @@
|
||||
"name": "resumes_student_id_students_id_fk",
|
||||
"tableFrom": "resumes",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -890,4 +852,4 @@
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,7 @@
|
||||
"admins_email_unique": {
|
||||
"name": "admins_email_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"email"
|
||||
]
|
||||
"columns": ["email"]
|
||||
}
|
||||
},
|
||||
"policies": {},
|
||||
@@ -107,12 +105,8 @@
|
||||
"name": "applications_job_id_jobs_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "jobs",
|
||||
"columnsFrom": [
|
||||
"job_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["job_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -120,12 +114,8 @@
|
||||
"name": "applications_student_id_students_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -133,12 +123,8 @@
|
||||
"name": "applications_resume_id_resumes_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "resumes",
|
||||
"columnsFrom": [
|
||||
"resume_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["resume_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -204,12 +190,8 @@
|
||||
"name": "certificates_student_id_students_id_fk",
|
||||
"tableFrom": "certificates",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -344,12 +326,8 @@
|
||||
"name": "grades_student_id_students_id_fk",
|
||||
"tableFrom": "grades",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -357,10 +335,7 @@
|
||||
"compositePrimaryKeys": {
|
||||
"grades_student_id_sem_pk": {
|
||||
"name": "grades_student_id_sem_pk",
|
||||
"columns": [
|
||||
"student_id",
|
||||
"sem"
|
||||
]
|
||||
"columns": ["student_id", "sem"]
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
@@ -452,12 +427,8 @@
|
||||
"name": "internships_student_id_students_id_fk",
|
||||
"tableFrom": "internships",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -589,12 +560,8 @@
|
||||
"name": "jobs_company_id_companies_id_fk",
|
||||
"tableFrom": "jobs",
|
||||
"tableTo": "companies",
|
||||
"columnsFrom": [
|
||||
"company_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["company_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -661,12 +628,8 @@
|
||||
"name": "projects_student_id_students_id_fk",
|
||||
"tableFrom": "projects",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -726,12 +689,8 @@
|
||||
"name": "resumes_student_id_students_id_fk",
|
||||
"tableFrom": "resumes",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -897,4 +856,4 @@
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,7 @@
|
||||
"admins_email_unique": {
|
||||
"name": "admins_email_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"email"
|
||||
]
|
||||
"columns": ["email"]
|
||||
}
|
||||
},
|
||||
"policies": {},
|
||||
@@ -107,12 +105,8 @@
|
||||
"name": "applications_job_id_jobs_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "jobs",
|
||||
"columnsFrom": [
|
||||
"job_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["job_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -120,12 +114,8 @@
|
||||
"name": "applications_student_id_students_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -133,12 +123,8 @@
|
||||
"name": "applications_resume_id_resumes_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "resumes",
|
||||
"columnsFrom": [
|
||||
"resume_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["resume_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -267,12 +253,8 @@
|
||||
"name": "grades_student_id_students_id_fk",
|
||||
"tableFrom": "grades",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -280,10 +262,7 @@
|
||||
"compositePrimaryKeys": {
|
||||
"grades_student_id_sem_pk": {
|
||||
"name": "grades_student_id_sem_pk",
|
||||
"columns": [
|
||||
"student_id",
|
||||
"sem"
|
||||
]
|
||||
"columns": ["student_id", "sem"]
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
@@ -369,12 +348,8 @@
|
||||
"name": "internships_student_id_students_id_fk",
|
||||
"tableFrom": "internships",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -506,12 +481,8 @@
|
||||
"name": "jobs_company_id_companies_id_fk",
|
||||
"tableFrom": "jobs",
|
||||
"tableTo": "companies",
|
||||
"columnsFrom": [
|
||||
"company_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["company_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -571,12 +542,8 @@
|
||||
"name": "resumes_student_id_students_id_fk",
|
||||
"tableFrom": "resumes",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -748,4 +715,4 @@
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,7 @@
|
||||
"admins_email_unique": {
|
||||
"name": "admins_email_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"email"
|
||||
]
|
||||
"columns": ["email"]
|
||||
}
|
||||
},
|
||||
"policies": {},
|
||||
@@ -107,12 +105,8 @@
|
||||
"name": "applications_job_id_jobs_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "jobs",
|
||||
"columnsFrom": [
|
||||
"job_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["job_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -120,12 +114,8 @@
|
||||
"name": "applications_student_id_students_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
@@ -133,12 +123,8 @@
|
||||
"name": "applications_resume_id_resumes_id_fk",
|
||||
"tableFrom": "applications",
|
||||
"tableTo": "resumes",
|
||||
"columnsFrom": [
|
||||
"resume_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["resume_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -267,12 +253,8 @@
|
||||
"name": "grades_student_id_students_id_fk",
|
||||
"tableFrom": "grades",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -280,10 +262,7 @@
|
||||
"compositePrimaryKeys": {
|
||||
"grades_student_id_sem_pk": {
|
||||
"name": "grades_student_id_sem_pk",
|
||||
"columns": [
|
||||
"student_id",
|
||||
"sem"
|
||||
]
|
||||
"columns": ["student_id", "sem"]
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
@@ -369,12 +348,8 @@
|
||||
"name": "internships_student_id_students_id_fk",
|
||||
"tableFrom": "internships",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -506,12 +481,8 @@
|
||||
"name": "jobs_company_id_companies_id_fk",
|
||||
"tableFrom": "jobs",
|
||||
"tableTo": "companies",
|
||||
"columnsFrom": [
|
||||
"company_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["company_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -571,12 +542,8 @@
|
||||
"name": "resumes_student_id_students_id_fk",
|
||||
"tableFrom": "resumes",
|
||||
"tableTo": "students",
|
||||
"columnsFrom": [
|
||||
"student_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"columnsFrom": ["student_id"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
@@ -766,4 +733,4 @@
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,4 @@
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { sql, relations } from "drizzle-orm";
|
||||
import { sql, relations } from 'drizzle-orm';
|
||||
import {
|
||||
pgTable,
|
||||
serial,
|
||||
@@ -10,9 +10,9 @@ import {
|
||||
numeric,
|
||||
primaryKey,
|
||||
check,
|
||||
} from "drizzle-orm/pg-core";
|
||||
} from 'drizzle-orm/pg-core';
|
||||
|
||||
export const students = pgTable("students", {
|
||||
export const students = pgTable('students', {
|
||||
id: serial().primaryKey(),
|
||||
email: text().notNull(),
|
||||
rollNumber: varchar({ length: 12 }),
|
||||
@@ -45,9 +45,9 @@ export const students = pgTable("students", {
|
||||
.notNull(),
|
||||
});
|
||||
|
||||
export const internships = pgTable("internships", {
|
||||
export const internships = pgTable('internships', {
|
||||
id: serial().primaryKey(),
|
||||
studentId: integer("student_id")
|
||||
studentId: integer('student_id')
|
||||
.notNull()
|
||||
.references(() => students.id),
|
||||
title: text().notNull(),
|
||||
@@ -97,9 +97,9 @@ export const internships = pgTable("internships", {
|
||||
// .notNull(),
|
||||
// });
|
||||
|
||||
export const resumes = pgTable("resumes", {
|
||||
export const resumes = pgTable('resumes', {
|
||||
id: serial().primaryKey(),
|
||||
studentId: integer("student_id")
|
||||
studentId: integer('student_id')
|
||||
.notNull()
|
||||
.references(() => students.id),
|
||||
title: text().notNull(),
|
||||
@@ -112,9 +112,9 @@ export const resumes = pgTable("resumes", {
|
||||
});
|
||||
|
||||
export const grades = pgTable(
|
||||
"grades",
|
||||
'grades',
|
||||
{
|
||||
studentId: integer("student_id")
|
||||
studentId: integer('student_id')
|
||||
.notNull()
|
||||
.references(() => students.id),
|
||||
sem: integer().notNull(),
|
||||
@@ -129,7 +129,7 @@ export const grades = pgTable(
|
||||
},
|
||||
(table) => [
|
||||
primaryKey({ columns: [table.studentId, table.sem] }),
|
||||
check("sem_check1", sql`${table.sem} < 9`),
|
||||
check('sem_check1', sql`${table.sem} < 9`),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -177,7 +177,7 @@ export const gradeRelations = relations(grades, ({ one }) => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
export const companies = pgTable("companies", {
|
||||
export const companies = pgTable('companies', {
|
||||
id: serial().primaryKey(),
|
||||
name: text().notNull(),
|
||||
email: text().notNull(),
|
||||
@@ -192,9 +192,9 @@ export const companies = pgTable("companies", {
|
||||
.notNull(),
|
||||
});
|
||||
|
||||
export const jobs = pgTable("jobs", {
|
||||
export const jobs = pgTable('jobs', {
|
||||
id: serial().primaryKey(),
|
||||
companyId: integer("company_id")
|
||||
companyId: integer('company_id')
|
||||
.notNull()
|
||||
.references(() => companies.id),
|
||||
title: text().notNull(),
|
||||
@@ -205,9 +205,9 @@ export const jobs = pgTable("jobs", {
|
||||
salary: text().notNull(),
|
||||
applicationDeadline: timestamp().notNull(),
|
||||
active: boolean().notNull().default(false),
|
||||
minCGPA: numeric({ precision: 4, scale: 2 }).notNull().default("0"),
|
||||
minSSC: numeric({ precision: 4, scale: 2 }).notNull().default("0"),
|
||||
minHSC: numeric({ precision: 4, scale: 2 }).notNull().default("0"),
|
||||
minCGPA: numeric({ precision: 4, scale: 2 }).notNull().default('0'),
|
||||
minSSC: numeric({ precision: 4, scale: 2 }).notNull().default('0'),
|
||||
minHSC: numeric({ precision: 4, scale: 2 }).notNull().default('0'),
|
||||
allowDeadKT: boolean().notNull().default(true),
|
||||
allowLiveKT: boolean().notNull().default(true),
|
||||
createdAt: timestamp().notNull().defaultNow(),
|
||||
@@ -217,18 +217,18 @@ export const jobs = pgTable("jobs", {
|
||||
.notNull(),
|
||||
});
|
||||
|
||||
export const applications = pgTable("applications", {
|
||||
export const applications = pgTable('applications', {
|
||||
id: serial().primaryKey(),
|
||||
jobId: integer("job_id")
|
||||
jobId: integer('job_id')
|
||||
.notNull()
|
||||
.references(() => jobs.id),
|
||||
studentId: integer("student_id")
|
||||
studentId: integer('student_id')
|
||||
.notNull()
|
||||
.references(() => students.id),
|
||||
resumeId: integer("resume_id")
|
||||
resumeId: integer('resume_id')
|
||||
.notNull()
|
||||
.references(() => resumes.id),
|
||||
status: text().notNull().default("pending"),
|
||||
status: text().notNull().default('pending'),
|
||||
createdAt: timestamp().notNull().defaultNow(),
|
||||
updatedAt: timestamp()
|
||||
.defaultNow()
|
||||
@@ -263,7 +263,7 @@ export const applicationsRelations = relations(applications, ({ one }) => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
export const admins = pgTable("admins", {
|
||||
export const admins = pgTable('admins', {
|
||||
id: serial().primaryKey(),
|
||||
email: text().notNull().unique(),
|
||||
createdAt: timestamp().notNull().defaultNow(),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import js from "@eslint/js"
|
||||
import eslintConfigPrettier from "eslint-config-prettier"
|
||||
import onlyWarn from "eslint-plugin-only-warn"
|
||||
import turboPlugin from "eslint-plugin-turbo"
|
||||
import tseslint from "typescript-eslint"
|
||||
import js from '@eslint/js';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
import onlyWarn from 'eslint-plugin-only-warn';
|
||||
import turboPlugin from 'eslint-plugin-turbo';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
/**
|
||||
* A shared ESLint configuration for the repository.
|
||||
@@ -18,7 +18,7 @@ export const config = [
|
||||
turbo: turboPlugin,
|
||||
},
|
||||
rules: {
|
||||
"turbo/no-undeclared-env-vars": "warn",
|
||||
'turbo/no-undeclared-env-vars': 'warn',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -27,6 +27,6 @@ export const config = [
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: ["dist/**"],
|
||||
ignores: ['dist/**'],
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import js from "@eslint/js"
|
||||
import pluginNext from "@next/eslint-plugin-next"
|
||||
import eslintConfigPrettier from "eslint-config-prettier"
|
||||
import pluginReact from "eslint-plugin-react"
|
||||
import pluginReactHooks from "eslint-plugin-react-hooks"
|
||||
import globals from "globals"
|
||||
import tseslint from "typescript-eslint"
|
||||
import js from '@eslint/js';
|
||||
import pluginNext from '@next/eslint-plugin-next';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
import pluginReact from 'eslint-plugin-react';
|
||||
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
||||
import globals from 'globals';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
import { config as baseConfig } from "./base.js"
|
||||
import { config as baseConfig } from './base.js';
|
||||
|
||||
/**
|
||||
* A custom ESLint configuration for libraries that use Next.js.
|
||||
@@ -29,23 +29,23 @@ export const nextJsConfig = [
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
"@next/next": pluginNext,
|
||||
'@next/next': pluginNext,
|
||||
},
|
||||
rules: {
|
||||
...pluginNext.configs.recommended.rules,
|
||||
...pluginNext.configs["core-web-vitals"].rules,
|
||||
...pluginNext.configs['core-web-vitals'].rules,
|
||||
},
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
"react-hooks": pluginReactHooks,
|
||||
'react-hooks': pluginReactHooks,
|
||||
},
|
||||
settings: { react: { version: "detect" } },
|
||||
settings: { react: { version: 'detect' } },
|
||||
rules: {
|
||||
...pluginReactHooks.configs.recommended.rules,
|
||||
// React scope no longer necessary with new JSX transform.
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"react/prop-types": "off",
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/prop-types': 'off',
|
||||
},
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
24
packages/eslint-config/react-internal.js
vendored
24
packages/eslint-config/react-internal.js
vendored
@@ -1,11 +1,11 @@
|
||||
import js from "@eslint/js"
|
||||
import eslintConfigPrettier from "eslint-config-prettier"
|
||||
import pluginReact from "eslint-plugin-react"
|
||||
import pluginReactHooks from "eslint-plugin-react-hooks"
|
||||
import globals from "globals"
|
||||
import tseslint from "typescript-eslint"
|
||||
import js from '@eslint/js';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
import pluginReact from 'eslint-plugin-react';
|
||||
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
||||
import globals from 'globals';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
import { config as baseConfig } from "./base.js"
|
||||
import { config as baseConfig } from './base.js';
|
||||
|
||||
/**
|
||||
* A custom ESLint configuration for libraries that use React.
|
||||
@@ -28,14 +28,14 @@ export const config = [
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
"react-hooks": pluginReactHooks,
|
||||
'react-hooks': pluginReactHooks,
|
||||
},
|
||||
settings: { react: { version: "detect" } },
|
||||
settings: { react: { version: 'detect' } },
|
||||
rules: {
|
||||
...pluginReactHooks.configs.recommended.rules,
|
||||
// React scope no longer necessary with new JSX transform.
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"react/prop-types": "off",
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/prop-types': 'off',
|
||||
},
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { config } from "@workspace/eslint-config/react-internal"
|
||||
import { config } from '@workspace/eslint-config/react-internal';
|
||||
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
export default config
|
||||
export default config;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @type {import('postcss-load-config').Config} */
|
||||
const config = {
|
||||
plugins: { "@tailwindcss/postcss": {} },
|
||||
plugins: { '@tailwindcss/postcss': {} },
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from "react";
|
||||
import { Slot } from "@radix-ui/react-slot";
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import React from 'react';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils";
|
||||
import { cn } from '@workspace/ui/lib/utils';
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all duration-200 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring hover:scale-105 active:scale-95 transform-gpu",
|
||||
@@ -10,29 +10,28 @@ const buttonVariants = cva(
|
||||
variants: {
|
||||
variant: {
|
||||
default:
|
||||
"bg-primary text-primary-foreground shadow-lg shadow-primary/25 hover:bg-primary/85 hover:shadow-xl hover:shadow-primary/35",
|
||||
'bg-primary text-primary-foreground shadow-lg shadow-primary/25 hover:bg-primary/85 hover:shadow-xl hover:shadow-primary/35',
|
||||
destructive:
|
||||
"bg-destructive text-destructive-foreground shadow-lg shadow-destructive/25 hover:bg-destructive/85 hover:shadow-xl hover:shadow-destructive/35",
|
||||
'bg-destructive text-destructive-foreground shadow-lg shadow-destructive/25 hover:bg-destructive/85 hover:shadow-xl hover:shadow-destructive/35',
|
||||
outline:
|
||||
"border-2 border-primary/20 bg-background hover:bg-primary/5 hover:text-primary hover:border-primary/40 shadow-md hover:shadow-lg hover:shadow-primary/15",
|
||||
'border-2 border-primary/20 bg-background hover:bg-primary/5 hover:text-primary hover:border-primary/40 shadow-md hover:shadow-lg hover:shadow-primary/15',
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground shadow-md hover:bg-secondary/80 hover:shadow-lg",
|
||||
ghost:
|
||||
"hover:bg-primary/10 hover:text-primary hover:shadow-md hover:shadow-primary/10",
|
||||
link: "text-primary underline-offset-4 hover:underline hover:text-accent p-0 h-auto font-normal hover:scale-100 active:scale-100",
|
||||
'bg-secondary text-secondary-foreground shadow-md hover:bg-secondary/80 hover:shadow-lg',
|
||||
ghost: 'hover:bg-primary/10 hover:text-primary hover:shadow-md hover:shadow-primary/10',
|
||||
link: 'text-primary underline-offset-4 hover:underline hover:text-accent p-0 h-auto font-normal hover:scale-100 active:scale-100',
|
||||
accent:
|
||||
"bg-accent text-accent-foreground shadow-lg shadow-accent/25 hover:bg-accent/85 hover:shadow-xl hover:shadow-accent/35",
|
||||
'bg-accent text-accent-foreground shadow-lg shadow-accent/25 hover:bg-accent/85 hover:shadow-xl hover:shadow-accent/35',
|
||||
},
|
||||
size: {
|
||||
default: "h-10 px-4 py-2",
|
||||
sm: "h-8 rounded-md px-3 text-xs",
|
||||
lg: "h-12 rounded-lg px-6 text-base",
|
||||
icon: "h-10 w-10",
|
||||
default: 'h-10 px-4 py-2',
|
||||
sm: 'h-8 rounded-md px-3 text-xs',
|
||||
lg: 'h-12 rounded-lg px-6 text-base',
|
||||
icon: 'h-10 w-10',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -45,16 +44,12 @@ export interface ButtonProps
|
||||
|
||||
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
({ className, variant, size, asChild = false, ...props }, ref) => {
|
||||
const Comp = asChild ? Slot : "button";
|
||||
const Comp = asChild ? Slot : 'button';
|
||||
return (
|
||||
<Comp
|
||||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
ref={ref}
|
||||
{...props}
|
||||
/>
|
||||
<Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
|
||||
);
|
||||
},
|
||||
);
|
||||
Button.displayName = "Button";
|
||||
Button.displayName = 'Button';
|
||||
|
||||
export { Button, buttonVariants };
|
||||
|
||||
@@ -1,75 +1,78 @@
|
||||
import type * as React from "react"
|
||||
import type * as React from 'react';
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
import { cn } from '@workspace/ui/lib/utils';
|
||||
|
||||
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card"
|
||||
className={cn(
|
||||
"bg-card/90 text-card-foreground flex flex-col gap-6 rounded-2xl border border-border/50 py-8 shadow-xl shadow-black/5 backdrop-blur-sm hover:shadow-2xl hover:shadow-black/10 transition-all duration-300 hover:-translate-y-1",
|
||||
'bg-card/90 text-card-foreground flex flex-col gap-6 rounded-2xl border border-border/50 py-8 shadow-xl shadow-black/5 backdrop-blur-sm hover:shadow-2xl hover:shadow-black/10 transition-all duration-300 hover:-translate-y-1',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-header"
|
||||
className={cn(
|
||||
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-3 px-8 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6 [.border-b]:border-border/30",
|
||||
'@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-3 px-8 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6 [.border-b]:border-border/30',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-title"
|
||||
className={cn("leading-tight font-bold text-lg tracking-tight", className)}
|
||||
className={cn('leading-tight font-bold text-lg tracking-tight', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-description"
|
||||
className={cn("text-muted-foreground text-sm leading-relaxed", className)}
|
||||
className={cn('text-muted-foreground text-sm leading-relaxed', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-action"
|
||||
className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}
|
||||
className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return <div data-slot="card-content" className={cn("px-8", className)} {...props} />
|
||||
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return <div data-slot="card-content" className={cn('px-8', className)} {...props} />;
|
||||
}
|
||||
|
||||
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-footer"
|
||||
className={cn("flex items-center px-8 [.border-t]:pt-6 [.border-t]:border-border/30", className)}
|
||||
className={cn(
|
||||
'flex items-center px-8 [.border-t]:pt-6 [.border-t]:border-border/30',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent }
|
||||
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent };
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use client"
|
||||
'use client';
|
||||
|
||||
import * as React from "react"
|
||||
import * as LabelPrimitive from "@radix-ui/react-label"
|
||||
import { Slot } from "@radix-ui/react-slot"
|
||||
import * as React from 'react';
|
||||
import * as LabelPrimitive from '@radix-ui/react-label';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import {
|
||||
Controller,
|
||||
FormProvider,
|
||||
@@ -11,23 +11,21 @@ import {
|
||||
type ControllerProps,
|
||||
type FieldPath,
|
||||
type FieldValues,
|
||||
} from "react-hook-form"
|
||||
} from 'react-hook-form';
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
import { Label } from "@workspace/ui/components/label"
|
||||
import { cn } from '@workspace/ui/lib/utils';
|
||||
import { Label } from '@workspace/ui/components/label';
|
||||
|
||||
const Form = FormProvider
|
||||
const Form = FormProvider;
|
||||
|
||||
type FormFieldContextValue<
|
||||
TFieldValues extends FieldValues = FieldValues,
|
||||
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
||||
> = {
|
||||
name: TName
|
||||
}
|
||||
name: TName;
|
||||
};
|
||||
|
||||
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
||||
{} as FormFieldContextValue
|
||||
)
|
||||
const FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);
|
||||
|
||||
const FormField = <
|
||||
TFieldValues extends FieldValues = FieldValues,
|
||||
@@ -39,21 +37,21 @@ const FormField = <
|
||||
<FormFieldContext.Provider value={{ name: props.name }}>
|
||||
<Controller {...props} />
|
||||
</FormFieldContext.Provider>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const useFormField = () => {
|
||||
const fieldContext = React.useContext(FormFieldContext)
|
||||
const itemContext = React.useContext(FormItemContext)
|
||||
const { getFieldState } = useFormContext()
|
||||
const formState = useFormState({ name: fieldContext.name })
|
||||
const fieldState = getFieldState(fieldContext.name, formState)
|
||||
const fieldContext = React.useContext(FormFieldContext);
|
||||
const itemContext = React.useContext(FormItemContext);
|
||||
const { getFieldState } = useFormContext();
|
||||
const formState = useFormState({ name: fieldContext.name });
|
||||
const fieldState = getFieldState(fieldContext.name, formState);
|
||||
|
||||
if (!fieldContext) {
|
||||
throw new Error("useFormField should be used within <FormField>")
|
||||
throw new Error('useFormField should be used within <FormField>');
|
||||
}
|
||||
|
||||
const { id } = itemContext
|
||||
const { id } = itemContext;
|
||||
|
||||
return {
|
||||
id,
|
||||
@@ -62,97 +60,84 @@ const useFormField = () => {
|
||||
formDescriptionId: `${id}-form-item-description`,
|
||||
formMessageId: `${id}-form-item-message`,
|
||||
...fieldState,
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
type FormItemContextValue = {
|
||||
id: string
|
||||
}
|
||||
id: string;
|
||||
};
|
||||
|
||||
const FormItemContext = React.createContext<FormItemContextValue>(
|
||||
{} as FormItemContextValue
|
||||
)
|
||||
const FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);
|
||||
|
||||
function FormItem({ className, ...props }: React.ComponentProps<"div">) {
|
||||
const id = React.useId()
|
||||
function FormItem({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
const id = React.useId();
|
||||
|
||||
return (
|
||||
<FormItemContext.Provider value={{ id }}>
|
||||
<div
|
||||
data-slot="form-item"
|
||||
className={cn("grid gap-2", className)}
|
||||
{...props}
|
||||
/>
|
||||
<div data-slot="form-item" className={cn('grid gap-2', className)} {...props} />
|
||||
</FormItemContext.Provider>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function FormLabel({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||
const { error, formItemId } = useFormField()
|
||||
function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||
const { error, formItemId } = useFormField();
|
||||
|
||||
return (
|
||||
<Label
|
||||
data-slot="form-label"
|
||||
data-error={!!error}
|
||||
className={cn("data-[error=true]:text-destructive", className)}
|
||||
className={cn('data-[error=true]:text-destructive', className)}
|
||||
htmlFor={formItemId}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
|
||||
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
|
||||
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
||||
|
||||
return (
|
||||
<Slot
|
||||
data-slot="form-control"
|
||||
id={formItemId}
|
||||
aria-describedby={
|
||||
!error
|
||||
? `${formDescriptionId}`
|
||||
: `${formDescriptionId} ${formMessageId}`
|
||||
}
|
||||
aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}
|
||||
aria-invalid={!!error}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
|
||||
const { formDescriptionId } = useFormField()
|
||||
function FormDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
||||
const { formDescriptionId } = useFormField();
|
||||
|
||||
return (
|
||||
<p
|
||||
data-slot="form-description"
|
||||
id={formDescriptionId}
|
||||
className={cn("text-muted-foreground text-sm", className)}
|
||||
className={cn('text-muted-foreground text-sm', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
|
||||
const { error, formMessageId } = useFormField()
|
||||
const body = error ? String(error?.message ?? "") : props.children
|
||||
function FormMessage({ className, ...props }: React.ComponentProps<'p'>) {
|
||||
const { error, formMessageId } = useFormField();
|
||||
const body = error ? String(error?.message ?? '') : props.children;
|
||||
|
||||
if (!body) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<p
|
||||
data-slot="form-message"
|
||||
id={formMessageId}
|
||||
className={cn("text-destructive text-sm", className)}
|
||||
className={cn('text-destructive text-sm', className)}
|
||||
{...props}
|
||||
>
|
||||
{body}
|
||||
</p>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
@@ -164,4 +149,4 @@ export {
|
||||
FormDescription,
|
||||
FormMessage,
|
||||
FormField,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import type * as React from "react"
|
||||
import type * as React from 'react';
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
import { cn } from '@workspace/ui/lib/utils';
|
||||
|
||||
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||
function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(
|
||||
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-12 w-full min-w-0 rounded-md border-2 bg-transparent px-4 py-3 text-base shadow-md shadow-black/5 transition-all duration-200 outline-none file:inline-flex file:h-8 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm backdrop-blur-sm",
|
||||
"focus-visible:border-primary focus-visible:ring-primary/20 focus-visible:ring-4 focus-visible:shadow-lg focus-visible:shadow-primary/10",
|
||||
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
"hover:border-border/80 hover:shadow-lg",
|
||||
'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-12 w-full min-w-0 rounded-md border-2 bg-transparent px-4 py-3 text-base shadow-md shadow-black/5 transition-all duration-200 outline-none file:inline-flex file:h-8 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm backdrop-blur-sm',
|
||||
'focus-visible:border-primary focus-visible:ring-primary/20 focus-visible:ring-4 focus-visible:shadow-lg focus-visible:shadow-primary/10',
|
||||
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
||||
'hover:border-border/80 hover:shadow-lg',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Input }
|
||||
export { Input };
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
"use client"
|
||||
'use client';
|
||||
|
||||
import * as React from "react"
|
||||
import * as LabelPrimitive from "@radix-ui/react-label"
|
||||
import * as React from 'react';
|
||||
import * as LabelPrimitive from '@radix-ui/react-label';
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
import { cn } from '@workspace/ui/lib/utils';
|
||||
|
||||
function Label({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||
function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||
return (
|
||||
<LabelPrimitive.Root
|
||||
data-slot="label"
|
||||
className={cn(
|
||||
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
||||
className
|
||||
'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Label }
|
||||
export { Label };
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
"use client"
|
||||
'use client';
|
||||
|
||||
import type * as React from "react"
|
||||
import * as ProgressPrimitive from "@radix-ui/react-progress"
|
||||
import type * as React from 'react';
|
||||
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
import { cn } from '@workspace/ui/lib/utils';
|
||||
|
||||
function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
|
||||
function Progress({
|
||||
className,
|
||||
value,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ProgressPrimitive.Root>) {
|
||||
return (
|
||||
<ProgressPrimitive.Root
|
||||
data-slot="progress"
|
||||
className={cn(
|
||||
"bg-primary/20 relative h-3 w-full overflow-hidden rounded-full shadow-inner backdrop-blur-sm border border-primary/10",
|
||||
'bg-primary/20 relative h-3 w-full overflow-hidden rounded-full shadow-inner backdrop-blur-sm border border-primary/10',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
@@ -21,7 +25,7 @@ function Progress({ className, value, ...props }: React.ComponentProps<typeof Pr
|
||||
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
||||
/>
|
||||
</ProgressPrimitive.Root>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Progress }
|
||||
export { Progress };
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
"use client"
|
||||
'use client';
|
||||
|
||||
import type * as React from "react"
|
||||
import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
|
||||
import type * as React from 'react';
|
||||
import * as SelectPrimitive from '@radix-ui/react-select';
|
||||
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
import { cn } from '@workspace/ui/lib/utils';
|
||||
|
||||
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
||||
return <SelectPrimitive.Root data-slot="select" {...props} />
|
||||
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
||||
}
|
||||
|
||||
function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
||||
return <SelectPrimitive.Group data-slot="select-group" {...props} />
|
||||
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
|
||||
}
|
||||
|
||||
function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
||||
return <SelectPrimitive.Value data-slot="select-value" {...props} />
|
||||
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
||||
}
|
||||
|
||||
function SelectTrigger({
|
||||
className,
|
||||
size = "default",
|
||||
size = 'default',
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
||||
size?: "sm" | "default"
|
||||
size?: 'sm' | 'default';
|
||||
}) {
|
||||
return (
|
||||
<SelectPrimitive.Trigger
|
||||
@@ -41,13 +41,13 @@ function SelectTrigger({
|
||||
<ChevronDownIcon className="size-4 opacity-60 transition-transform duration-200 data-[state=open]:rotate-180" />
|
||||
</SelectPrimitive.Icon>
|
||||
</SelectPrimitive.Trigger>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectContent({
|
||||
className,
|
||||
children,
|
||||
position = "popper",
|
||||
position = 'popper',
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
||||
return (
|
||||
@@ -55,9 +55,9 @@ function SelectContent({
|
||||
<SelectPrimitive.Content
|
||||
data-slot="select-content"
|
||||
className={cn(
|
||||
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border-2 border-border/50 shadow-xl shadow-black/10 backdrop-blur-md",
|
||||
position === "popper" &&
|
||||
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
||||
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border-2 border-border/50 shadow-xl shadow-black/10 backdrop-blur-md',
|
||||
position === 'popper' &&
|
||||
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
||||
className,
|
||||
)}
|
||||
position={position}
|
||||
@@ -66,9 +66,9 @@ function SelectContent({
|
||||
<SelectScrollUpButton />
|
||||
<SelectPrimitive.Viewport
|
||||
className={cn(
|
||||
"p-2",
|
||||
position === "popper" &&
|
||||
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
|
||||
'p-2',
|
||||
position === 'popper' &&
|
||||
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
@@ -76,20 +76,27 @@ function SelectContent({
|
||||
<SelectScrollDownButton />
|
||||
</SelectPrimitive.Content>
|
||||
</SelectPrimitive.Portal>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
||||
return (
|
||||
<SelectPrimitive.Label
|
||||
data-slot="select-label"
|
||||
className={cn("text-muted-foreground px-3 py-2 text-xs font-semibold uppercase tracking-wider", className)}
|
||||
className={cn(
|
||||
'text-muted-foreground px-3 py-2 text-xs font-semibold uppercase tracking-wider',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
||||
function SelectItem({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
||||
return (
|
||||
<SelectPrimitive.Item
|
||||
data-slot="select-item"
|
||||
@@ -106,29 +113,35 @@ function SelectItem({ className, children, ...props }: React.ComponentProps<type
|
||||
</span>
|
||||
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
||||
</SelectPrimitive.Item>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
||||
function SelectSeparator({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
||||
return (
|
||||
<SelectPrimitive.Separator
|
||||
data-slot="select-separator"
|
||||
className={cn("bg-border pointer-events-none -mx-1 my-2 h-px", className)}
|
||||
className={cn('bg-border pointer-events-none -mx-1 my-2 h-px', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
||||
function SelectScrollUpButton({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
||||
return (
|
||||
<SelectPrimitive.ScrollUpButton
|
||||
data-slot="select-scroll-up-button"
|
||||
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
||||
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronUpIcon className="size-4" />
|
||||
</SelectPrimitive.ScrollUpButton>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function SelectScrollDownButton({
|
||||
@@ -138,12 +151,12 @@ function SelectScrollDownButton({
|
||||
return (
|
||||
<SelectPrimitive.ScrollDownButton
|
||||
data-slot="select-scroll-down-button"
|
||||
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
||||
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronDownIcon className="size-4" />
|
||||
</SelectPrimitive.ScrollDownButton>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
@@ -157,4 +170,4 @@ export {
|
||||
SelectSeparator,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"use client"
|
||||
'use client';
|
||||
|
||||
import type * as React from "react"
|
||||
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
||||
import type * as React from 'react';
|
||||
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
import { cn } from '@workspace/ui/lib/utils';
|
||||
|
||||
function Separator({
|
||||
className,
|
||||
orientation = "horizontal",
|
||||
orientation = 'horizontal',
|
||||
decorative = true,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
||||
@@ -17,12 +17,12 @@ function Separator({
|
||||
decorative={decorative}
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px data-[orientation=vertical]:bg-gradient-to-b",
|
||||
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px data-[orientation=vertical]:bg-gradient-to-b',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Separator }
|
||||
export { Separator };
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import type * as React from "react"
|
||||
import type * as React from 'react';
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
import { cn } from '@workspace/ui/lib/utils';
|
||||
|
||||
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
||||
function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
|
||||
return (
|
||||
<textarea
|
||||
data-slot="textarea"
|
||||
className={cn(
|
||||
"border-input placeholder:text-muted-foreground focus-visible:border-primary focus-visible:ring-primary/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-20 w-full rounded-md border-2 bg-transparent px-4 py-3 text-base shadow-md shadow-black/5 transition-all duration-200 outline-none focus-visible:ring-4 focus-visible:shadow-lg focus-visible:shadow-primary/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm backdrop-blur-sm hover:border-border/80 hover:shadow-lg resize-none",
|
||||
'border-input placeholder:text-muted-foreground focus-visible:border-primary focus-visible:ring-primary/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-20 w-full rounded-md border-2 bg-transparent px-4 py-3 text-base shadow-md shadow-black/5 transition-all duration-200 outline-none focus-visible:ring-4 focus-visible:shadow-lg focus-visible:shadow-primary/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm backdrop-blur-sm hover:border-border/80 hover:shadow-lg resize-none',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { Textarea }
|
||||
export { Textarea };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
@import "tailwindcss";
|
||||
@import 'tailwindcss';
|
||||
@source "../../../apps/**/*.{ts,tsx}";
|
||||
@source "../../../components/**/*.{ts,tsx}";
|
||||
@source "../**/*.{ts,tsx}";
|
||||
|
||||
@import "tw-animate-css";
|
||||
@import 'tw-animate-css';
|
||||
|
||||
@theme {
|
||||
--font-sans: "var(--font-sans)";
|
||||
--font-marcellus: "var(--font-marcellus)";
|
||||
--font-sans: 'var(--font-sans)';
|
||||
--font-marcellus: 'var(--font-marcellus)';
|
||||
}
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
4293
pnpm-lock.yaml
generated
4293
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
packages:
|
||||
- "apps/*"
|
||||
- "packages/*"
|
||||
- 'apps/*'
|
||||
- 'packages/*'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{
|
||||
"extends": "@workspace/typescript-config/base.json"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user