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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
feat: Update dashboard card (#2726)
Oleg Isonen97837bb4edfa
diff --git a/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-content.tsx b/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-content.tsxindex 2123195e76..91d0dd00a4 100644--- a/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-content.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-content.tsx@@ -26,7 +26,7 @@ import {Tooltip,} from "@webstudio-is/design-system";import {- InformationIcon,+ InfoCircleIcon,ShadowInsetIcon,ShadowNormalIcon,} from "@webstudio-is/icons";@@ -420,7 +420,7 @@ export const BoxShadowContent = ({</Text>}>- <InformationIcon />+ <InfoCircleIcon /></Tooltip></Flex></Label>diff --git a/apps/builder/app/builder/features/style-panel/sections/transitions/transition-content.tsx b/apps/builder/app/builder/features/style-panel/sections/transitions/transition-content.tsxindex 677789fb81..4ea26480e1 100644--- a/apps/builder/app/builder/features/style-panel/sections/transitions/transition-content.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/transitions/transition-content.tsx@@ -23,7 +23,7 @@ import {parseTransition,type ExtractedTransitionProperties,} from "@webstudio-is/css-data";-import { InformationIcon } from "@webstudio-is/icons";+import { InfoCircleIcon } from "@webstudio-is/icons";import type { DeleteProperty } from "../../shared/use-style-data";import { type IntermediateStyleValue } from "../../shared/css-value-input";import { TransitionProperty } from "./transition-property";@@ -240,7 +240,7 @@ export const TransitionContent = ({</Text>}>- <InformationIcon />+ <InfoCircleIcon /></Tooltip></Flex></Label>diff --git a/apps/builder/app/dashboard/projects/project-card.tsx b/apps/builder/app/dashboard/projects/project-card.tsxindex aa238c61a6..a164b037a2 100644--- a/apps/builder/app/dashboard/projects/project-card.tsx+++ b/apps/builder/app/dashboard/projects/project-card.tsx@@ -9,11 +9,14 @@ import {Flex,Grid,Text,+ textVariants,+ truncate,theme,Box,+ Tooltip,+ rawTheme,} from "@webstudio-is/design-system";-import { MenuIcon } from "@webstudio-is/icons";-import type { DashboardProject } from "@webstudio-is/prisma-client";+import { InfoCircleIcon, MenuIcon } from "@webstudio-is/icons";import { type KeyboardEvent, useEffect, useRef, useState } from "react";import { builderPath, getPublishedUrl } from "~/shared/router-utils";import {@@ -26,6 +29,7 @@ import {import { Thumbnail, ThumbnailLink } from "./thumbnail-link";import { useNavigation } from "@remix-run/react";import { Spinner } from "../spinner";+import type { DashboardProject } from "@webstudio-is/dashboard";const containerStyle = css({overflow: "hidden",@@ -56,6 +60,13 @@ const footerStyle = css({px: theme.spacing[7],});+const titleStyle = css({+ userSelect: "auto",+ ...truncate(),+});++const infoIconStyle = css({ flexShrink: 0 });+const usePublishedLink = ({ domain }: { domain: string }) => {const [url, setUrl] = useState<URL>();@@ -68,6 +79,17 @@ const usePublishedLink = ({ domain }: { domain: string }) => {return { url };};+const linkStyle = css({+ ...textVariants.regular,+ ...truncate(),+ cursor: "pointer",+ color: theme.colors.foregroundSubtle,+ "&:hover": {+ textDecoration: "underline",+ },+});++// @todo use Link component once ready https://github.com/webstudio-is/webstudio/pull/2697const PublishedLink = ({domain,tabIndex,@@ -77,21 +99,15 @@ const PublishedLink = ({}) => {const { url } = usePublishedLink({ domain });return (- <Text- as="a"+ <ahref={url?.href}target="_blank"- truncate- color="subtle"+ rel="noreferrer"tabIndex={tabIndex}- css={{- "&:not(:hover)": {- textDecoration: "none",- },- }}+ className={linkStyle()}>{url?.host}- </Text>+ </a>);};@@ -172,10 +188,15 @@ const useProjectCard = () => {};};-type ProjectCardProps = Pick<- DashboardProject,- "id" | "title" | "domain" | "isPublished"-> & { hasProPlan: boolean };+const formatDate = (date: string) => {+ return new Date(date).toLocaleDateString("en-US", {+ year: "numeric",+ month: "short",+ day: "numeric",+ });+};++type ProjectCardProps = DashboardProject & { hasProPlan: boolean };export const ProjectCard = ({id,@@ -183,6 +204,8 @@ export const ProjectCard = ({domain,isPublished,hasProPlan,+ createdAt,+ latestBuild,}: ProjectCardProps) => {const [isRenameDialogOpen, setIsRenameDialogOpen] = useState(false);const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);@@ -194,7 +217,6 @@ export const ProjectCard = ({const linkPath = builderPath({ projectId: id });// Transition to the project has started, we may need to show a spinnerconst isTransitioning = state !== "idle" && linkPath === location.pathname;-return (<Box as="article" hidden={isHidden}><Flex@@ -218,9 +240,31 @@ export const ProjectCard = ({className={footerStyle()}><Flex direction="column" justify="around">- <Text variant="titles" truncate css={{ userSelect: "auto" }}>- {title}- </Text>+ <Flex gap="1">+ <Text variant="titles" className={titleStyle()}>+ {title}+ </Text>+ <Tooltip+ variant="wrapped"+ content={+ <Text variant="small">+ Created on {formatDate(createdAt)}+ {latestBuild?.publishStatus === "PUBLISHED" && (+ <>+ <br />+ Published on {formatDate(latestBuild.updatedAt)}+ </>+ )}+ </Text>+ }+ >+ <InfoCircleIcon+ color={rawTheme.colors.foregroundSubtle}+ tabIndex={-1}+ className={infoIconStyle()}+ />+ </Tooltip>+ </Flex>{isPublished ? (<PublishedLink domain={domain} tabIndex={-1} />) : (diff --git a/packages/design-system/src/components/text.ts b/packages/design-system/src/components/text.tsindex c9750093e6..f64ad81b97 100644--- a/packages/design-system/src/components/text.ts+++ b/packages/design-system/src/components/text.ts@@ -1,4 +1,5 @@import { css, theme, styled } from "../stitches.config";+import { truncate } from "../utilities";import { typography } from "../__generated__/figma-design-tokens";const normalize = {@@ -46,9 +47,7 @@ export const textStyle = css({},truncate: {true: {- whiteSpace: "nowrap",- textOverflow: "ellipsis",- overflow: "hidden",+ ...truncate(),// To make sure text is not clipped verticallypt: "0.5em",diff --git a/packages/design-system/src/components/toast.tsx b/packages/design-system/src/components/toast.tsxindex 39a090efe6..fcc733e056 100644--- a/packages/design-system/src/components/toast.tsx+++ b/packages/design-system/src/components/toast.tsx@@ -1,7 +1,7 @@import * as ToastPrimitive from "@radix-ui/react-toast";import toast, { resolveValue, useToaster } from "react-hot-toast/headless";import { keyframes, styled } from "../stitches.config";-import { InfoIcon } from "@webstudio-is/icons";+import { InfoCircleIcon } from "@webstudio-is/icons";import { Box } from "./box";import { theme } from "../stitches.config";@@ -121,7 +121,7 @@ export const Toaster = () => {},}}>- {toastData.type === "blank" && <InfoIcon />}+ {toastData.type === "blank" && <InfoCircleIcon />}</Box><StyledTitle>{resolveValue(toastData.message, toastData)}diff --git a/packages/design-system/src/utilities.ts b/packages/design-system/src/utilities.tsindex c181e7b71a..2318c1322e 100644--- a/packages/design-system/src/utilities.ts+++ b/packages/design-system/src/utilities.ts@@ -81,3 +81,9 @@ export const useDisableCanvasPointerEvents = () => {return enableDisable;};++export const truncate = () => ({+ whiteSpace: "nowrap",+ textOverflow: "ellipsis",+ overflow: "hidden",+});diff --git a/packages/icons/icons/info-circle.svg b/packages/icons/icons/info-circle.svgnew file mode 100644index 0000000000..262e0be3fb--- /dev/null+++ b/packages/icons/icons/info-circle.svg@@ -0,0 +1,23 @@+<svg+ width="16"+ height="16"+ viewBox="0 0 16 16"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+>+ <path+ fill-rule="evenodd"+ clip-rule="evenodd"+ d="M7.99997 13.35C10.9547 13.35 13.35 10.9548 13.35 8.00004C13.35 5.04531 10.9547 2.65004 7.99998 2.65004C5.04525 2.65004 2.64998 5.04531 2.64998 8.00004C2.64998 10.9548 5.04525 13.35 7.99997 13.35ZM14.65 8.00004C14.65 11.6727 11.6727 14.65 7.99997 14.65C4.32728 14.65 1.34998 11.6727 1.34998 8.00004C1.34998 4.32734 4.32728 1.35004 7.99998 1.35004C11.6727 1.35004 14.65 4.32734 14.65 8.00004Z"+ />+ <path+ fill-rule="evenodd"+ clip-rule="evenodd"+ d="M8.79997 4.9133C8.79997 5.35512 8.44179 5.7133 7.99997 5.7133H7.99139C7.54956 5.7133 7.19139 5.35512 7.19139 4.9133C7.19139 4.47147 7.54956 4.1133 7.99139 4.1133H7.99997C8.44179 4.1133 8.79997 4.47147 8.79997 4.9133Z"+ />+ <path+ fill-rule="evenodd"+ clip-rule="evenodd"+ d="M7.99996 11.7367C7.64098 11.7367 7.34996 11.4457 7.34996 11.0867L7.34997 7.65688C7.34997 7.2979 7.64098 7.00688 7.99996 7.00688C8.35895 7.00688 8.64996 7.2979 8.64996 7.65688L8.64996 11.0867C8.64996 11.4457 8.35895 11.7367 7.99996 11.7367Z"+ />+</svg>diff --git a/packages/icons/icons/info.svg b/packages/icons/icons/info.svgdeleted file mode 100644index b42008c6fd..0000000000--- a/packages/icons/icons/info.svg+++ /dev/null@@ -1,6 +0,0 @@-<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">- <path d="M8.76075 5.62758C8.76075 5.21336 8.42496 4.87758 8.01075 4.87758C7.59653 4.87758 7.26075 5.21336 7.26075 5.62758V8.45629C7.26075 8.87051 7.59653 9.20629 8.01075 9.20629C8.42496 9.20629 8.76075 8.8705 8.76075 8.45629V5.62758Z" />- <path d="M8.00001 9.62614C7.58579 9.62614 7.25001 9.96193 7.25001 10.3761C7.25001 10.7904 7.58579 11.1261 8.00001 11.1261H8.00672C8.42094 11.1261 8.75672 10.7904 8.75672 10.3761C8.75672 9.96193 8.42094 9.62614 8.00672 9.62614H8.00001Z" />- <path fill-rule="evenodd" clip-rule="evenodd" d="M8.00001 2.35001C6.50153 2.35001 5.06443 2.94527 4.00485 4.00485C2.94527 5.06443 2.35001 6.50153 2.35001 8.00001C2.35001 8.74197 2.49615 9.47668 2.78009 10.1622C3.06403 10.8477 3.4802 11.4705 4.00485 11.9952C4.5295 12.5198 5.15235 12.936 5.83784 13.2199C6.52333 13.5039 7.25804 13.65 8.00001 13.65C8.74197 13.65 9.47668 13.5039 10.1622 13.2199C10.8477 12.936 11.4705 12.5198 11.9952 11.9952C12.5198 11.4705 12.936 10.8477 13.2199 10.1622C13.5039 9.47668 13.65 8.74197 13.65 8.00001C13.65 6.50153 13.0547 5.06443 11.9952 4.00485C10.9356 2.94527 9.49848 2.35001 8.00001 2.35001ZM4.92409 4.92409C5.73987 4.10831 6.84631 3.65001 8.00001 3.65001C9.1537 3.65001 10.2601 4.10831 11.0759 4.92409C11.8917 5.73987 12.35 6.84631 12.35 8.00001C12.35 8.57126 12.2375 9.13691 12.0189 9.66468C11.8003 10.1924 11.4799 10.672 11.0759 11.0759C10.672 11.4799 10.1924 11.8003 9.66468 12.0189C9.13691 12.2375 8.57126 12.35 8.00001 12.35C7.42876 12.35 6.8631 12.2375 6.33533 12.0189C5.80757 11.8003 5.32803 11.4799 4.92409 11.0759C4.52016 10.672 4.19974 10.1924 3.98113 9.66468C3.76252 9.13691 3.65001 8.57126 3.65001 8.00001C3.65001 6.84631 4.10831 5.73987 4.92409 4.92409Z" />-</svg>-\ No newline at end of filediff --git a/packages/icons/icons/information.svg b/packages/icons/icons/information.svgdeleted file mode 100644index b4fc4af008..0000000000--- a/packages/icons/icons/information.svg+++ /dev/null@@ -1,5 +0,0 @@-<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">-<path fill-rule="evenodd" clip-rule="evenodd" d="M8.0001 2.64985C5.04537 2.64985 2.6501 5.04513 2.6501 7.99985C2.6501 10.9546 5.04537 13.3499 8.0001 13.3499C10.9548 13.3499 13.3501 10.9546 13.3501 7.99985C13.3501 5.04513 10.9548 2.64985 8.0001 2.64985ZM1.3501 7.99985C1.3501 4.32716 4.3274 1.34985 8.0001 1.34985C11.6728 1.34985 14.6501 4.32716 14.6501 7.99985C14.6501 11.6725 11.6728 14.6499 8.0001 14.6499C4.3274 14.6499 1.3501 11.6725 1.3501 7.99985Z" fill="#707375"/>-<path fill-rule="evenodd" clip-rule="evenodd" d="M7.20011 11.0866C7.20011 10.6448 7.55828 10.2866 8.00011 10.2866H8.00868C8.45051 10.2866 8.80868 10.6448 8.80868 11.0866C8.80868 11.5284 8.45051 11.8866 8.00868 11.8866H8.00011C7.55828 11.8866 7.20011 11.5284 7.20011 11.0866Z" fill="#707375"/>-<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00011 4.26321C8.35909 4.26321 8.65011 4.55423 8.65011 4.91321V8.34301C8.65011 8.70199 8.35909 8.99301 8.00011 8.99301C7.64112 8.99301 7.35011 8.70199 7.35011 8.34301V4.91321C7.35011 4.55423 7.64112 4.26321 8.00011 4.26321Z" fill="#707375"/>-</svg>diff --git a/packages/icons/src/__generated__/index.ts b/packages/icons/src/__generated__/index.tsindex de1b5995ae..d4eb70a365 100644--- a/packages/icons/src/__generated__/index.ts+++ b/packages/icons/src/__generated__/index.ts@@ -100,8 +100,7 @@ export * from "./heading";export * from "./help";export * from "./home";export * from "./image";-export * from "./info";-export * from "./information";+export * from "./info-circle";export * from "./item";export * from "./j-c-center";export * from "./j-c-end";diff --git a/packages/icons/src/__generated__/info-circle.tsx b/packages/icons/src/__generated__/info-circle.tsxnew file mode 100644index 0000000000..a9b17de709--- /dev/null+++ b/packages/icons/src/__generated__/info-circle.tsx@@ -0,0 +1,15 @@+// Generated from icons/info-circle.svg++import { forwardRef } from "react";+import type { IconProps } from "../types";++// prettier-ignore+export const InfoCircleIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path d="M8 13.35a5.35 5.35 0 1 0 0-10.7 5.35 5.35 0 0 0 0 10.7ZM14.65 8a6.65 6.65 0 1 1-13.3 0 6.65 6.65 0 0 1 13.3 0Z" clipRule="evenodd" /><path d="M8.8 4.913a.8.8 0 0 1-.8.8h-.009a.8.8 0 0 1 0-1.6H8a.8.8 0 0 1 .8.8ZM8 11.737a.65.65 0 0 1-.65-.65v-3.43a.65.65 0 1 1 1.3 0v3.43a.65.65 0 0 1-.65.65Z" clipRule="evenodd" /></svg>+ );+ }+);++InfoCircleIcon.displayName = "InfoCircleIcon";diff --git a/packages/icons/src/__generated__/info.tsx b/packages/icons/src/__generated__/info.tsxdeleted file mode 100644index f7af714a3b..0000000000--- a/packages/icons/src/__generated__/info.tsx+++ /dev/null@@ -1,15 +0,0 @@-// Generated from icons/info.svg--import { forwardRef } from "react";-import type { IconProps } from "../types";--// prettier-ignore-export const InfoIcon = forwardRef<SVGSVGElement, IconProps>(- ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {- return (- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path d="M8.76 5.628a.75.75 0 1 0-1.5 0v2.828a.75.75 0 1 0 1.5 0V5.628ZM8 9.626a.75.75 0 1 0 0 1.5h.007a.75.75 0 1 0 0-1.5H8Z" /><path fillRule="evenodd" d="M8 2.35a5.65 5.65 0 1 0 0 11.3 5.65 5.65 0 0 0 0-11.3ZM4.924 4.924a4.35 4.35 0 1 1 6.152 6.152 4.35 4.35 0 0 1-6.152-6.152Z" clipRule="evenodd" /></svg>- );- }-);--InfoIcon.displayName = "InfoIcon";diff --git a/packages/icons/src/__generated__/information.tsx b/packages/icons/src/__generated__/information.tsxdeleted file mode 100644index c35bceec4a..0000000000--- a/packages/icons/src/__generated__/information.tsx+++ /dev/null@@ -1,15 +0,0 @@-// Generated from icons/information.svg--import { forwardRef } from "react";-import type { IconProps } from "../types";--// prettier-ignore-export const InformationIcon = forwardRef<SVGSVGElement, IconProps>(- ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {- return (- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fill="#707375" fillRule="evenodd" d="M8 2.65a5.35 5.35 0 1 0 0 10.7 5.35 5.35 0 0 0 0-10.7ZM1.35 8a6.65 6.65 0 1 1 13.3 0 6.65 6.65 0 0 1-13.3 0Z" clipRule="evenodd" /><path fill="#707375" fillRule="evenodd" d="M7.2 11.087a.8.8 0 0 1 .8-.8h.009a.8.8 0 0 1 0 1.6H8a.8.8 0 0 1-.8-.8ZM8 4.263a.65.65 0 0 1 .65.65v3.43a.65.65 0 0 1-1.3 0v-3.43a.65.65 0 0 1 .65-.65Z" clipRule="evenodd" /></svg>- );- }-);--InformationIcon.displayName = "InformationIcon";diff --git a/packages/icons/src/__generated__/svg/index.ts b/packages/icons/src/__generated__/svg/index.tsindex 63a120b5fb..6e8d774b1b 100644--- a/packages/icons/src/__generated__/svg/index.ts+++ b/packages/icons/src/__generated__/svg/index.ts@@ -100,8 +100,7 @@ export { HeadingIcon } from "./heading";export { HelpIcon } from "./help";export { HomeIcon } from "./home";export { ImageIcon } from "./image";-export { InfoIcon } from "./info";-export { InformationIcon } from "./information";+export { InfoCircleIcon } from "./info-circle";export { ItemIcon } from "./item";export { JCCenterIcon } from "./j-c-center";export { JCEndIcon } from "./j-c-end";diff --git a/packages/icons/src/__generated__/svg/info-circle.ts b/packages/icons/src/__generated__/svg/info-circle.tsnew file mode 100644index 0000000000..41fcf50104--- /dev/null+++ b/packages/icons/src/__generated__/svg/info-circle.ts@@ -0,0 +1 @@+export const InfoCircleIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" width="100%" height="100%" style="display: block;"><path d="M8 13.35a5.35 5.35 0 1 0 0-10.7 5.35 5.35 0 0 0 0 10.7ZM14.65 8a6.65 6.65 0 1 1-13.3 0 6.65 6.65 0 0 1 13.3 0Z" clip-rule="evenodd"/><path d="M8.8 4.913a.8.8 0 0 1-.8.8h-.009a.8.8 0 0 1 0-1.6H8a.8.8 0 0 1 .8.8ZM8 11.737a.65.65 0 0 1-.65-.65v-3.43a.65.65 0 1 1 1.3 0v3.43a.65.65 0 0 1-.65.65Z" clip-rule="evenodd"/></svg>`;diff --git a/packages/icons/src/__generated__/svg/info.ts b/packages/icons/src/__generated__/svg/info.tsdeleted file mode 100644index f478d4d8ac..0000000000--- a/packages/icons/src/__generated__/svg/info.ts+++ /dev/null@@ -1 +0,0 @@-export const InfoIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path d="M8.76 5.628a.75.75 0 1 0-1.5 0v2.828a.75.75 0 1 0 1.5 0V5.628ZM8 9.626a.75.75 0 1 0 0 1.5h.007a.75.75 0 1 0 0-1.5H8Z"/><path fill-rule="evenodd" d="M8 2.35a5.65 5.65 0 1 0 0 11.3 5.65 5.65 0 0 0 0-11.3ZM4.924 4.924a4.35 4.35 0 1 1 6.152 6.152 4.35 4.35 0 0 1-6.152-6.152Z" clip-rule="evenodd"/></svg>`;diff --git a/packages/icons/src/__generated__/svg/information.ts b/packages/icons/src/__generated__/svg/information.tsdeleted file mode 100644index 74bd66121a..0000000000--- a/packages/icons/src/__generated__/svg/information.ts+++ /dev/null@@ -1 +0,0 @@-export const InformationIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path fill="#707375" fill-rule="evenodd" d="M8 2.65a5.35 5.35 0 1 0 0 10.7 5.35 5.35 0 0 0 0-10.7ZM1.35 8a6.65 6.65 0 1 1 13.3 0 6.65 6.65 0 0 1-13.3 0Z" clip-rule="evenodd"/><path fill="#707375" fill-rule="evenodd" d="M7.2 11.087a.8.8 0 0 1 .8-.8h.009a.8.8 0 0 1 0 1.6H8a.8.8 0 0 1-.8-.8ZM8 4.263a.65.65 0 0 1 .65.65v3.43a.65.65 0 0 1-1.3 0v-3.43a.65.65 0 0 1 .65-.65Z" clip-rule="evenodd"/></svg>`;