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.

feat: Add support hub directly to the builder (#4652)

Oleg Isonen95a9e085c4c8
diff --git a/apps/builder/app/builder/builder.tsx b/apps/builder/app/builder/builder.tsx
index 3cd3e21e18..a21f3d31a6 100644
--- a/apps/builder/app/builder/builder.tsx
+++ b/apps/builder/app/builder/builder.tsx
@@ -68,6 +68,7 @@ import {
import { useInertHandlers } from "./shared/inert-handlers";
import { TextToolbar } from "./features/workspace/canvas-tools/text-toolbar";
import { SyncClient } from "~/shared/sync-client";
+import { RemoteDialog } from "./features/help/remote-dialog";
registerContainers();
@@ -436,6 +437,7 @@ export const Builder = ({
<Loading state={loadingState} />
<BlockingAlerts />
<CommandPanel />
+ <RemoteDialog />
</div>
</TooltipProvider>
);
diff --git a/apps/builder/app/builder/sidebar-left/help-popover.tsx b/apps/builder/app/builder/features/help/help-center.tsx
similarity index 76%
rename from apps/builder/app/builder/sidebar-left/help-popover.tsx
rename to apps/builder/app/builder/features/help/help-center.tsx
index e31ebeebc1..f5d3a19eb9 100644
--- a/apps/builder/app/builder/sidebar-left/help-popover.tsx
+++ b/apps/builder/app/builder/features/help/help-center.tsx
@@ -11,12 +11,14 @@ import {
BugIcon,
DiscordIcon,
GithubIcon,
- Webstudio1cIcon,
+ LifeBuoyIcon,
+ PageIcon,
Youtube1cIcon,
} from "@webstudio-is/icons";
import { type ComponentProps } from "react";
+import { $remoteDialog } from "../../shared/nano-states";
-export const HelpPopover = ({
+export const HelpCenter = ({
children,
side = "right",
...popoverProps
@@ -41,20 +43,34 @@ export const HelpPopover = ({
css={{ padding: theme.spacing[5] }}
gap="2"
>
+ <Button
+ type="button"
+ prefix={<LifeBuoyIcon />}
+ css={{ justifyContent: "start" }}
+ color="ghost"
+ onClick={() => {
+ $remoteDialog.set({
+ title: "Support Hub",
+ url: "https://help.webstudio.is/",
+ });
+ }}
+ >
+ Support Hub
+ </Button>
<Button
formAction="https://www.youtube.com/playlist"
name="list"
value="PL4vVqpngzeT4sDlanyPe99dYl8BgUYCac"
prefix={<Youtube1cIcon fill="currentColor" />}
- color="destructive"
+ color="ghost"
css={{ justifyContent: "start" }}
>
Learn with videos
</Button>
<Button
formAction="https://docs.webstudio.is/"
- prefix={<Webstudio1cIcon fill="currentColor" />}
- color="gradient"
+ prefix={<PageIcon />}
+ color="ghost"
css={{ justifyContent: "start" }}
>
Learn from docs
@@ -62,7 +78,7 @@ export const HelpPopover = ({
<Button
formAction="https://discord.gg/UNdyrDkq5r"
prefix={<DiscordIcon fill="currentColor" />}
- color="primary"
+ color="ghost"
css={{ justifyContent: "start" }}
>
Join the Community
@@ -70,14 +86,14 @@ export const HelpPopover = ({
<Button
formAction="https://github.com/webstudio-is/webstudio-community/discussions"
prefix={<GithubIcon fill="currentColor" />}
- color="dark"
+ color="ghost"
css={{ justifyContent: "start" }}
>
Discuss on GitHub
</Button>
<Button
prefix={<BugIcon />}
- color="dark"
+ color="ghost"
onClick={() => {
window.open(
"https://github.com/webstudio-is/webstudio-community/discussions/new?category=q-a&labels=bug&title=[Bug]"
@@ -93,4 +109,4 @@ export const HelpPopover = ({
);
};
-HelpPopover.Trigger = PopoverTrigger;
+HelpCenter.Trigger = PopoverTrigger;
diff --git a/apps/builder/app/builder/features/help/remote-dialog.tsx b/apps/builder/app/builder/features/help/remote-dialog.tsx
new file mode 100644
index 0000000000..407ef91ebd
--- /dev/null
+++ b/apps/builder/app/builder/features/help/remote-dialog.tsx
@@ -0,0 +1,57 @@
+import { useStore } from "@nanostores/react";
+import { $remoteDialog } from "../../shared/nano-states";
+import {
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogMaximize,
+ DialogTitle,
+ DialogTitleActions,
+ IconButton,
+} from "@webstudio-is/design-system";
+import { ExternalLinkIcon } from "@webstudio-is/icons";
+
+export const RemoteDialog = () => {
+ const options = useStore($remoteDialog);
+
+ if (options === undefined) {
+ return;
+ }
+
+ return (
+ <Dialog
+ open
+ onOpenChange={() => {
+ $remoteDialog.set(undefined);
+ }}
+ modal={false}
+ >
+ <DialogContent draggable resize="auto" width={640} height={640}>
+ <iframe
+ src={options.url}
+ style={{ border: 0, height: "100%" }}
+ ></iframe>
+ {/* Title is at the end intentionally,
+ * to make the close button last in the tab order
+ */}
+ <DialogTitle
+ suffix={
+ <DialogTitleActions>
+ <IconButton
+ onClick={() => {
+ window.open(options.url, "_blank");
+ }}
+ >
+ <ExternalLinkIcon />
+ </IconButton>
+ <DialogMaximize />
+ <DialogClose />
+ </DialogTitleActions>
+ }
+ >
+ {options.title}
+ </DialogTitle>
+ </DialogContent>
+ </Dialog>
+ );
+};
diff --git a/apps/builder/app/builder/shared/nano-states/index.ts b/apps/builder/app/builder/shared/nano-states/index.ts
index b5986de2d3..b4a63ffaf6 100644
--- a/apps/builder/app/builder/shared/nano-states/index.ts
+++ b/apps/builder/app/builder/shared/nano-states/index.ts
@@ -154,3 +154,5 @@ export const toggleActiveSidebarPanel = (panel: SidebarPanelName) => {
const currentPanel = $activeSidebarPanel.get();
setActiveSidebarPanel(panel === currentPanel ? "none" : panel);
};
+
+export const $remoteDialog = atom<{ title: string; url: string } | undefined>();
diff --git a/apps/builder/app/builder/sidebar-left/sidebar-left.tsx b/apps/builder/app/builder/sidebar-left/sidebar-left.tsx
index 86e6e6ee64..7a91aeb385 100644
--- a/apps/builder/app/builder/sidebar-left/sidebar-left.tsx
+++ b/apps/builder/app/builder/sidebar-left/sidebar-left.tsx
@@ -19,7 +19,7 @@ import {
PlusIcon,
type IconComponent,
} from "@webstudio-is/icons";
-import { HelpPopover } from "./help-popover";
+import { HelpCenter } from "../features/help/help-center";
import { useStore } from "@nanostores/react";
import {
$activeSidebarPanel,
@@ -70,16 +70,16 @@ const AiTabTrigger = () => {
const HelpTabTrigger = () => {
const [helpIsOpen, setHelpIsOpen] = useState(false);
return (
- <HelpPopover onOpenChange={setHelpIsOpen}>
- <HelpPopover.Trigger asChild>
+ <HelpCenter onOpenChange={setHelpIsOpen}>
+ <HelpCenter.Trigger asChild>
<SidebarButton
label="Learn Webstudio or ask for help"
data-state={helpIsOpen ? "active" : undefined}
>
<HelpIcon size={rawTheme.spacing[10]} />
</SidebarButton>
- </HelpPopover.Trigger>
- </HelpPopover>
+ </HelpCenter.Trigger>
+ </HelpCenter>
);
};
diff --git a/apps/builder/app/routes/_ui.(builder).tsx b/apps/builder/app/routes/_ui.(builder).tsx
index bb3244dca2..af4074ab39 100644
--- a/apps/builder/app/routes/_ui.(builder).tsx
+++ b/apps/builder/app/routes/_ui.(builder).tsx
@@ -204,7 +204,7 @@ export const loader = async (loaderArgs: LoaderFunctionArgs) => {
// Still possible create iframe without src attribute
// Disable workers on builder
"Content-Security-Policy",
- `frame-src ${url.origin}/canvas https://app.goentri.com/; worker-src 'none'`
+ `frame-src ${url.origin}/canvas https://app.goentri.com/ https://help.webstudio.is/; worker-src 'none'`
);
return json(
diff --git a/packages/icons/icons/life-buoy.svg b/packages/icons/icons/life-buoy.svg
new file mode 100644
index 0000000000..6477c20c18
--- /dev/null
+++ b/packages/icons/icons/life-buoy.svg
@@ -0,0 +1,18 @@
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <circle cx="12" cy="12" r="10" />
+ <path d="m4.93 4.93 4.24 4.24" />
+ <path d="m14.83 9.17 4.24-4.24" />
+ <path d="m14.83 14.83 4.24 4.24" />
+ <path d="m9.17 14.83-4.24 4.24" />
+ <circle cx="12" cy="12" r="4" />
+</svg>
diff --git a/packages/icons/src/__generated__/components.tsx b/packages/icons/src/__generated__/components.tsx
index 9dc68c7983..00fa917b5a 100644
--- a/packages/icons/src/__generated__/components.tsx
+++ b/packages/icons/src/__generated__/components.tsx
@@ -3025,6 +3025,30 @@ export const LargeXIcon: IconComponent = forwardRef(
);
LargeXIcon.displayName = "LargeXIcon";
+export const LifeBuoyIcon: IconComponent = forwardRef(
+ ({ fill = "none", size = 16, ...props }, forwardedRef) => {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ viewBox="0 0 24 24"
+ width={size}
+ height={size}
+ fill={fill}
+ {...props}
+ ref={forwardedRef}
+ >
+ <circle cx="12" cy="12" r="10" />
+ <path d="m4.93 4.93 4.24 4.24M14.83 9.17l4.24-4.24M14.83 14.83l4.24 4.24M9.17 14.83l-4.24 4.24" />
+ <circle cx="12" cy="12" r="4" />
+ </svg>
+ );
+ }
+);
+LifeBuoyIcon.displayName = "LifeBuoyIcon";
+
export const Link2UnlinkedIcon: IconComponent = forwardRef(
({ fill = "none", size = 16, ...props }, forwardedRef) => {
return (
diff --git a/packages/icons/src/__generated__/svg.ts b/packages/icons/src/__generated__/svg.ts
index 332d3dd233..9021b8b5c2 100644
--- a/packages/icons/src/__generated__/svg.ts
+++ b/packages/icons/src/__generated__/svg.ts
@@ -214,6 +214,8 @@ export const LabelIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" vi
export const LargeXIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" width="100%" height="100%" style="display: block;"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M12.5 3 3 12.5M3 3l9.5 9.5"/></svg>`;
+export const LifeBuoyIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" width="100%" height="100%" style="display: block;"><circle cx="12" cy="12" r="10"/><path d="m4.93 4.93 4.24 4.24M14.83 9.17l4.24-4.24M14.83 14.83l4.24 4.24M9.17 14.83l-4.24 4.24"/><circle cx="12" cy="12" r="4"/></svg>`;
+
export const Link2UnlinkedIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" width="100%" height="100%" style="display: block;"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M10 4.667h1.333a3.333 3.333 0 0 1 0 6.666H10m-4 0H4.667a3.333 3.333 0 0 1 0-6.666H6"/></svg>`;
export const Link2Icon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" width="100%" height="100%" style="display: block;"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M6 11.333H4.667a3.333 3.333 0 0 1 0-6.666H6M10 4.667h1.333a3.334 3.334 0 0 1 0 6.666H10M5.333 8h5.334"/></svg>`;