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.

fix types and add backup image for user

Sara Vieira6aca811362cd
diff --git a/app/dashboard/dashboard.tsx b/app/dashboard/dashboard.tsx
index b293f03a98..c53f15da5d 100644
--- a/app/dashboard/dashboard.tsx
+++ b/app/dashboard/dashboard.tsx
@@ -13,12 +13,13 @@ import {
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
- Box,
IconButton,
+ styled,
} from "~/shared/design-system";
import interStyles from "~/shared/font-faces/inter.css";
import dashboardStyles from "./dashboard.css";
import { User } from "@prisma/client";
+import { UserIcon } from "~/shared/icons/user";
export const links = () => {
return [
@@ -33,6 +34,11 @@ export const links = () => {
];
};
+export const Avatar = styled("img", {
+ width: "$5",
+ borderRadius: "50%",
+});
+
type DashboardProps = {
projects?: Array<{ id: string; title: string }>;
user?: User;
@@ -66,19 +72,14 @@ export const Dashboard = ({ projects = [], config, user }: DashboardProps) => {
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton aria-label="Menu Button">
- <Box
- as="img"
- src={user?.image}
- alt={user?.username}
- css={{
- width: "$5",
- borderRadius: "50%",
- }}
- />
+ {user?.image ? (
+ <Avatar src={user?.image} alt="Open menu" />
+ ) : (
+ <UserIcon color="white" />
+ )}
</IconButton>
</DropdownMenuTrigger>
<DropdownMenuContent>
- {/* <DropdownMenuSeparator /> */}
<DropdownMenuItem onSelect={() => navigate("/logout")}>
<Text>Logout</Text>
</DropdownMenuItem>
diff --git a/app/shared/icons/user.tsx b/app/shared/icons/user.tsx
new file mode 100644
index 0000000000..6cfca75da8
--- /dev/null
+++ b/app/shared/icons/user.tsx
@@ -0,0 +1,33 @@
+import * as React from "react";
+import { IconProps } from "./types";
+
+export const UserIcon = React.forwardRef<SVGSVGElement, IconProps>(
+ ({ color = "currentColor", ...props }, forwardedRef) => {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="none"
+ x="0px"
+ y="0px"
+ {...props}
+ ref={forwardedRef}
+ >
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M12 3.5a8.5 8.5 0 100 17 8.5 8.5 0 000-17zM2.5 12a9.5 9.5 0 1119 0 9.5 9.5 0 01-19 0z"
+ fill={color}
+ />
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M12 7.5a2.5 2.5 0 100 5 2.5 2.5 0 000-5zM8.5 10a3.5 3.5 0 117 0 3.5 3.5 0 01-7 0zM12 16a6.497 6.497 0 00-5.63 3.25l-.866-.5A7.497 7.497 0 0112 15c2.777 0 5.2 1.51 6.497 3.75l-.866.5a6.497 6.497 0 00-5.63-3.25z"
+ fill={color}
+ />
+ </svg>
+ );
+ }
+);
+
+UserIcon.displayName = "UserIcon";