chore: Splitting messages to support cloud messages (#19142)

This commit is contained in:
Ankita Kinger 2022-12-23 10:01:46 +05:30 committed by GitHub
parent cee50a4d3d
commit 725c28e3aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 60 additions and 16 deletions

View File

@ -1348,7 +1348,11 @@ export const CLEAN_URL_UPDATE = {
"Existing references to <strong>appsmith.URL.fullpath</strong> and <strong>appsmith.URL.pathname</strong> properties will behave differently.", "Existing references to <strong>appsmith.URL.fullpath</strong> and <strong>appsmith.URL.pathname</strong> properties will behave differently.",
}; };
export const MEMBERS_TAB_TITLE = (length: number) => `Users (${length})`; export const MEMBERS_TAB_TITLE = (
length: number,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
cloudHosting?: boolean,
) => `Users (${length})`;
export const CREATE_PAGE = () => "New Blank Page"; export const CREATE_PAGE = () => "New Blank Page";
export const CANVAS_NEW_PAGE_CARD = () => "Create New Page"; export const CANVAS_NEW_PAGE_CARD = () => "Create New Page";

View File

@ -40,6 +40,9 @@ import {
MEMBERS_TAB_TITLE, MEMBERS_TAB_TITLE,
NO_SEARCH_DATA_TEXT, NO_SEARCH_DATA_TEXT,
} from "@appsmith/constants/messages"; } from "@appsmith/constants/messages";
import { getAppsmithConfigs } from "@appsmith/configs";
const { cloudHosting } = getAppsmithConfigs();
export type PageProps = RouteComponentProps<{ export type PageProps = RouteComponentProps<{
workspaceId: string; workspaceId: string;
@ -327,7 +330,9 @@ export default function MemberSettings(props: PageProps) {
const columns = [ const columns = [
{ {
Header: createMessage(() => MEMBERS_TAB_TITLE(filteredData?.length)), Header: createMessage(() =>
MEMBERS_TAB_TITLE(filteredData?.length, cloudHosting),
),
accessor: "users", accessor: "users",
Cell: function UserCell(props: any) { Cell: function UserCell(props: any) {
const member = props.cell.row.original; const member = props.cell.row.original;

View File

@ -66,6 +66,8 @@ import { useHistory } from "react-router-dom";
import { Tooltip } from "@blueprintjs/core"; import { Tooltip } from "@blueprintjs/core";
import { isEllipsisActive } from "utils/helpers"; import { isEllipsisActive } from "utils/helpers";
const { cloudHosting, mailEnabled } = getAppsmithConfigs();
export const CommonTitleTextStyle = css` export const CommonTitleTextStyle = css`
color: ${Colors.CHARCOAL}; color: ${Colors.CHARCOAL};
font-weight: normal; font-weight: normal;
@ -262,7 +264,10 @@ const validateFormValues = (values: {
_users.forEach((user) => { _users.forEach((user) => {
if (!isEmail(user)) { if (!isEmail(user)) {
throw new SubmissionError({ throw new SubmissionError({
_error: createMessage(INVITE_USERS_VALIDATION_EMAIL_LIST), _error: createMessage(
INVITE_USERS_VALIDATION_EMAIL_LIST,
cloudHosting,
),
}); });
} }
}); });
@ -294,15 +299,16 @@ const validate = (values: any) => {
_users.forEach((user: string) => { _users.forEach((user: string) => {
if (!isEmail(user)) { if (!isEmail(user)) {
errors["users"] = createMessage(INVITE_USERS_VALIDATION_EMAIL_LIST); errors["users"] = createMessage(
INVITE_USERS_VALIDATION_EMAIL_LIST,
cloudHosting,
);
} }
}); });
} }
return errors; return errors;
}; };
export const { mailEnabled } = getAppsmithConfigs();
export const InviteButtonWidth = "88px"; export const InviteButtonWidth = "88px";
function WorkspaceInviteUsersForm(props: any) { function WorkspaceInviteUsersForm(props: any) {

View File

@ -39,6 +39,9 @@ import {
INVITE_USERS_MESSAGE, INVITE_USERS_MESSAGE,
INVITE_USERS_PLACEHOLDER, INVITE_USERS_PLACEHOLDER,
} from "@appsmith/constants/messages"; } from "@appsmith/constants/messages";
import { getAppsmithConfigs } from "@appsmith/configs";
const { cloudHosting } = getAppsmithConfigs();
/** /**
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
@ -134,8 +137,11 @@ export function AppViewerHeader(props: AppViewerHeaderProps) {
bgColor: "transparent", bgColor: "transparent",
}} }}
isOpen={showAppInviteUsersDialog} isOpen={showAppInviteUsersDialog}
message={createMessage(INVITE_USERS_MESSAGE)} message={createMessage(INVITE_USERS_MESSAGE, cloudHosting)}
placeholder={createMessage(INVITE_USERS_PLACEHOLDER)} placeholder={createMessage(
INVITE_USERS_PLACEHOLDER,
cloudHosting,
)}
title={currentApplicationDetails.name} title={currentApplicationDetails.name}
trigger={ trigger={
<Button <Button

View File

@ -19,7 +19,6 @@ import { getSelectedAppTheme } from "selectors/appThemingSelectors";
import BrandingBadge from "./BrandingBadgeMobile"; import BrandingBadge from "./BrandingBadgeMobile";
import { getAppViewHeaderHeight } from "selectors/appViewSelectors"; import { getAppViewHeaderHeight } from "selectors/appViewSelectors";
import { useOnClickOutside } from "utils/hooks/useOnClickOutside"; import { useOnClickOutside } from "utils/hooks/useOnClickOutside";
import { getAppsmithConfigs } from "@appsmith/configs";
import { useHref } from "pages/Editor/utils"; import { useHref } from "pages/Editor/utils";
import { APP_MODE } from "entities/App"; import { APP_MODE } from "entities/App";
import { builderURL, viewerURL } from "RouteBuilder"; import { builderURL, viewerURL } from "RouteBuilder";
@ -29,6 +28,9 @@ import {
INVITE_USERS_MESSAGE, INVITE_USERS_MESSAGE,
INVITE_USERS_PLACEHOLDER, INVITE_USERS_PLACEHOLDER,
} from "@appsmith/constants/messages"; } from "@appsmith/constants/messages";
import { getAppsmithConfigs } from "@appsmith/configs";
const { cloudHosting } = getAppsmithConfigs();
type AppViewerHeaderProps = { type AppViewerHeaderProps = {
isOpen?: boolean; isOpen?: boolean;
@ -117,8 +119,11 @@ export function PageMenu(props: AppViewerHeaderProps) {
bgColor: "transparent", bgColor: "transparent",
}} }}
isOpen={showAppInviteUsersDialog} isOpen={showAppInviteUsersDialog}
message={createMessage(INVITE_USERS_MESSAGE)} message={createMessage(INVITE_USERS_MESSAGE, cloudHosting)}
placeholder={createMessage(INVITE_USERS_PLACEHOLDER)} placeholder={createMessage(
INVITE_USERS_PLACEHOLDER,
cloudHosting,
)}
title={application.name} title={application.name}
trigger={ trigger={
<Button <Button

View File

@ -113,6 +113,9 @@ import {
PERMISSION_TYPE, PERMISSION_TYPE,
} from "@appsmith/utils/permissionHelpers"; } from "@appsmith/utils/permissionHelpers";
import { getTenantPermissions } from "@appsmith/selectors/tenantSelectors"; import { getTenantPermissions } from "@appsmith/selectors/tenantSelectors";
import { getAppsmithConfigs } from "@appsmith/configs";
const { cloudHosting } = getAppsmithConfigs();
const WorkspaceDropDown = styled.div<{ isMobile?: boolean }>` const WorkspaceDropDown = styled.div<{ isMobile?: boolean }>`
display: flex; display: flex;
@ -735,8 +738,14 @@ function ApplicationsSection(props: any) {
<FormDialogComponent <FormDialogComponent
Form={WorkspaceInviteUsersForm} Form={WorkspaceInviteUsersForm}
canOutsideClickClose canOutsideClickClose
message={createMessage(INVITE_USERS_MESSAGE)} message={createMessage(
placeholder={createMessage(INVITE_USERS_PLACEHOLDER)} INVITE_USERS_MESSAGE,
cloudHosting,
)}
placeholder={createMessage(
INVITE_USERS_PLACEHOLDER,
cloudHosting,
)}
title={`Invite Users to ${workspace.name}`} title={`Invite Users to ${workspace.name}`}
trigger={ trigger={
<Button <Button

View File

@ -89,6 +89,9 @@ import EndTour from "./GuidedTour/EndTour";
import { GUIDED_TOUR_STEPS } from "./GuidedTour/constants"; import { GUIDED_TOUR_STEPS } from "./GuidedTour/constants";
import { viewerURL } from "RouteBuilder"; import { viewerURL } from "RouteBuilder";
import { useHref } from "./utils"; import { useHref } from "./utils";
import { getAppsmithConfigs } from "@appsmith/configs";
const { cloudHosting } = getAppsmithConfigs();
const HeaderWrapper = styled.div` const HeaderWrapper = styled.div`
width: 100%; width: 100%;
@ -452,8 +455,11 @@ export function EditorHeader(props: EditorHeaderProps) {
bgColor: Colors.GEYSER_LIGHT, bgColor: Colors.GEYSER_LIGHT,
}} }}
isOpen={showAppInviteUsersDialog} isOpen={showAppInviteUsersDialog}
message={createMessage(INVITE_USERS_MESSAGE)} message={createMessage(INVITE_USERS_MESSAGE, cloudHosting)}
placeholder={createMessage(INVITE_USERS_PLACEHOLDER)} placeholder={createMessage(
INVITE_USERS_PLACEHOLDER,
cloudHosting,
)}
title={ title={
currentApplication currentApplication
? currentApplication.name ? currentApplication.name

View File

@ -30,6 +30,9 @@ import {
createMessage, createMessage,
INVITE_USERS_PLACEHOLDER, INVITE_USERS_PLACEHOLDER,
} from "@appsmith/constants/messages"; } from "@appsmith/constants/messages";
import { getAppsmithConfigs } from "@appsmith/configs";
const { cloudHosting } = getAppsmithConfigs();
const SentryRoute = Sentry.withSentryRouting(Route); const SentryRoute = Sentry.withSentryRouting(Route);
@ -216,7 +219,7 @@ export default function Settings() {
canOutsideClickClose canOutsideClickClose
isOpen={showModal} isOpen={showModal}
onClose={() => setShowModal(false)} onClose={() => setShowModal(false)}
placeholder={createMessage(INVITE_USERS_PLACEHOLDER)} placeholder={createMessage(INVITE_USERS_PLACEHOLDER, cloudHosting)}
title={`Invite Users to ${currentWorkspace?.name}`} title={`Invite Users to ${currentWorkspace?.name}`}
trigger trigger
workspaceId={workspaceId} workspaceId={workspaceId}