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.

Add animated loading icon on publish button (#1778)

Ivan Starkov747facc5457a
diff --git a/apps/builder/app/builder/features/topbar/domains.tsx b/apps/builder/app/builder/features/topbar/domains.tsx
index bc09274957..778d5b46b1 100644
--- a/apps/builder/app/builder/features/topbar/domains.tsx
+++ b/apps/builder/app/builder/features/topbar/domains.tsx
@@ -571,6 +571,7 @@ const DomainItem = (props: {
handleUpdateStatus();
}}
+ isPublishing={props.isPublishing}
/>
</Grid>
</CollapsibleDomainSection>
diff --git a/apps/builder/app/builder/features/topbar/entri.tsx b/apps/builder/app/builder/features/topbar/entri.tsx
index a6873be80c..3b499567e9 100644
--- a/apps/builder/app/builder/features/topbar/entri.tsx
+++ b/apps/builder/app/builder/features/topbar/entri.tsx
@@ -10,10 +10,12 @@ export const Entri = ({
dnsRecords,
domain,
onClose,
+ isPublishing,
}: {
dnsRecords: DnsRecord[];
domain: string;
onClose: (detail: EntriCloseDetail) => void;
+ isPublishing: boolean;
}) => {
entriGlobalStyles();
const { error, isOpen, showDialog } = useEntri({
@@ -27,7 +29,7 @@ export const Entri = ({
{error !== undefined && <Text color="destructive">{error}</Text>}
<Button
- disabled={isOpen}
+ disabled={isOpen || isPublishing}
color="neutral"
css={{ width: "100%", flexShrink: 0 }}
onClick={() => {
diff --git a/apps/builder/app/builder/features/topbar/publish.tsx b/apps/builder/app/builder/features/topbar/publish.tsx
index 30c0609151..ca035633ea 100644
--- a/apps/builder/app/builder/features/topbar/publish.tsx
+++ b/apps/builder/app/builder/features/topbar/publish.tsx
@@ -270,6 +270,8 @@ const Publish = ({
}
}, [isPublishing, refresh]);
+ const isPublishInProgress = publishState !== "idle" || isPublishing;
+
return (
<Flex
css={{
@@ -292,14 +294,12 @@ const Publish = ({
<Tooltip
content={
- publishState !== "idle" || isPublishing
- ? "Publish process in progress"
- : undefined
+ isPublishInProgress ? "Publish process in progress" : undefined
}
>
<Button
color="positive"
- disabled={publishState !== "idle" || isPublishing}
+ state={isPublishInProgress ? "pending" : undefined}
onClick={() => {
setIsPublishing(true);
@@ -323,6 +323,20 @@ const Publish = ({
);
};
+const ErrorText = ({ children }: { children: string }) => (
+ <Flex
+ css={{
+ m: theme.spacing[9],
+ overflowWrap: "anywhere",
+ }}
+ gap={2}
+ direction={"column"}
+ >
+ <Text color="destructive">{children}</Text>
+ <Text color="subtle">Please try again later</Text>
+ </Flex>
+);
+
const Content = (props: { projectId: Project["id"] }) => {
const [newDomains, setNewDomains] = useState(new Set<string>());
const {
@@ -386,17 +400,7 @@ const Content = (props: { projectId: Project["id"] }) => {
<>
<ScrollArea>
{projectSystemError !== undefined && (
- <Flex
- css={{
- m: theme.spacing[9],
- overflowWrap: "anywhere",
- }}
- gap={2}
- direction={"column"}
- >
- <Text color="destructive">{projectSystemError}</Text>
- <Text color="subtle">Please try again later</Text>
- </Flex>
+ <ErrorText>{projectSystemError}</ErrorText>
)}
{projectData?.success && (
@@ -408,10 +412,6 @@ const Content = (props: { projectId: Project["id"] }) => {
/>
)}
- {domainSystemError !== undefined && (
- <Text color="destructive">{domainSystemError}</Text>
- )}
-
{domainsResult?.success === true && (
<Domains
newDomains={newDomains}
@@ -421,15 +421,13 @@ const Content = (props: { projectId: Project["id"] }) => {
isPublishing={isPublishing}
/>
)}
+
+ {domainSystemError !== undefined && (
+ <ErrorText>{domainSystemError}</ErrorText>
+ )}
+
{domainsResult?.success === false && (
- <Label
- css={{
- overflowWrap: "anywhere",
- color: theme.colors.foregroundDestructive,
- }}
- >
- <div>{domainsResult.error}</div>
- </Label>
+ <ErrorText>{domainsResult.error}</ErrorText>
)}
</ScrollArea>
diff --git a/packages/icons/package.json b/packages/icons/package.json
index b030d48f45..8f4e1ad6f7 100644
--- a/packages/icons/package.json
+++ b/packages/icons/package.json
@@ -8,8 +8,8 @@
"scripts": {
"dev": "build-package --watch",
"build": "build-package",
- "dts": "tsc --project tsconfig.dts.json",
- "generate": "rm -fr src/__generated__ && NODE_OPTIONS='--loader=tsx' svgo-jsx svgo-jsx.config.ts && tsx svg-string.ts && pnpm prettier --write ./ ",
+ "dts": "tsc --declarationDir lib/types",
+ "generate": "rm -fr src/__generated__ && NODE_OPTIONS='--loader=tsx' svgo-jsx svgo-jsx.config.ts && tsx svg-string.ts && prettier --write ./",
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
"lint": "eslint ./src --ext .ts,.tsx --max-warnings 0",
"checks": "pnpm typecheck && pnpm lint",