From 30761088378cc346d36044ddc80f092107225858 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Tue, 12 May 2026 23:07:07 +0800 Subject: [PATCH 1/4] init new files commit --- .../app-portal/src/app/(applicant)/layout.tsx | 0 .../src/app/api/auth/placeholder.txt | 0 apps/app-portal/src/app/api/v1/user/route.ts | 0 apps/app-portal/src/app/auth/error/page.tsx | 5 + apps/app-portal/src/app/auth/signin/page.tsx | 5 + .../src/app/auth/verify-request/page.tsx | 5 + .../src/components/auth/SignInForm.tsx | 5 + .../src/components/auth/UserMenu.tsx | 5 + apps/app-portal/src/components/ui/badge.tsx | 33 +++-- apps/app-portal/src/components/ui/button.tsx | 8 +- apps/app-portal/src/components/ui/card.tsx | 76 +++++++++-- .../app-portal/src/components/ui/checkbox.tsx | 4 +- apps/app-portal/src/components/ui/dialog.tsx | 46 ++++++- apps/app-portal/src/components/ui/form.tsx | 104 ++++++++++---- apps/app-portal/src/components/ui/input.tsx | 31 +++-- apps/app-portal/src/components/ui/label.tsx | 15 ++- apps/app-portal/src/components/ui/select.tsx | 41 +++++- apps/app-portal/src/components/ui/sonner.tsx | 9 +- apps/app-portal/src/components/ui/table.tsx | 127 +++++++++++++----- .../app-portal/src/components/ui/textarea.tsx | 5 +- apps/app-portal/src/lib/auth/adapter.ts | 0 apps/app-portal/src/lib/auth/config.ts | 0 .../src/lib/auth/email-transport.ts | 0 apps/app-portal/src/lib/auth/guards.ts | 0 apps/app-portal/src/lib/auth/session.ts | 0 apps/app-portal/src/lib/types/application.ts | 10 +- apps/app-portal/src/middleware.ts | 11 ++ .../src/app/judging/Judging/JudgingActive.tsx | 14 +- 28 files changed, 437 insertions(+), 122 deletions(-) create mode 100644 apps/app-portal/src/app/(applicant)/layout.tsx create mode 100644 apps/app-portal/src/app/api/auth/placeholder.txt create mode 100644 apps/app-portal/src/app/api/v1/user/route.ts create mode 100644 apps/app-portal/src/app/auth/error/page.tsx create mode 100644 apps/app-portal/src/app/auth/signin/page.tsx create mode 100644 apps/app-portal/src/app/auth/verify-request/page.tsx create mode 100644 apps/app-portal/src/components/auth/SignInForm.tsx create mode 100644 apps/app-portal/src/components/auth/UserMenu.tsx create mode 100644 apps/app-portal/src/lib/auth/adapter.ts create mode 100644 apps/app-portal/src/lib/auth/config.ts create mode 100644 apps/app-portal/src/lib/auth/email-transport.ts create mode 100644 apps/app-portal/src/lib/auth/guards.ts create mode 100644 apps/app-portal/src/lib/auth/session.ts create mode 100644 apps/app-portal/src/middleware.ts diff --git a/apps/app-portal/src/app/(applicant)/layout.tsx b/apps/app-portal/src/app/(applicant)/layout.tsx new file mode 100644 index 00000000..e69de29b diff --git a/apps/app-portal/src/app/api/auth/placeholder.txt b/apps/app-portal/src/app/api/auth/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/apps/app-portal/src/app/api/v1/user/route.ts b/apps/app-portal/src/app/api/v1/user/route.ts new file mode 100644 index 00000000..e69de29b diff --git a/apps/app-portal/src/app/auth/error/page.tsx b/apps/app-portal/src/app/auth/error/page.tsx new file mode 100644 index 00000000..c79bf4bb --- /dev/null +++ b/apps/app-portal/src/app/auth/error/page.tsx @@ -0,0 +1,5 @@ +import React from "react"; + +export default function Page(): JSX.Element { + return <>hay is for horses; +} diff --git a/apps/app-portal/src/app/auth/signin/page.tsx b/apps/app-portal/src/app/auth/signin/page.tsx new file mode 100644 index 00000000..c79bf4bb --- /dev/null +++ b/apps/app-portal/src/app/auth/signin/page.tsx @@ -0,0 +1,5 @@ +import React from "react"; + +export default function Page(): JSX.Element { + return <>hay is for horses; +} diff --git a/apps/app-portal/src/app/auth/verify-request/page.tsx b/apps/app-portal/src/app/auth/verify-request/page.tsx new file mode 100644 index 00000000..c79bf4bb --- /dev/null +++ b/apps/app-portal/src/app/auth/verify-request/page.tsx @@ -0,0 +1,5 @@ +import React from "react"; + +export default function Page(): JSX.Element { + return <>hay is for horses; +} diff --git a/apps/app-portal/src/components/auth/SignInForm.tsx b/apps/app-portal/src/components/auth/SignInForm.tsx new file mode 100644 index 00000000..c79bf4bb --- /dev/null +++ b/apps/app-portal/src/components/auth/SignInForm.tsx @@ -0,0 +1,5 @@ +import React from "react"; + +export default function Page(): JSX.Element { + return <>hay is for horses; +} diff --git a/apps/app-portal/src/components/auth/UserMenu.tsx b/apps/app-portal/src/components/auth/UserMenu.tsx new file mode 100644 index 00000000..c79bf4bb --- /dev/null +++ b/apps/app-portal/src/components/auth/UserMenu.tsx @@ -0,0 +1,5 @@ +import React from "react"; + +export default function Page(): JSX.Element { + return <>hay is for horses; +} diff --git a/apps/app-portal/src/components/ui/badge.tsx b/apps/app-portal/src/components/ui/badge.tsx index 70697bb4..18cc90c5 100644 --- a/apps/app-portal/src/components/ui/badge.tsx +++ b/apps/app-portal/src/components/ui/badge.tsx @@ -3,24 +3,31 @@ import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; -const badgeVariants = cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors", { - variants: { - variant: { - default: "border-transparent bg-black text-white", - secondary: "border-transparent bg-neutral-100 text-neutral-900", - destructive: "border-transparent bg-red-600 text-white", - outline: "text-neutral-950", +const badgeVariants = cva( + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors", + { + variants: { + variant: { + default: "border-transparent bg-black text-white", + secondary: "border-transparent bg-neutral-100 text-neutral-900", + destructive: "border-transparent bg-red-600 text-white", + outline: "text-neutral-950", + }, + }, + defaultVariants: { + variant: "default", }, }, - defaultVariants: { - variant: "default", - }, -}); +); -export interface BadgeProps extends React.HTMLAttributes, VariantProps {} +export interface BadgeProps + extends React.HTMLAttributes, + VariantProps {} function Badge({ className, variant, ...props }: BadgeProps) { - return
; + return ( +
+ ); } export { Badge, badgeVariants }; diff --git a/apps/app-portal/src/components/ui/button.tsx b/apps/app-portal/src/components/ui/button.tsx index f9e012f6..e83b1544 100644 --- a/apps/app-portal/src/components/ui/button.tsx +++ b/apps/app-portal/src/components/ui/button.tsx @@ -37,7 +37,13 @@ export interface ButtonProps const Button = React.forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { const Comp = asChild ? Slot : "button"; - return ; + return ( + + ); }, ); Button.displayName = "Button"; diff --git a/apps/app-portal/src/components/ui/card.tsx b/apps/app-portal/src/components/ui/card.tsx index aabcebb2..dc5a24d4 100644 --- a/apps/app-portal/src/components/ui/card.tsx +++ b/apps/app-portal/src/components/ui/card.tsx @@ -2,34 +2,82 @@ import * as React from "react"; import { cn } from "@/lib/utils"; -const Card = React.forwardRef>(({ className, ...props }, ref) => ( -
+const Card = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
)); Card.displayName = "Card"; -const CardHeader = React.forwardRef>(({ className, ...props }, ref) => ( -
+const CardHeader = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
)); CardHeader.displayName = "CardHeader"; -const CardTitle = React.forwardRef>( - ({ className, ...props }, ref) =>

, -); +const CardTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)); CardTitle.displayName = "CardTitle"; -const CardDescription = React.forwardRef>( - ({ className, ...props }, ref) =>

, -); +const CardDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)); CardDescription.displayName = "CardDescription"; -const CardContent = React.forwardRef>(({ className, ...props }, ref) => ( +const CardContent = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => (

)); CardContent.displayName = "CardContent"; -const CardFooter = React.forwardRef>(({ className, ...props }, ref) => ( -
+const CardFooter = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
)); CardFooter.displayName = "CardFooter"; -export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }; +export { + Card, + CardHeader, + CardFooter, + CardTitle, + CardDescription, + CardContent, +}; diff --git a/apps/app-portal/src/components/ui/checkbox.tsx b/apps/app-portal/src/components/ui/checkbox.tsx index 6e2536e5..625c280a 100644 --- a/apps/app-portal/src/components/ui/checkbox.tsx +++ b/apps/app-portal/src/components/ui/checkbox.tsx @@ -16,7 +16,9 @@ const Checkbox = React.forwardRef< )} {...props} > - + diff --git a/apps/app-portal/src/components/ui/dialog.tsx b/apps/app-portal/src/components/ui/dialog.tsx index 9148a4a8..13f373a4 100644 --- a/apps/app-portal/src/components/ui/dialog.tsx +++ b/apps/app-portal/src/components/ui/dialog.tsx @@ -15,7 +15,10 @@ const DialogOverlay = React.forwardRef< >(({ className, ...props }, ref) => ( )); @@ -45,13 +48,31 @@ const DialogContent = React.forwardRef< )); DialogContent.displayName = DialogPrimitive.Content.displayName; -const DialogHeader = ({ className, ...props }: React.HTMLAttributes) => ( -
+const DialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
); DialogHeader.displayName = "DialogHeader"; -const DialogFooter = ({ className, ...props }: React.HTMLAttributes) => ( -
+const DialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
); DialogFooter.displayName = "DialogFooter"; @@ -59,7 +80,14 @@ const DialogTitle = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )); DialogTitle.displayName = DialogPrimitive.Title.displayName; @@ -67,7 +95,11 @@ const DialogDescription = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )); DialogDescription.displayName = DialogPrimitive.Description.displayName; diff --git a/apps/app-portal/src/components/ui/form.tsx b/apps/app-portal/src/components/ui/form.tsx index 5db7a365..1badcdde 100644 --- a/apps/app-portal/src/components/ui/form.tsx +++ b/apps/app-portal/src/components/ui/form.tsx @@ -2,18 +2,30 @@ import * as React from "react"; import { Slot } from "@radix-ui/react-slot"; -import { Controller, FormProvider, useFormContext, type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form"; +import { + Controller, + FormProvider, + useFormContext, + type ControllerProps, + type FieldPath, + type FieldValues, +} from "react-hook-form"; import { Label } from "@/components/ui/label"; import { cn } from "@/lib/utils"; const Form = FormProvider; -type FormFieldContextValue = FieldPath> = { +type FormFieldContextValue< + TFieldValues extends FieldValues = FieldValues, + TName extends FieldPath = FieldPath, +> = { name: TName; }; -const FormFieldContext = React.createContext({} as FormFieldContextValue); +const FormFieldContext = React.createContext( + {} as FormFieldContextValue, +); const FormField = < TFieldValues extends FieldValues = FieldValues, @@ -55,9 +67,14 @@ type FormItemContextValue = { id: string; }; -const FormItemContext = React.createContext({} as FormItemContextValue); +const FormItemContext = React.createContext( + {} as FormItemContextValue, +); -const FormItem = React.forwardRef>(({ className, ...props }, ref) => { +const FormItem = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => { const id = React.useId(); return ( @@ -68,23 +85,39 @@ const FormItem = React.forwardRef, React.ComponentPropsWithoutRef>( - ({ className, ...props }, ref) => { - const { error, formItemId } = useFormField(); +const FormLabel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + const { error, formItemId } = useFormField(); - return