Skip to content

Commit 30c5bbc

Browse files
committed
static url open doc and analytics around open docs
1 parent b95329d commit 30c5bbc

File tree

4 files changed

+58
-12
lines changed

4 files changed

+58
-12
lines changed

app/client/src/ce/constants/messages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,7 @@ export const ERROR_IN_FETCHING_APP_SLUG_SUGGESTION = () =>
19491949
"Error in fetching app slug suggestion. Please try again.";
19501950
export const ERROR_IN_ENABLING_STATIC_URL = () =>
19511951
"Error in enabling static URL. Please try again.";
1952+
export const STATIC_URL_DOCS_LINK_TEXT = () => "Learn more in docs";
19521953

19531954
export const PAGE_SETTINGS_PAGE_SLUG_CHECKING_MESSAGE = () =>
19541955
"Checking availability...";

app/client/src/ce/utils/analyticsUtilTypes.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ export type EventName =
357357
| "REQUEST_INTEGRATION_CTA"
358358
| "REQUEST_INTEGRATION_SUBMITTED"
359359
| "TABLE_WIDGET_V2_HTML_CELL_USAGE"
360-
| PREMIUM_DATASOURCES_EVENTS;
360+
| PREMIUM_DATASOURCES_EVENTS
361+
| STATIC_URL_EVENTS;
361362

362363
type HOMEPAGE_CREATE_APP_FROM_TEMPLATE_EVENTS =
363364
| "TEMPLATE_DROPDOWN_CLICK"
@@ -480,3 +481,7 @@ export type PREMIUM_DATASOURCES_EVENTS =
480481
| "PREMIUM_MODAL_NOT_RELEVANT_SUBMIT"
481482
| "SOON_INTEGRATION_CTA"
482483
| "SOON_NOTIFY_REQUEST";
484+
485+
export type STATIC_URL_EVENTS =
486+
// User Actions (UI Layer)
487+
"STATIC_URL_DOCS_CLICK";

app/client/src/pages/AppIDE/components/AppSettings/components/GeneralSettings.tsx

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,31 @@ import {
2323
createMessage,
2424
STATIC_URL_CHANGE_SUCCESS,
2525
STATIC_URL_DISABLED_SUCCESS,
26+
STATIC_URL_DOCS_LINK_TEXT,
2627
} from "ee/constants/messages";
2728
import classNames from "classnames";
2829
import type { AppIconName } from "@appsmith/ads-old";
29-
import { Input, Switch, Text, Icon, Flex, Button, toast } from "@appsmith/ads";
30+
import {
31+
Input,
32+
Switch,
33+
Text,
34+
Icon,
35+
Flex,
36+
Button,
37+
toast,
38+
Tooltip,
39+
} from "@appsmith/ads";
3040
import { IconSelector } from "@appsmith/ads-old";
3141
import React, { useCallback, useMemo, useState } from "react";
3242
import { useEffect } from "react";
3343
import StaticURLConfirmationModal from "./StaticURLConfirmationModal";
3444
import { debounce } from "lodash";
3545
import { useDispatch, useSelector } from "react-redux";
46+
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
3647

3748
const APPLICATION_SLUG_REGEX = /^[a-z0-9-]+$/;
49+
const STATIC_URL_DOCS_URL =
50+
"https://docs.appsmith.com/build-apps/how-to-guides/configure-static-app-urls";
3851

3952
import {
4053
getCurrentApplication,
@@ -98,6 +111,8 @@ function GeneralSettings() {
98111
const appSlugSuggestion = useSelector(getAppSlugSuggestion);
99112
const isAppSlugSaving = useSelector(getIsPersistingAppSlug);
100113

114+
const staticUrlTooltipContent = createMessage(STATIC_URL_DOCS_LINK_TEXT);
115+
101116
const [applicationName, setApplicationName] = useState(application?.name);
102117
const [isAppNameValid, setIsAppNameValid] = useState(true);
103118
const [applicationIcon, setApplicationIcon] = useState(
@@ -194,6 +209,15 @@ function GeneralSettings() {
194209
}
195210
}, [application?.staticUrlSettings?.uniqueSlug, dispatch]);
196211

212+
const openStaticUrlDocs = useCallback(() => {
213+
AnalyticsUtil.logEvent("STATIC_URL_DOCS_CLICK", {
214+
source: "general_settings",
215+
applicationId,
216+
});
217+
218+
window.open(STATIC_URL_DOCS_URL, "_blank");
219+
}, [applicationId]);
220+
197221
const updateAppSettings = useCallback(
198222
debounce((icon?: AppIconName) => {
199223
const isAppNameUpdated = applicationName !== application?.name;
@@ -277,11 +301,14 @@ function GeneralSettings() {
277301
return `${application?.staticUrlSettings?.uniqueSlug || ""}/${pageSlug}`;
278302
}
279303
}, [
304+
currentAppPage?.uniqueSlug,
305+
currentAppPage?.slug,
306+
currentAppPage?.customSlug,
280307
modalType,
281308
application?.staticUrlSettings?.uniqueSlug,
282-
application?.slug,
283309
application?.staticUrlSettings?.enabled,
284-
currentAppPage,
310+
application?.slug,
311+
currentBasePageId,
285312
]);
286313

287314
const modalNewSlug = useMemo(() => {
@@ -367,12 +394,7 @@ function GeneralSettings() {
367394
}
368395

369396
return undefined;
370-
}, [
371-
isFetchingAppSlugSuggestion,
372-
applicationSlug,
373-
isClientSideSlugValid,
374-
isApplicationSlugValid,
375-
]);
397+
}, [isFetchingAppSlugSuggestion, applicationSlug, isClientSideSlugValid]);
376398

377399
const isApplicationSlugInputValid = useMemo(() => {
378400
if (isFetchingAppSlugSuggestion) return true;
@@ -455,7 +477,18 @@ function GeneralSettings() {
455477
isSelected={isStaticUrlToggleEnabled}
456478
onChange={handleStaticUrlToggle}
457479
>
458-
<Text kind="action-m">Static URL</Text>
480+
<Flex alignItems="center" gap="spaces-2">
481+
<Text kind="action-m">Static URL</Text>
482+
<Tooltip content={staticUrlTooltipContent}>
483+
<Button
484+
isIconButton
485+
kind="tertiary"
486+
onClick={openStaticUrlDocs}
487+
size="sm"
488+
startIcon="question-line"
489+
/>
490+
</Tooltip>
491+
</Flex>
459492
</Switch>
460493
</div>
461494
)}

app/client/src/pages/AppIDE/components/AppSettings/components/PageSettings.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,14 @@ function PageSettings(props: { page: Page }) {
278278

279279
setIsPageNameSaving(true);
280280
dispatch(updatePageAction(payload));
281-
}, [page.pageId, page.pageName, pageName, pageNameError]);
281+
}, [
282+
canManagePages,
283+
dispatch,
284+
page.pageId,
285+
page.pageName,
286+
pageName,
287+
pageNameError,
288+
]);
282289

283290
const saveCustomSlug = useCallback(() => {
284291
if (!canManagePages || page.customSlug === customSlug) return;

0 commit comments

Comments
 (0)