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.",
};
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 CANVAS_NEW_PAGE_CARD = () => "Create New Page";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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