Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

chore(GithubLogin) - Disable on preview

Sara Vieiraa2d78d613657
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000000..25fa6215fd
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "typescript.tsdk": "node_modules/typescript/lib"
+}
diff --git a/app/auth/login.tsx b/app/auth/login.tsx
index 1427155342..a95f7b5242 100644
--- a/app/auth/login.tsx
+++ b/app/auth/login.tsx
@@ -1,7 +1,15 @@
import { LinksFunction, MetaFunction } from "@remix-run/node";
import { Form, useLoaderData } from "@remix-run/react";
-import { useState } from "react";
-import { Button, Card, Flex, Heading, TextField } from "~/shared/design-system";
+import React, { useState } from "react";
+import env from "~/shared/env";
+import {
+ Button,
+ Card,
+ Flex,
+ Heading,
+ TextField,
+ Tooltip,
+} from "~/shared/design-system";
import interStyles from "~/shared/font-faces/inter.css";
import { GoogleIcon, GithubIcon, CommitIcon } from "~/shared/icons";
@@ -23,6 +31,25 @@ export const links: LinksFunction = () => {
export const meta: MetaFunction = () => {
return { title: "Webstudio Login" };
};
+const isPreviewDeployment = env?.VERCEL_ENV !== "preview";
+
+const WrapperDisabledTooltip = ({
+ children,
+ isPreview,
+}: {
+ children: React.ReactElement;
+ isPreview: boolean;
+}) =>
+ isPreview ? (
+ <Tooltip
+ content="Github login does not work in preview deployments"
+ delayDuration={0}
+ >
+ <span tabIndex={0}>{children}</span>
+ </Tooltip>
+ ) : (
+ children
+ );
export const Login = () => {
const [isDevLogin, setIsDevLogin] = useState(false);
@@ -41,12 +68,14 @@ export const Login = () => {
<Flex gap="2" direction="column" align="center">
<Form action="/auth/github" method="post">
- <Button type="submit">
- <Flex gap="1">
- <GithubIcon width="16" />
- Login with GitHub
- </Flex>
- </Button>
+ <WrapperDisabledTooltip isPreview={isPreviewDeployment}>
+ <Button type="submit" disabled={isPreviewDeployment}>
+ <Flex gap="1">
+ <GithubIcon width="16" />
+ Login with GitHub
+ </Flex>
+ </Button>
+ </WrapperDisabledTooltip>
</Form>
<Form action="/auth/google" method="post">
<Button type="submit" disabled>
diff --git a/app/shared/design-system/components/tooltip.tsx b/app/shared/design-system/components/tooltip.tsx
index c3086585a4..902cb2f98a 100644
--- a/app/shared/design-system/components/tooltip.tsx
+++ b/app/shared/design-system/components/tooltip.tsx
@@ -12,7 +12,9 @@ type TooltipProps = React.ComponentProps<typeof TooltipPrimitive.Root> &
};
const Content = styled(TooltipPrimitive.Content, {
- backgroundColor: "$transparentPanel",
+ backgroundColor: "$loContrast",
+ boxShadow: "inset 0 0 0 1px $colors$slate7",
+ color: "$hiContrast",
borderRadius: "$1",
padding: "$1 $2",
@@ -43,18 +45,12 @@ export const Tooltip = ({
>
<TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
- <Content
- side="top"
- align="center"
- sideOffset={5}
- {...props}
- multiline={multiline}
- >
+ <Content side="top" align="center" {...props} multiline={multiline}>
<Text
size="1"
as="p"
css={{
- color: "$loContrast",
+ color: "currentColor",
lineHeight: multiline ? "20px" : undefined,
}}
>
@@ -66,7 +62,7 @@ export const Tooltip = ({
width={11}
height={5}
style={{
- fill: "currentColor",
+ fill: "$loContrast",
}}
/>
</Box>
diff --git a/app/shared/text-editor/example-text-editor.stories.tsx b/app/shared/text-editor/example-text-editor.stories.tsx
index 01dbe938a5..09a292f316 100644
--- a/app/shared/text-editor/example-text-editor.stories.tsx
+++ b/app/shared/text-editor/example-text-editor.stories.tsx
@@ -12,6 +12,7 @@ const onChange = (editorState: EditorState) => {
const root = $getRoot();
const selection = $getSelection();
+ // eslint-disable-next-line no-console
console.log(root, selection);
});
};