Skip to content

Commit eb68663

Browse files
Refactor login component to use installation configuration for enterprise detection and update learn more button to a link
1 parent 9d583ee commit eb68663

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

components/dashboard/src/Login.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { SSOLoginForm } from "./login/SSOLoginForm";
1717
import { useAuthProviderDescriptions } from "./data/auth-providers/auth-provider-descriptions-query";
1818
import { SetupPending } from "./login/SetupPending";
1919
import { useNeedsSetup } from "./dedicated-setup/use-needs-setup";
20+
import { useInstallationConfiguration } from "./data/installation/installation-config-query";
2021
import { AuthProviderDescription } from "@gitpod/public-api/lib/gitpod/v1/authprovider_pb";
2122
import { Button, ButtonProps } from "@podkit/buttons/Button";
2223
import { cn } from "@podkit/lib/cn";
@@ -67,7 +68,8 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {
6768
const [hostFromContext, setHostFromContext] = useState<string | undefined>();
6869
const [repoPathname, setRepoPathname] = useState<string | undefined>();
6970

70-
const enterprise = !!authProviders.data && authProviders.data.length === 0;
71+
const { data: installationConfig } = useInstallationConfiguration();
72+
const enterprise = !!installationConfig?.isDedicatedInstallation;
7173

7274
useEffect(() => {
7375
try {
@@ -221,7 +223,8 @@ const LoginContent = ({
221223
const authProviders = useAuthProviderDescriptions();
222224
const [errorMessage, setErrorMessage] = useState<string | undefined>(undefined);
223225

224-
const enterprise = !!authProviders.data && authProviders.data.length === 0;
226+
const { data: installationConfig } = useInstallationConfiguration();
227+
const enterprise = !!installationConfig?.isDedicatedInstallation;
225228

226229
const updateUser = useCallback(async () => {
227230
await getGitpodService().reconnect();
@@ -368,10 +371,6 @@ const RightProductDescriptionPanel = () => {
368371
);
369372
};
370373

371-
const handleLearnMore = () => {
372-
window.open("https://ona.com/", "_blank", "noopener,noreferrer");
373-
};
374-
375374
return (
376375
<div className="w-full lg:w-1/3 flex flex-col justify-center px-4 lg:px-4 md:min-h-screen">
377376
<div className="rounded-lg flex flex-col gap-6 text-white h-full py-4 lg:py-6 max-w-lg mx-auto w-full">
@@ -438,13 +437,15 @@ const RightProductDescriptionPanel = () => {
438437
</p>
439438
</form>
440439
) : (
441-
<button
442-
onClick={handleLearnMore}
440+
<a
441+
href="https://ona.com/"
442+
target="_blank"
443+
rel="noopener noreferrer"
443444
className="w-full bg-white/20 backdrop-blur-sm text-white font-medium py-2.5 px-4 rounded-lg hover:bg-white/30 transition-colors border border-white/20 inline-flex items-center justify-center gap-2 text-sm"
444445
>
445446
Learn more
446447
<span className="font-bold"></span>
447-
</button>
448+
</a>
448449
)}
449450
</div>
450451
</div>

0 commit comments

Comments
 (0)