11import Image from "next/image"
2- import { Box , Button , Stack , Typography } from "@mui/material"
3- import { signIn } from "@/composition"
2+ import { Box , Stack , Typography } from "@mui/material"
43import { env } from "@/common"
5- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
6- import { faGithub , faMicrosoft } from "@fortawesome/free-brands-svg-icons"
74import SignInTexts from "@/features/auth/view/SignInTexts"
85import MessageLinkFooter from "@/common/ui/MessageLinkFooter"
6+ import SignInButton from "./SignInButton"
97
108const SITE_NAME = env . getOrThrow ( "FRAMNA_DOCS_TITLE" )
119const HELP_URL = env . get ( "FRAMNA_DOCS_HELP_URL" )
1210const PROJECT_SOURCE_PROVIDER = env . get ( "PROJECT_SOURCE_PROVIDER" ) || "github"
1311
1412// Force page to be rendered dynamically to ensure we read the correct values for the environment variables.
1513export const dynamic = "force-dynamic"
16-
14+
1715export default async function Page ( ) {
16+ const isAzureDevOps = PROJECT_SOURCE_PROVIDER === "azure-devops"
17+ const providerId = isAzureDevOps ? "microsoft-entra-id" : "github"
18+
1819 return (
1920 < Box display = "flex" height = "100vh" >
20- < InfoColumn />
21- < SignInColumn />
21+ < InfoColumn />
22+ < SignInColumn
23+ providerId = { providerId }
24+ />
2225 </ Box >
2326 )
2427}
@@ -37,7 +40,11 @@ const InfoColumn = () => {
3740 )
3841}
3942
40- const SignInColumn = ( ) => {
43+ interface SignInColumnProps {
44+ providerId : string
45+ }
46+
47+ const SignInColumn = ( { providerId } : SignInColumnProps ) => {
4148 const title = `Get started with ${ SITE_NAME } `
4249 return (
4350 < Box
@@ -75,42 +82,17 @@ const SignInColumn = () => {
7582 } } >
7683 { title }
7784 </ Typography >
78- < SignInButton />
85+ < SignInButton providerId = { providerId } />
7986 </ Stack >
8087 </ Box >
8188 { HELP_URL && (
8289 < Box sx = { { marginBottom : 2 } } >
83- < MessageLinkFooter
90+ < MessageLinkFooter
8491 url = { HELP_URL }
8592 content = { `Learn more about ${ SITE_NAME } ` }
8693 />
8794 </ Box >
88- ) }
95+ ) }
8996 </ Box >
9097 )
9198}
92-
93- const SignInButton = ( ) => {
94- const isAzureDevOps = PROJECT_SOURCE_PROVIDER === "azure-devops"
95- const providerId = isAzureDevOps ? "microsoft-entra-id" : "github"
96- const providerName = isAzureDevOps ? "Microsoft" : "GitHub"
97- const providerIcon = isAzureDevOps ? faMicrosoft : faGithub
98-
99- return (
100- < form
101- action = { async ( ) => {
102- "use server"
103- await signIn ( providerId , { redirectTo : "/" } )
104- } }
105- >
106- < Button variant = "outlined" type = "submit" >
107- < Stack direction = "row" alignItems = "center" spacing = { 1 } padding = { 1 } >
108- < FontAwesomeIcon icon = { providerIcon } size = "2xl" />
109- < Typography variant = "h6" sx = { { display : "flex" } } >
110- Sign in with { providerName }
111- </ Typography >
112- </ Stack >
113- </ Button >
114- </ form >
115- )
116- }
0 commit comments