55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import { useMsal } from "@azure/msal-react";
|
|
import { KeyRound } from "lucide-react";
|
|
import {
|
|
isMsalConfigured,
|
|
MSAL_API_SCOPE,
|
|
msalInstance,
|
|
} from "../lib/auth/msal.config";
|
|
import { Button, ErrorNote, PlainPage } from "../ui";
|
|
|
|
function LoginButton() {
|
|
const { instance } = useMsal();
|
|
|
|
return (
|
|
<Button
|
|
label="Entra ID로 로그인"
|
|
variant="primary"
|
|
size="lg"
|
|
width="100%"
|
|
onClick={() =>
|
|
void instance.loginRedirect({
|
|
scopes: [MSAL_API_SCOPE],
|
|
prompt: "select_account",
|
|
})
|
|
}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export default function LoginPage() {
|
|
return (
|
|
<PlainPage width="md" className="py-16 sm:py-24">
|
|
<div className="lts-panel mx-auto max-w-sm p-6 sm:p-8">
|
|
<span className="grid size-11 place-items-center rounded-full bg-primary-tint text-primary">
|
|
<KeyRound className="size-5" aria-hidden="true" />
|
|
</span>
|
|
<h1 className="mt-4 text-xl font-extrabold text-content">로그인</h1>
|
|
<p className="mt-1.5 text-sm leading-relaxed text-content-muted">
|
|
내전 참가 신청, 팀장 경매, 운영 기능은 로그인 후 사용할 수 있습니다.
|
|
전적과 대진은 로그인 없이 볼 수 있습니다.
|
|
</p>
|
|
<div className="mt-6">
|
|
{isMsalConfigured && msalInstance ? (
|
|
<LoginButton />
|
|
) : (
|
|
<ErrorNote
|
|
title="로그인을 사용할 수 없습니다"
|
|
description="MSAL 환경변수 설정이 필요합니다."
|
|
/>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</PlainPage>
|
|
);
|
|
}
|