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: loading indicator for AI bar (#2460)

Oleg Isonen581d67221f6c
diff --git a/apps/builder/app/builder/features/ai/ai-command-bar.tsx b/apps/builder/app/builder/features/ai/ai-command-bar.tsx
index ac21e4f664..679d455335 100644
--- a/apps/builder/app/builder/features/ai/ai-command-bar.tsx
+++ b/apps/builder/app/builder/features/ai/ai-command-bar.tsx
@@ -25,6 +25,7 @@ import {
ExternalLinkIcon,
StopIcon,
LargeXIcon,
+ AiLoadingIcon,
} from "@webstudio-is/icons";
import {
useRef,
@@ -164,6 +165,7 @@ export const AiCommandBar = () => {
? undefined
: "Generate AI results";
let aiButtonPending = false;
+ let aiIcon = <AiIcon />;
if (isAudioTranscribing) {
textAreaPlaceholder = "Transcribing voice...";
@@ -208,6 +210,7 @@ export const AiCommandBar = () => {
aiButtonTooltip = "Generating ...";
aiButtonDisabled = true;
aiButtonPending = true;
+ aiIcon = <AiLoadingIcon />;
}
return (
@@ -292,7 +295,7 @@ export const AiCommandBar = () => {
disabled={aiButtonDisabled}
onClick={handleAiButtonClick}
>
- <AiIcon />
+ {aiIcon}
</AiCommandBarButton>
</Tooltip>
</CommandBar>
diff --git a/packages/icons/icons/ai-loading.svg b/packages/icons/icons/ai-loading.svg
new file mode 100644
index 0000000000..47c4fa6134
--- /dev/null
+++ b/packages/icons/icons/ai-loading.svg
@@ -0,0 +1,82 @@
+<svg
+ id="evA4hI5dD261"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ viewBox="0 0 17 17"
+ shape-rendering="geometricPrecision"
+ text-rendering="geometricPrecision"
+>
+ <style>
+ <![CDATA[
+ #evA4hI5dD263 {animation: evA4hI5dD263_s_do 4000ms linear infinite normal forwards}@keyframes evA4hI5dD263_s_do { 0% {stroke-dashoffset: 6.2} 17.5% {stroke-dashoffset: -6.24} 82.5% {stroke-dashoffset: -6.24} 100% {stroke-dashoffset: 6.2}} #evA4hI5dD264 {animation: evA4hI5dD264_s_do 4000ms linear infinite normal forwards}@keyframes evA4hI5dD264_s_do { 0% {stroke-dashoffset: 6.8} 10% {stroke-dashoffset: 6.8} 22.5% {stroke-dashoffset: -6.8} 77.5% {stroke-dashoffset: -6.8} 90% {stroke-dashoffset: 6.8} 100% {stroke-dashoffset: 6.8}} #evA4hI5dD265 {animation: evA4hI5dD265_s_do 4000ms linear infinite normal forwards}@keyframes evA4hI5dD265_s_do { 0% {stroke-dashoffset: 2.32} 17.5% {stroke-dashoffset: 2.32} 27.5% {stroke-dashoffset: -2.32} 72.5% {stroke-dashoffset: -2.32} 82.5% {stroke-dashoffset: 2.32} 100% {stroke-dashoffset: 2.32}} #evA4hI5dD266 {animation: evA4hI5dD266_s_do 4000ms linear infinite normal forwards}@keyframes evA4hI5dD266_s_do { 0% {stroke-dashoffset: 2.47} 22.5% {stroke-dashoffset: 2.47} 32.5% {stroke-dashoffset: -2.47} 67.5% {stroke-dashoffset: -2.47} 77.5% {stroke-dashoffset: 2.47} 100% {stroke-dashoffset: 2.47}} #evA4hI5dD267 {animation: evA4hI5dD267_s_do 4000ms linear infinite normal forwards}@keyframes evA4hI5dD267_s_do { 0% {stroke-dashoffset: 5.42} 27.5% {stroke-dashoffset: 5.42} 40% {stroke-dashoffset: -5.42} 60% {stroke-dashoffset: -5.42} 72.5% {stroke-dashoffset: 5.42} 100% {stroke-dashoffset: 5.42}} #evA4hI5dD268 {animation: evA4hI5dD268_s_do 4000ms linear infinite normal forwards}@keyframes evA4hI5dD268_s_do { 0% {stroke-dashoffset: 6.13} 32.5% {stroke-dashoffset: 6.13} 50% {stroke-dashoffset: -6.1} 67.5% {stroke-dashoffset: 6.13} 100% {stroke-dashoffset: 6.13}}
+ ]]>
+ </style>
+ <path
+ d="M2.81592,12.9564c0,0,.699-2.7972,1.513-6.05155.285-1.1412,1.311-1.9416,2.487-1.9416c1.177,0,2.202.8004,2.487,1.9416.457,1.8276.87798,3.50995,1.15898,4.63435.2059.8244.9668,1.4172,1.816,1.4172c1.0186,0,1.872-.8534,1.872-1.872c0-2.36515,0-6.12835,0-6.12835"
+ fill="none"
+ stroke="rgba(255,255,255,0.4)"
+ stroke-width="2.2"
+ stroke-linecap="round"
+ stroke-dasharray="0"
+ />
+ <path
+ id="evA4hI5dD263"
+ d="M2.81592,12.9564c0,0,.699-2.7972,1.513-6.05155"
+ fill="none"
+ stroke="#fff"
+ stroke-width="3.3"
+ stroke-linecap="round"
+ stroke-dashoffset="6.2"
+ stroke-dasharray="6.24"
+ />
+ <path
+ id="evA4hI5dD264"
+ d="M4.32892,6.90485c.285-1.1412,1.311-1.9416,2.487-1.9416c1.177,0,2.202.8004,2.487,1.9416"
+ fill="none"
+ stroke="#fff"
+ stroke-width="3.3"
+ stroke-linecap="round"
+ stroke-dashoffset="6.8"
+ stroke-dasharray="6.8"
+ />
+ <path
+ id="evA4hI5dD265"
+ d="M9.30292,6.90485c.093946.375699.326476,1.305406.561072,2.243404"
+ fill="none"
+ stroke="#fff"
+ stroke-width="3.3"
+ stroke-linecap="round"
+ stroke-dashoffset="2.32"
+ stroke-dasharray="2.32"
+ />
+ <path
+ id="evA4hI5dD266"
+ d="M9.863992,9.148254c.255929,1.023295.514316,2.056457.597908,2.390946"
+ fill="none"
+ stroke="#fff"
+ stroke-width="3.3"
+ stroke-linecap="round"
+ stroke-dashoffset="2.47"
+ stroke-dasharray="2.47"
+ />
+ <path
+ id="evA4hI5dD267"
+ d="M10.4619,11.5392c.2059.8244.9668,1.4172,1.816,1.4172c1.0186,0,1.872-.8534,1.872-1.872"
+ fill="none"
+ stroke="#fff"
+ stroke-width="3.3"
+ stroke-linecap="round"
+ stroke-dashoffset="5.42"
+ stroke-dasharray="5.42"
+ />
+ <path
+ id="evA4hI5dD268"
+ d="M14.1499,11.0844c0-2.36515,0-6.12835,0-6.12835"
+ fill="none"
+ stroke="#fff"
+ stroke-width="3.3"
+ stroke-linecap="round"
+ stroke-dashoffset="6.13"
+ stroke-dasharray="6.13"
+ />
+</svg>
diff --git a/packages/icons/src/__generated__/ai-loading.tsx b/packages/icons/src/__generated__/ai-loading.tsx
new file mode 100644
index 0000000000..4adcc4859b
--- /dev/null
+++ b/packages/icons/src/__generated__/ai-loading.tsx
@@ -0,0 +1,15 @@
+// Generated from icons/ai-loading.svg
+
+import { forwardRef } from "react";
+import type { IconProps } from "../types";
+
+// prettier-ignore
+export const AiLoadingIcon = forwardRef<SVGSVGElement, IconProps>(
+ ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
+ return (
+ <svg xmlns="http://www.w3.org/2000/svg" id="evA4hI5dD261" shapeRendering="geometricPrecision" textRendering="geometricPrecision" viewBox="0 0 17 17" width={size} height={size} fill={color} {...props} ref={forwardedRef}><style>{"@keyframes evA4hI5dD263_s_do{0%,to{stroke-dashoffset:6.2}17.5%,82.5%{stroke-dashoffset:-6.24}}@keyframes evA4hI5dD264_s_do{0%,10%,90%,to{stroke-dashoffset:6.8}22.5%,77.5%{stroke-dashoffset:-6.8}}@keyframes evA4hI5dD265_s_do{0%,17.5%,82.5%,to{stroke-dashoffset:2.32}27.5%,72.5%{stroke-dashoffset:-2.32}}@keyframes evA4hI5dD266_s_do{0%,22.5%,77.5%,to{stroke-dashoffset:2.47}32.5%,67.5%{stroke-dashoffset:-2.47}}@keyframes evA4hI5dD267_s_do{0%,27.5%,72.5%,to{stroke-dashoffset:5.42}40%,60%{stroke-dashoffset:-5.42}}@keyframes evA4hI5dD268_s_do{0%,32.5%,67.5%,to{stroke-dashoffset:6.13}50%{stroke-dashoffset:-6.1}}#evA4hI5dD263{animation:evA4hI5dD263_s_do 4000ms linear infinite normal forwards}#evA4hI5dD264{animation:evA4hI5dD264_s_do 4000ms linear infinite normal forwards}#evA4hI5dD265{animation:evA4hI5dD265_s_do 4000ms linear infinite normal forwards}#evA4hI5dD266{animation:evA4hI5dD266_s_do 4000ms linear infinite normal forwards}#evA4hI5dD267{animation:evA4hI5dD267_s_do 4000ms linear infinite normal forwards}#evA4hI5dD268{animation:evA4hI5dD268_s_do 4000ms linear infinite normal forwards}"}</style><path fill="none" stroke="rgba(255,255,255,0.4)" strokeDasharray="0" strokeLinecap="round" strokeWidth="2.2" d="m2.816 12.956 1.513-6.051a2.563 2.563 0 0 1 4.974 0l1.159 4.634a1.888 1.888 0 0 0 1.816 1.417 1.892 1.892 0 0 0 1.872-1.872V4.956" /><path id="evA4hI5dD263" fill="none" stroke="#fff" strokeDasharray="6.24" strokeDashoffset="6.2" strokeLinecap="round" strokeWidth="3.3" d="m2.816 12.956 1.513-6.051" /><path id="evA4hI5dD264" fill="none" stroke="#fff" strokeDasharray="6.8" strokeDashoffset="6.8" strokeLinecap="round" strokeWidth="3.3" d="M4.329 6.905a2.563 2.563 0 0 1 4.974 0" /><path id="evA4hI5dD265" fill="none" stroke="#fff" strokeDasharray="2.32" strokeDashoffset="2.32" strokeLinecap="round" strokeWidth="3.3" d="m9.303 6.905.561 2.243" /><path id="evA4hI5dD266" fill="none" stroke="#fff" strokeDasharray="2.47" strokeDashoffset="2.47" strokeLinecap="round" strokeWidth="3.3" d="m9.864 9.148.598 2.391" /><path id="evA4hI5dD267" fill="none" stroke="#fff" strokeDasharray="5.42" strokeDashoffset="5.42" strokeLinecap="round" strokeWidth="3.3" d="M10.462 11.54a1.888 1.888 0 0 0 1.816 1.416 1.892 1.892 0 0 0 1.872-1.872" /><path id="evA4hI5dD268" fill="none" stroke="#fff" strokeDasharray="6.13" strokeDashoffset="6.13" strokeLinecap="round" strokeWidth="3.3" d="M14.15 11.084V4.956" /></svg>
+ );
+ }
+);
+
+AiLoadingIcon.displayName = "AiLoadingIcon";
diff --git a/packages/icons/src/__generated__/index.ts b/packages/icons/src/__generated__/index.ts
index 31d5c5a89d..2d065f5ae5 100644
--- a/packages/icons/src/__generated__/index.ts
+++ b/packages/icons/src/__generated__/index.ts
@@ -17,6 +17,7 @@ export * from "./a-s-stretch";
export * from "./accordion-content";
export * from "./accordion-trigger";
export * from "./accordion";
+export * from "./ai-loading";
export * from "./ai";
export * from "./alert";
export * from "./arrow-down";
diff --git a/packages/icons/src/__generated__/svg/ai-loading.ts b/packages/icons/src/__generated__/svg/ai-loading.ts
new file mode 100644
index 0000000000..e4e0bd0441
--- /dev/null
+++ b/packages/icons/src/__generated__/svg/ai-loading.ts
@@ -0,0 +1 @@
+export const AiLoadingIcon = `<svg xmlns="http://www.w3.org/2000/svg" id="evA4hI5dD261" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 17 17" fill="currentColor" width="100%" height="100%" style="display: block;"><style>@keyframes evA4hI5dD263_s_do{0%,to{stroke-dashoffset:6.2}17.5%,82.5%{stroke-dashoffset:-6.24}}@keyframes evA4hI5dD264_s_do{0%,10%,90%,to{stroke-dashoffset:6.8}22.5%,77.5%{stroke-dashoffset:-6.8}}@keyframes evA4hI5dD265_s_do{0%,17.5%,82.5%,to{stroke-dashoffset:2.32}27.5%,72.5%{stroke-dashoffset:-2.32}}@keyframes evA4hI5dD266_s_do{0%,22.5%,77.5%,to{stroke-dashoffset:2.47}32.5%,67.5%{stroke-dashoffset:-2.47}}@keyframes evA4hI5dD267_s_do{0%,27.5%,72.5%,to{stroke-dashoffset:5.42}40%,60%{stroke-dashoffset:-5.42}}@keyframes evA4hI5dD268_s_do{0%,32.5%,67.5%,to{stroke-dashoffset:6.13}50%{stroke-dashoffset:-6.1}}#evA4hI5dD263{animation:evA4hI5dD263_s_do 4000ms linear infinite normal forwards}#evA4hI5dD264{animation:evA4hI5dD264_s_do 4000ms linear infinite normal forwards}#evA4hI5dD265{animation:evA4hI5dD265_s_do 4000ms linear infinite normal forwards}#evA4hI5dD266{animation:evA4hI5dD266_s_do 4000ms linear infinite normal forwards}#evA4hI5dD267{animation:evA4hI5dD267_s_do 4000ms linear infinite normal forwards}#evA4hI5dD268{animation:evA4hI5dD268_s_do 4000ms linear infinite normal forwards}</style><path fill="none" stroke="rgba(255,255,255,0.4)" stroke-dasharray="0" stroke-linecap="round" stroke-width="2.2" d="m2.816 12.956 1.513-6.051a2.563 2.563 0 0 1 4.974 0l1.159 4.634a1.888 1.888 0 0 0 1.816 1.417 1.892 1.892 0 0 0 1.872-1.872V4.956"/><path id="evA4hI5dD263" fill="none" stroke="#fff" stroke-dasharray="6.24" stroke-dashoffset="6.2" stroke-linecap="round" stroke-width="3.3" d="m2.816 12.956 1.513-6.051"/><path id="evA4hI5dD264" fill="none" stroke="#fff" stroke-dasharray="6.8" stroke-dashoffset="6.8" stroke-linecap="round" stroke-width="3.3" d="M4.329 6.905a2.563 2.563 0 0 1 4.974 0"/><path id="evA4hI5dD265" fill="none" stroke="#fff" stroke-dasharray="2.32" stroke-dashoffset="2.32" stroke-linecap="round" stroke-width="3.3" d="m9.303 6.905.561 2.243"/><path id="evA4hI5dD266" fill="none" stroke="#fff" stroke-dasharray="2.47" stroke-dashoffset="2.47" stroke-linecap="round" stroke-width="3.3" d="m9.864 9.148.598 2.391"/><path id="evA4hI5dD267" fill="none" stroke="#fff" stroke-dasharray="5.42" stroke-dashoffset="5.42" stroke-linecap="round" stroke-width="3.3" d="M10.462 11.54a1.888 1.888 0 0 0 1.816 1.416 1.892 1.892 0 0 0 1.872-1.872"/><path id="evA4hI5dD268" fill="none" stroke="#fff" stroke-dasharray="6.13" stroke-dashoffset="6.13" stroke-linecap="round" stroke-width="3.3" d="M14.15 11.084V4.956"/></svg>`;
diff --git a/packages/icons/src/__generated__/svg/index.ts b/packages/icons/src/__generated__/svg/index.ts
index 163a9cf240..9ac4b37e5c 100644
--- a/packages/icons/src/__generated__/svg/index.ts
+++ b/packages/icons/src/__generated__/svg/index.ts
@@ -17,6 +17,7 @@ export { ASStretchIcon } from "./a-s-stretch";
export { AccordionContentIcon } from "./accordion-content";
export { AccordionTriggerIcon } from "./accordion-trigger";
export { AccordionIcon } from "./accordion";
+export { AiLoadingIcon } from "./ai-loading";
export { AiIcon } from "./ai";
export { AlertIcon } from "./alert";
export { ArrowDownIcon } from "./arrow-down";