Skip to content

Commit

Permalink
Fix render
Browse files Browse the repository at this point in the history
  • Loading branch information
laushinka committed Dec 2, 2021
1 parent 83562fa commit bc90eae
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions components/dashboard/src/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export function Login() {
const { setUser } = useContext(UserContext);
const { setTeams } = useContext(TeamsContext);
const urlHash = getURLHash();
const URLFromPrefix = urlHash ? new URL(urlHash).host : null;
const showWelcome = !hasLoggedInBefore() && !hasVisitedMarketingWebsiteBefore() && urlHash.length === 0;
const URLFromPrefix = urlHash.length > 0 ? new URL(urlHash).host : null;
const showWelcome = !hasLoggedInBefore() && !hasVisitedMarketingWebsiteBefore();

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

const renderWelcomeText = () => {
if (showWelcome) {
return (
<div className="mx-auto text-center pb-8 space-y-2">
<h1 className="text-3xl">Log in to Gitpod</h1>
<h2 className="uppercase text-sm text-gray-400">ALWAYS READY-TO-CODE</h2>
</div>
)
}
return (
<div className="mx-auto text-center pb-8 space-y-2">
if (providerFromPrefix) {
return (<div className="mx-auto text-center pb-8 space-y-2">
<h1 className="text-3xl">Log in / Sign up</h1>
<h2 className="text-m text-gray-400">Open a cloud-based environment for</h2>
<h2 className="text-m text-gray-400">{urlHash}</h2>
</div>)
}
return (
<div className="mx-auto text-center pb-8 space-y-2">
<h1 className="text-3xl">Log in{showWelcome ? '' : ' to Gitpod'}</h1>
<h2 className="uppercase text-sm text-gray-400">ALWAYS READY-TO-CODE</h2>
</div>
)
}

const renderAuthProviders = () => {
if (showWelcome) {
if (providerFromPrefix) {
return (
<div className="flex flex-col space-y-3 items-center">
<button key={"button" + providerFromPrefix.host} className="btn-login flex-none w-56 h-10 p-0 inline-flex" onClick={() => openLogin(providerFromPrefix.host)}>
{iconForAuthProvider(providerFromPrefix.authProviderType)}
<span className="pt-2 pb-2 mr-3 text-sm my-auto font-medium truncate overflow-ellipsis">Continue with {simplifyProviderName(providerFromPrefix.host)}</span>
</button>
</div>
)
}
return (
<div className="flex flex-col space-y-3 items-center">
{authProviders.map(ap => {
return (
Expand All @@ -145,17 +153,7 @@ export function Login() {
);
})}
</div>
}
if (!showWelcome && providerFromPrefix) {
return (
<div className="flex flex-col space-y-3 items-center">
<button key={"button" + providerFromPrefix.host} className="btn-login flex-none w-56 h-10 p-0 inline-flex" onClick={() => openLogin(providerFromPrefix.host)}>
{iconForAuthProvider(providerFromPrefix.authProviderType)}
<span className="pt-2 pb-2 mr-3 text-sm my-auto font-medium truncate overflow-ellipsis">Continue with {simplifyProviderName(providerFromPrefix.host)}</span>
</button>
</div>
)
}
)
}

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

0 comments on commit bc90eae

Please sign in to comment.