Skip to content

Commit 83159aa

Browse files
authored
feat: open page settings when click on publish blockers (#5290)
Here improved publish dialog to open page settings when one of blockers is dynamic path or redirect. https://github.com/user-attachments/assets/816c8bb9-a357-4c86-ae8b-f2bf2a1b753e
1 parent e11137a commit 83159aa

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

apps/builder/app/builder/features/topbar/publish.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,18 @@ import {
5151
import {
5252
$authTokenPermissions,
5353
$dataSources,
54+
$editingPageId,
5455
$instances,
5556
$pages,
5657
$project,
5758
$propsIndex,
5859
$publishedOrigin,
5960
$userPlanFeatures,
6061
} from "~/shared/nano-states";
61-
import { $publishDialog } from "../../shared/nano-states";
62+
import {
63+
$publishDialog,
64+
setActiveSidebarPanel,
65+
} from "../../shared/nano-states";
6266
import { Domains, PENDING_TIMEOUT, getPublishStatusAndText } from "./domains";
6367
import { CollapsibleDomainSection } from "./collapsible-domain-section";
6468
import {
@@ -242,7 +246,8 @@ const $usedProFeatures = computed(
242246
(pages, dataSources, instances, propsIndex, styleObjectModel) => {
243247
const features = new Map<
244248
string,
245-
undefined | { awareness?: Awareness; info?: ReactNode }
249+
| undefined
250+
| { awareness?: Awareness; view?: "pageSettings"; info?: ReactNode }
246251
>();
247252
if (pages === undefined) {
248253
return features;
@@ -258,13 +263,13 @@ const $usedProFeatures = computed(
258263
instanceSelector: [page.rootInstanceId],
259264
};
260265
if (isPathnamePattern(page.path)) {
261-
features.set("Dynamic path", { awareness });
266+
features.set("Dynamic path", { awareness, view: "pageSettings" });
262267
}
263268
if (page.meta.status && page.meta.status !== `200`) {
264-
features.set("Page status code", { awareness });
269+
features.set("Page status code", { awareness, view: "pageSettings" });
265270
}
266271
if (page.meta.redirect && page.meta.redirect !== `""`) {
267-
features.set("Redirect", { awareness });
272+
features.set("Redirect", { awareness, view: "pageSettings" });
268273
}
269274
}
270275
// has resource variables
@@ -824,14 +829,20 @@ const UpgradeBanner = () => {
824829
<Text variant="regularBold">Following Pro features are used:</Text>
825830
<Text as="ul" color="destructive" css={{ paddingLeft: "1em" }}>
826831
{Array.from(usedProFeatures).map(
827-
([message, { awareness, info } = {}], index) => (
832+
([message, { awareness, view, info } = {}], index) => (
828833
<li key={index}>
829834
<Flex align="center" gap="1">
830835
{awareness ? (
831836
<button
832837
className={buttonLinkClass}
833838
type="button"
834-
onClick={() => $awareness.set(awareness)}
839+
onClick={() => {
840+
$awareness.set(awareness);
841+
if (view === "pageSettings") {
842+
setActiveSidebarPanel("pages");
843+
$editingPageId.set(awareness.pageId);
844+
}
845+
}}
835846
>
836847
{message}
837848
</button>

0 commit comments

Comments
 (0)