Skip to content

Commit bc90eae

Browse files
author
Laurie T. Malau
committed
Fix render
1 parent 83562fa commit bc90eae

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

components/dashboard/src/Login.tsx

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export function Login() {
4848
const { setUser } = useContext(UserContext);
4949
const { setTeams } = useContext(TeamsContext);
5050
const urlHash = getURLHash();
51-
const URLFromPrefix = urlHash ? new URL(urlHash).host : null;
52-
const showWelcome = !hasLoggedInBefore() && !hasVisitedMarketingWebsiteBefore() && urlHash.length === 0;
51+
const URLFromPrefix = urlHash.length > 0 ? new URL(urlHash).host : null;
52+
const showWelcome = !hasLoggedInBefore() && !hasVisitedMarketingWebsiteBefore();
5353

5454
const [ authProviders, setAuthProviders ] = useState<AuthProviderInfo[]>([]);
5555
const [ errorMessage, setErrorMessage ] = useState<string | undefined>(undefined);
@@ -116,25 +116,33 @@ export function Login() {
116116
}
117117

118118
const renderWelcomeText = () => {
119-
if (showWelcome) {
120-
return (
121-
<div className="mx-auto text-center pb-8 space-y-2">
122-
<h1 className="text-3xl">Log in to Gitpod</h1>
123-
<h2 className="uppercase text-sm text-gray-400">ALWAYS READY-TO-CODE</h2>
124-
</div>
125-
)
126-
}
127-
return (
128-
<div className="mx-auto text-center pb-8 space-y-2">
119+
if (providerFromPrefix) {
120+
return (<div className="mx-auto text-center pb-8 space-y-2">
129121
<h1 className="text-3xl">Log in / Sign up</h1>
130122
<h2 className="text-m text-gray-400">Open a cloud-based environment for</h2>
131123
<h2 className="text-m text-gray-400">{urlHash}</h2>
124+
</div>)
125+
}
126+
return (
127+
<div className="mx-auto text-center pb-8 space-y-2">
128+
<h1 className="text-3xl">Log in{showWelcome ? '' : ' to Gitpod'}</h1>
129+
<h2 className="uppercase text-sm text-gray-400">ALWAYS READY-TO-CODE</h2>
132130
</div>
133131
)
134132
}
135133

136134
const renderAuthProviders = () => {
137-
if (showWelcome) {
135+
if (providerFromPrefix) {
136+
return (
137+
<div className="flex flex-col space-y-3 items-center">
138+
<button key={"button" + providerFromPrefix.host} className="btn-login flex-none w-56 h-10 p-0 inline-flex" onClick={() => openLogin(providerFromPrefix.host)}>
139+
{iconForAuthProvider(providerFromPrefix.authProviderType)}
140+
<span className="pt-2 pb-2 mr-3 text-sm my-auto font-medium truncate overflow-ellipsis">Continue with {simplifyProviderName(providerFromPrefix.host)}</span>
141+
</button>
142+
</div>
143+
)
144+
}
145+
return (
138146
<div className="flex flex-col space-y-3 items-center">
139147
{authProviders.map(ap => {
140148
return (
@@ -145,17 +153,7 @@ export function Login() {
145153
);
146154
})}
147155
</div>
148-
}
149-
if (!showWelcome && providerFromPrefix) {
150-
return (
151-
<div className="flex flex-col space-y-3 items-center">
152-
<button key={"button" + providerFromPrefix.host} className="btn-login flex-none w-56 h-10 p-0 inline-flex" onClick={() => openLogin(providerFromPrefix.host)}>
153-
{iconForAuthProvider(providerFromPrefix.authProviderType)}
154-
<span className="pt-2 pb-2 mr-3 text-sm my-auto font-medium truncate overflow-ellipsis">Continue with {simplifyProviderName(providerFromPrefix.host)}</span>
155-
</button>
156-
</div>
157-
)
158-
}
156+
)
159157
}
160158

161159
return (<div id="login-container" className="z-50 flex w-screen h-screen">

0 commit comments

Comments
 (0)