diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-04-28 02:13:30 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-04-28 02:13:30 +0000 |
| commit | ef4c533ebacc2cdc97e518f30e9a9350004fcdfb (patch) | |
| tree | 345251a3ed0f4429716fa5edaa31024d8f4cb560 /components/login/partner-auth-form.tsx | |
| parent | 9ceed79cf32c896f8a998399bf1b296506b2cd4a (diff) | |
~20250428 작업사항
Diffstat (limited to 'components/login/partner-auth-form.tsx')
| -rw-r--r-- | components/login/partner-auth-form.tsx | 128 |
1 files changed, 106 insertions, 22 deletions
diff --git a/components/login/partner-auth-form.tsx b/components/login/partner-auth-form.tsx index effd7bd3..ada64d96 100644 --- a/components/login/partner-auth-form.tsx +++ b/components/login/partner-auth-form.tsx @@ -16,11 +16,22 @@ import { DropdownMenuRadioItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" -import { GlobeIcon, ChevronDownIcon, Loader, Ship } from "lucide-react" +import { GlobeIcon, ChevronDownIcon, Loader, Ship, LogIn, InfoIcon, HelpCircle } from "lucide-react" import { languages } from "@/config/language" import { cn } from "@/lib/utils" import { buttonVariants } from "@/components/ui/button" import { siteConfig } from "@/config/site" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" +import { + Alert, + AlertDescription, + AlertTitle, +} from "@/components/ui/alert" import { checkJoinPortal } from "@/lib/vendors/service" import Image from "next/image" @@ -30,11 +41,13 @@ interface UserAuthFormProps extends React.HTMLAttributes<HTMLDivElement> { } export function CompanyAuthForm({ className, ...props }: UserAuthFormProps) { const [isLoading, setIsLoading] = React.useState<boolean>(false) + const [showInfoBanner, setShowInfoBanner] = React.useState<boolean>(true) const router = useRouter() const { toast } = useToast() - const params = useParams() - const pathname = usePathname() + const params = useParams() || {}; + const pathname = usePathname() || ''; + const lng = params.lng as string const { t, i18n } = useTranslation(lng, "login") @@ -51,6 +64,11 @@ export function CompanyAuthForm({ className, ...props }: UserAuthFormProps) { ? t("languages.japanese") : t("languages.english") + // 로그인 페이지로 이동 + const goToLogin = () => { + router.push(`/${lng}/partners`); + } + // --------------------------- // 1) onSubmit -> 서버 액션 호출 // --------------------------- @@ -86,11 +104,26 @@ export function CompanyAuthForm({ className, ...props }: UserAuthFormProps) { // 가입 가능 → signup 페이지 이동 router.push(`/partners/signup?taxID=${taxID}`) } else { + // 이미 등록된 기업인 경우 - 로그인으로 안내하는 토스트와 함께 추가 액션 제공 toast({ variant: "destructive", title: "가입이 진행 중이거나 완료된 회사", description: `${result.data} 에 연락하여 계정 생성 요청을 하시기 바랍니다.`, }) + + // 로그인 액션 버튼이 있는 알림 표시 + setTimeout(() => { + toast({ + title: "이미 등록된 회사이신가요?", + description: "로그인 페이지로 이동하여 계정에 접속하세요.", + action: ( + <Button variant="outline" onClick={goToLogin} className="bg-blue-50 border-blue-300"> + <LogIn className="mr-2 h-4 w-4" /> + 로그인하기 + </Button> + ), + }) + }, 1000); } } catch (error: any) { console.error(error) @@ -111,43 +144,80 @@ export function CompanyAuthForm({ className, ...props }: UserAuthFormProps) { <div className="flex flex-col w-full h-screen lg:p-2"> {/* Top bar */} - <div className="flex items-center justify-between"> + <div className="flex items-center justify-between p-4"> <div className="flex items-center space-x-2"> - {/* <img - src="/images/logo.png" - alt="logo" - className="h-8 w-auto" - /> */} <Ship className="w-4 h-4" /> <span className="text-md font-bold">eVCP</span> </div> - {/* Remove 'absolute right-4 top-4 ...', just use buttonVariants */} + {/* 로그인 버튼 가시성 개선 */} <Link - href="/login" + href={`/${lng}/partners`} className={cn( - buttonVariants({ variant: "ghost" }) + buttonVariants({ variant: "outline" }), + "border-blue-500 text-blue-600 hover:bg-blue-50" )} > - Login + <LogIn className="mr-2 h-4 w-4" /> + {t("login") || "로그인"} </Link> </div> <div className="flex-1 flex items-center justify-center"> - <div className="mx-auto w-full flex flex-col space-y-6 sm:w-[350px]"> + <div className="mx-auto w-full flex flex-col space-y-6 sm:w-[400px]"> + {/* 정보 알림 배너 - 업체 등록과 로그인의 관계 설명 */} + {showInfoBanner && ( + <Alert className="bg-blue-50 border-blue-200"> + <InfoIcon className="h-4 w-4 text-blue-600" /> + <AlertTitle className="text-blue-700 mt-1"> + {t("registrationInfoTitle") || "업체 등록 신청 안내"} + </AlertTitle> + <AlertDescription className="text-blue-600"> + {t("registrationInfoDescription") || "이미 등록된 업체의 직원이신가요? 상단의 로그인 버튼을 눌러 로그인하세요. 새로운 업체 등록을 원하시면 아래 양식을 작성해주세요."} + </AlertDescription> + <Button + variant="ghost" + size="sm" + onClick={() => setShowInfoBanner(false)} + className="absolute top-2 right-4 h-6 w-6 p-0" + > + ✕ + </Button> + </Alert> + )} + <div className="flex flex-col space-y-2 text-center"> <h1 className="text-2xl font-semibold tracking-tight"> - {t("heading")} + {t("heading") || "업체 등록 신청"} </h1> - <p className="text-sm text-muted-foreground">{t("subheading")}</p> + <p className="text-sm text-muted-foreground"> + {t("subheading") || "귀사의 사업자 등록 번호를 입력하여 등록을 시작하세요"} + </p> </div> <div className={cn("grid gap-6", className)} {...props}> <form onSubmit={onSubmit}> - <div className="grid gap-2"> - <div className="grid gap-1"> - <label className="sr-only" htmlFor="taxid"> - Business Number / Tax ID - </label> + <div className="grid gap-4"> + <div className="grid gap-2"> + <div className="flex items-center justify-between"> + <Label htmlFor="taxid"> + 사업자등록번호 / Tax ID + </Label> + <TooltipProvider> + <Tooltip> + <TooltipTrigger asChild> + <Button variant="ghost" size="icon" className="h-6 w-6 p-0"> + <HelpCircle className="h-4 w-4 text-muted-foreground" /> + <span className="sr-only">Help</span> + </Button> + </TooltipTrigger> + <TooltipContent> + <p className="max-w-xs"> + {t("taxIdTooltip") || "법인/개인사업자 사업자등록번호를 '-' 포함하여 입력해주세요 (예: 123-45-67890)"} + </p> + </TooltipContent> + </Tooltip> + </TooltipProvider> + </div> <input id="taxid" name="taxid" @@ -159,12 +229,26 @@ export function CompanyAuthForm({ className, ...props }: UserAuthFormProps) { disabled={isLoading} className="w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50" /> + <p className="text-xs text-muted-foreground"> + {t("taxIdHint") || "사업자 등록 번호는 업체 인증에 사용됩니다"} + </p> </div> <Button type="submit" disabled={isLoading} variant="samsung"> {isLoading && <Loader className="mr-2 h-4 w-4 animate-spin" />} - {t("joinButton")} + {t("joinButton") || "업체 등록 시작하기"} </Button> + {/* 로그인 안내 링크 추가 */} + <div className="text-center"> + <Button + variant="link" + className="text-blue-600 hover:text-blue-800 text-sm" + onClick={goToLogin} + > + {t("alreadyRegistered") || "이미 등록된 업체이신가요? 로그인하기"} + </Button> + </div> + {/* 언어 선택 Dropdown */} <div className="mx-auto"> <DropdownMenu> |
