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.

PR fixes

Sara Vieira9e569136e38f
diff --git a/app/auth/login.tsx b/app/auth/login.tsx
index c8f976e083..1d64173864 100644
--- a/app/auth/login.tsx
+++ b/app/auth/login.tsx
@@ -63,10 +63,10 @@ export const Login = () => {
css={{ width: "100%", flexGrow: 1 }}
name="secret"
type="text"
- variant="ghost"
minLength={2}
required
autoFocus
+ placeholder="Place your AUTH_SECRET"
/>
</Form>
) : (
diff --git a/app/dashboard/components/card.tsx b/app/dashboard/components/card.tsx
new file mode 100644
index 0000000000..fa5f69c842
--- /dev/null
+++ b/app/dashboard/components/card.tsx
@@ -0,0 +1,87 @@
+import { useState } from "react";
+import { Form, useTransition } from "@remix-run/react";
+import { useNavigate } from "react-router-dom";
+
+import {
+ Flex,
+ Card,
+ Select,
+ TextField,
+ Button,
+ Heading,
+ Text,
+} from "~/shared/design-system";
+
+type SelectProjectProjectCardProps = {
+ projects: Array<{ id: string; title: string }>;
+ config: { designerPath: "string" };
+ errors: string;
+};
+
+export const SelectProjectCard = ({
+ projects,
+ config,
+ errors,
+}: SelectProjectProjectCardProps) => {
+ const [selectedProject, setSelectedProject] = useState("");
+ const [newProject, setNewProject] = useState("My awesome project");
+ const navigate = useNavigate();
+ const transition = useTransition();
+
+ const handleOpen = () => {
+ navigate(`${config.designerPath}/${selectedProject}`);
+ };
+ return (
+ <Card css={{ width: "$10", padding: "$5", zoom: 1.4 }} variant="active">
+ <Flex direction="column" gap="2">
+ <Heading>Select a project</Heading>
+ <Select
+ name="project"
+ onChange={(event) => {
+ setSelectedProject(event.target.value);
+ }}
+ value={selectedProject}
+ >
+ <option value="">Create new project</option>
+ {projects.map(({ id, title }) => (
+ <option value={id} key={id}>
+ {title}
+ </option>
+ ))}
+ </Select>
+ {selectedProject === "" ? (
+ <Form method="post">
+ <Flex gap="1">
+ <TextField
+ state={errors ? "invalid" : undefined}
+ name="project"
+ defaultValue={newProject}
+ onFocus={(event) => {
+ event.target.select();
+ }}
+ onChange={(event) => {
+ setNewProject(event.target.value);
+ }}
+ />
+ <Button
+ disabled={
+ newProject.length === 0 || transition.state === "submitting"
+ }
+ type="submit"
+ >
+ {transition.state === "submitting" ? "Creating..." : "Create"}
+ </Button>
+ </Flex>
+ {errors ? (
+ <Text variant="red" css={{ marginTop: "$1" }}>
+ {errors}
+ </Text>
+ ) : null}
+ </Form>
+ ) : (
+ <Button onClick={handleOpen}>Open</Button>
+ )}
+ </Flex>
+ </Card>
+ );
+};
diff --git a/app/dashboard/components/header.tsx b/app/dashboard/components/header.tsx
new file mode 100644
index 0000000000..ee3731bb8a
--- /dev/null
+++ b/app/dashboard/components/header.tsx
@@ -0,0 +1,55 @@
+import { ChevronDownIcon } from "@radix-ui/react-icons";
+import { Avatar } from "~/shared/design-system/components/avatar";
+import {
+ DropdownMenu,
+ DropdownMenuTrigger,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ Button,
+ Text,
+ Flex,
+} from "~/shared/design-system";
+import { User } from "@prisma/client";
+import { useNavigate } from "react-router-dom";
+
+export const DashboardHeader = ({ user }: { user: User }) => {
+ const navigate = useNavigate();
+ const userNameFallback = (user.username || user.email || "X")
+ .charAt(0)
+ .toLocaleUpperCase();
+
+ return (
+ <Flex
+ as="header"
+ align="center"
+ justify="end"
+ css={{
+ p: "$1",
+ bc: "$loContrast",
+ borderBottom: "1px solid $slate8",
+ }}
+ >
+ <Flex gap="1" align="center">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="raw" aria-label="Menu Button">
+ <Flex gap="1" align="center" css={{ height: "$5" }}>
+ <Avatar
+ src={user?.image || undefined}
+ fallback={userNameFallback}
+ />
+
+ <ChevronDownIcon width={15} height={15} color="white" />
+ </Flex>
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent>
+ <DropdownMenuItem onSelect={() => navigate("/logout")}>
+ <Text>Logout</Text>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </Flex>
+ </Flex>
+ );
+};
diff --git a/app/dashboard/dashboard.tsx b/app/dashboard/dashboard.tsx
index 99c449d3a4..396878ba49 100644
--- a/app/dashboard/dashboard.tsx
+++ b/app/dashboard/dashboard.tsx
@@ -1,26 +1,11 @@
-import { useState } from "react";
-import { Form, useActionData, useTransition } from "@remix-run/react";
-import { useNavigate } from "react-router-dom";
-import * as Avatar from "@radix-ui/react-avatar";
+import { useActionData } from "@remix-run/react";
-import {
- Flex,
- Card,
- Select,
- TextField,
- Button,
- Heading,
- Text,
- DropdownMenu,
- DropdownMenuTrigger,
- DropdownMenuContent,
- DropdownMenuItem,
- styled,
-} from "~/shared/design-system";
+import { Flex } from "~/shared/design-system";
import interStyles from "~/shared/font-faces/inter.css";
import dashboardStyles from "./dashboard.css";
import { User } from "@prisma/client";
-import { ChevronDownIcon } from "@radix-ui/react-icons";
+import { DashboardHeader } from "./components/header";
+import { SelectProjectCard } from "./components/card";
export const links = () => {
return [
@@ -35,25 +20,6 @@ export const links = () => {
];
};
-const StyledFallback = styled(Avatar.Fallback, {
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- background: "white",
- fontSize: 15,
- lineHeight: 1,
- fontWeight: 500,
- width: "$5",
- height: "$5",
- borderRadius: "50%",
-});
-
-const StyledAvatar = styled(Avatar.Image, {
- width: "$5",
- height: "$5",
- borderRadius: "50%",
-});
-
type DashboardProps = {
projects?: Array<{ id: string; title: string }>;
user: User;
@@ -61,115 +27,22 @@ type DashboardProps = {
};
export const Dashboard = ({ projects = [], config, user }: DashboardProps) => {
- const [selectedProject, setSelectedProject] = useState("");
- const [newProject, setNewProject] = useState("My awesome project");
const actionData = useActionData();
- const navigate = useNavigate();
- const transition = useTransition();
- const userNameFallback = (user.username || user.email || "X")
- .charAt(0)
- .toLocaleUpperCase();
-
- const handleOpen = () => {
- navigate(`${config.designerPath}/${selectedProject}`);
- };
return (
<>
- <Flex
- as="header"
- align="center"
- justify="end"
- css={{
- p: "$1",
- bc: "$loContrast",
- borderBottom: "1px solid $slate8",
- }}
- >
- <Flex gap="1" align="center">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="raw" aria-label="Menu Button">
- <Flex gap="1" align="center">
- <Avatar.Root>
- {user.image && <StyledAvatar src={user.image} />}
- <StyledFallback delayMs={500}>
- {userNameFallback}
- </StyledFallback>
- </Avatar.Root>
-
- <ChevronDownIcon width={15} height={15} color="white" />
- </Flex>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent>
- <DropdownMenuItem onSelect={() => navigate("/logout")}>
- <Text>Logout</Text>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </Flex>
- </Flex>
+ <DashboardHeader user={user} />
<Flex
css={{ height: "100vh" }}
direction="column"
align="center"
justify="center"
>
- <Card css={{ width: "$10", padding: "$5", zoom: 1.4 }} variant="active">
- <Flex direction="column" gap="2">
- <Heading>Select a project</Heading>
- <Select
- name="project"
- onChange={(event) => {
- setSelectedProject(event.target.value);
- }}
- value={selectedProject}
- >
- <option value="">Create new project</option>
- {projects.map(({ id, title }) => (
- <option value={id} key={id}>
- {title}
- </option>
- ))}
- </Select>
- {selectedProject === "" ? (
- <Form method="post">
- <Flex gap="1">
- <TextField
- state={actionData?.errors ? "invalid" : undefined}
- name="project"
- defaultValue={newProject}
- onFocus={(event) => {
- event.target.select();
- }}
- onChange={(event) => {
- setNewProject(event.target.value);
- }}
- />
- <Button
- disabled={
- newProject.length === 0 ||
- transition.state === "submitting"
- }
- type="submit"
- >
- {transition.state === "submitting"
- ? "Creating..."
- : "Create"}
- </Button>
- </Flex>
- {actionData?.errors ? (
- <Text variant="red" css={{ marginTop: "$1" }}>
- {actionData.errors}
- </Text>
- ) : null}
- </Form>
- ) : (
- <Button onClick={handleOpen}>Open</Button>
- )}
- </Flex>
- </Card>
+ <SelectProjectCard
+ projects={projects}
+ config={config}
+ errors={actionData?.errors}
+ />
</Flex>
</>
);
diff --git a/app/shared/design-system/components/avatar.tsx b/app/shared/design-system/components/avatar.tsx
index 1197e0cc16..3ec503f894 100644
--- a/app/shared/design-system/components/avatar.tsx
+++ b/app/shared/design-system/components/avatar.tsx
@@ -197,7 +197,7 @@ const StyledAvatarImage = styled(AvatarPrimitive.Image, {
const StyledAvatarFallback = styled(AvatarPrimitive.Fallback, {
textTransform: "uppercase",
-
+ borderRadius: "50%",
variants: {
size: {
"1": {