Login:Src:Components: add GreetingContainers
This commit is contained in:
parent
87cb2fe187
commit
caf5158c0e
@ -0,0 +1,73 @@
|
|||||||
|
// (c) Copyright Ascensio System SIA 2009-2024
|
||||||
|
//
|
||||||
|
// This program is a free software product.
|
||||||
|
// You can redistribute it and/or modify it under the terms
|
||||||
|
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||||
|
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||||
|
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||||
|
// any third-party rights.
|
||||||
|
//
|
||||||
|
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||||
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||||
|
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
//
|
||||||
|
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||||
|
//
|
||||||
|
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||||
|
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||||
|
//
|
||||||
|
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||||
|
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||||
|
// trademark law for use of our trademarks.
|
||||||
|
//
|
||||||
|
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||||
|
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||||
|
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
|
||||||
|
import { mobile, tablet } from "@docspace/shared/utils";
|
||||||
|
import styled from "styled-components";
|
||||||
|
|
||||||
|
const DESKTOP_WIDTH = 384;
|
||||||
|
const TABLET_WIDTH = 480;
|
||||||
|
|
||||||
|
export const GreetingContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: left;
|
||||||
|
height: 100%;
|
||||||
|
width: ${DESKTOP_WIDTH}px;
|
||||||
|
|
||||||
|
margin-bottom: 32px;
|
||||||
|
|
||||||
|
@media ${tablet} {
|
||||||
|
width: 100%;
|
||||||
|
max-width: ${TABLET_WIDTH}px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip {
|
||||||
|
p {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media ${mobile} {
|
||||||
|
padding: 0 25px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.portal-logo {
|
||||||
|
width: 100%;
|
||||||
|
padding-bottom: 16px;
|
||||||
|
height: 26.56px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.injected-svg {
|
||||||
|
height: 26.56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media ${mobile} {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
@ -0,0 +1,69 @@
|
|||||||
|
// (c) Copyright Ascensio System SIA 2009-2024
|
||||||
|
//
|
||||||
|
// This program is a free software product.
|
||||||
|
// You can redistribute it and/or modify it under the terms
|
||||||
|
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||||
|
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||||
|
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||||
|
// any third-party rights.
|
||||||
|
//
|
||||||
|
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||||
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||||
|
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
//
|
||||||
|
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||||
|
//
|
||||||
|
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||||
|
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||||
|
//
|
||||||
|
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||||
|
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||||
|
// trademark law for use of our trademarks.
|
||||||
|
//
|
||||||
|
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||||
|
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||||
|
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
|
||||||
|
/* eslint-disable @next/next/no-img-element */
|
||||||
|
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React, { useLayoutEffect, useState } from "react";
|
||||||
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
|
import { useTheme } from "styled-components";
|
||||||
|
|
||||||
|
import { Text } from "@docspace/shared/components/text";
|
||||||
|
import { PRODUCT_NAME } from "@docspace/shared/constants";
|
||||||
|
import { WhiteLabelLogoType } from "@docspace/shared/enums";
|
||||||
|
import { getLogoUrl } from "@docspace/shared/utils/common";
|
||||||
|
|
||||||
|
import { GreetingContainersProps, TConfirmLinkParams } from "@/types";
|
||||||
|
import { DEFAULT_PORTAL_TEXT, DEFAULT_ROOM_TEXT } from "@/utils/constants";
|
||||||
|
import { getInvitationLinkData } from "@/utils";
|
||||||
|
|
||||||
|
export const GreetingContainer = ({
|
||||||
|
greetingSettings,
|
||||||
|
welcomeTitle,
|
||||||
|
}: GreetingContainersProps) => {
|
||||||
|
const { t } = useTranslation(["Wizard, Login, Confirm"]);
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const logoUrl = getLogoUrl(WhiteLabelLogoType.LoginPage, !theme.isBase);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<img src={logoUrl} className="logo-wrapper" alt="greeting-logo" />
|
||||||
|
<Text
|
||||||
|
fontSize="23px"
|
||||||
|
fontWeight={700}
|
||||||
|
textAlign="center"
|
||||||
|
className="greeting-title"
|
||||||
|
>
|
||||||
|
{welcomeTitle
|
||||||
|
? t(`${welcomeTitle}`, { productName: PRODUCT_NAME })
|
||||||
|
: greetingSettings}
|
||||||
|
</Text>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
@ -0,0 +1,106 @@
|
|||||||
|
// (c) Copyright Ascensio System SIA 2009-2024
|
||||||
|
//
|
||||||
|
// This program is a free software product.
|
||||||
|
// You can redistribute it and/or modify it under the terms
|
||||||
|
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||||
|
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||||
|
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||||
|
// any third-party rights.
|
||||||
|
//
|
||||||
|
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||||
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||||
|
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
//
|
||||||
|
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||||
|
//
|
||||||
|
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||||
|
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||||
|
//
|
||||||
|
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||||
|
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||||
|
// trademark law for use of our trademarks.
|
||||||
|
//
|
||||||
|
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||||
|
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||||
|
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
|
||||||
|
/* eslint-disable @next/next/no-img-element */
|
||||||
|
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Text } from "@docspace/shared/components/text";
|
||||||
|
import { PRODUCT_NAME } from "@docspace/shared/constants";
|
||||||
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
|
import { useTheme } from "styled-components";
|
||||||
|
import { getLogoUrl } from "@docspace/shared/utils";
|
||||||
|
import { WhiteLabelLogoType } from "@docspace/shared/enums";
|
||||||
|
import { useContext, useEffect, useState } from "react";
|
||||||
|
import { ConfirmRouteContext } from "@/app/(root)/confirm/confirmRoute";
|
||||||
|
import { GreetingContainer } from "./GreetingCleateUserContainer.styled";
|
||||||
|
|
||||||
|
// remove
|
||||||
|
const DEFAULT_ROOM_TEXT =
|
||||||
|
"<strong>{{firstName}} {{lastName}}</strong> invites you to join the room <strong>{{roomName}}</strong> for secure document collaboration.";
|
||||||
|
const DEFAULT_PORTAL_TEXT =
|
||||||
|
"<strong>{{firstName}} {{lastName}}</strong> invites you to join the room <strong>{{roomName}}</strong> for secure document collaboration.";
|
||||||
|
|
||||||
|
export const GreetingCleateUserContainer = ({
|
||||||
|
type,
|
||||||
|
firstName,
|
||||||
|
lastName,
|
||||||
|
hostName,
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation(["Confirm", "Common"]);
|
||||||
|
const theme = useTheme();
|
||||||
|
const { roomData } = useContext(ConfirmRouteContext);
|
||||||
|
|
||||||
|
const logoUrl = getLogoUrl(WhiteLabelLogoType.LoginPage, !theme.isBase);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<GreetingContainer>
|
||||||
|
<img src={logoUrl} className="portal-logo" alt="greeting-logo" />
|
||||||
|
{type === "LinkInvite" && (
|
||||||
|
<div className="tooltip">
|
||||||
|
<Text fontSize="16px">
|
||||||
|
{roomData.title ? (
|
||||||
|
<Trans
|
||||||
|
t={t}
|
||||||
|
i18nKey="InvitationToRoom"
|
||||||
|
ns="Common"
|
||||||
|
defaults={DEFAULT_ROOM_TEXT}
|
||||||
|
values={{
|
||||||
|
firstName,
|
||||||
|
lastName,
|
||||||
|
...(roomData.title
|
||||||
|
? { roomName: roomData.title }
|
||||||
|
: { spaceAddress: hostName }),
|
||||||
|
}}
|
||||||
|
components={{
|
||||||
|
1: <Text fontWeight={600} as="strong" fontSize="16px" />,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Trans
|
||||||
|
t={t}
|
||||||
|
i18nKey="InvitationToPortal"
|
||||||
|
ns="Common"
|
||||||
|
defaults={DEFAULT_PORTAL_TEXT}
|
||||||
|
values={{
|
||||||
|
firstName,
|
||||||
|
lastName,
|
||||||
|
productName: PRODUCT_NAME,
|
||||||
|
...(roomData.title
|
||||||
|
? { roomName: roomData.title }
|
||||||
|
: { spaceAddress: hostName }),
|
||||||
|
}}
|
||||||
|
components={{
|
||||||
|
1: <Text fontWeight={600} as="strong" fontSize="16px" />,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</GreetingContainer>
|
||||||
|
);
|
||||||
|
};
|
@ -0,0 +1,116 @@
|
|||||||
|
// (c) Copyright Ascensio System SIA 2009-2024
|
||||||
|
//
|
||||||
|
// This program is a free software product.
|
||||||
|
// You can redistribute it and/or modify it under the terms
|
||||||
|
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||||
|
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||||
|
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||||
|
// any third-party rights.
|
||||||
|
//
|
||||||
|
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||||
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||||
|
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
//
|
||||||
|
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||||
|
//
|
||||||
|
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||||
|
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||||
|
//
|
||||||
|
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||||
|
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||||
|
// trademark law for use of our trademarks.
|
||||||
|
//
|
||||||
|
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||||
|
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||||
|
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
|
||||||
|
/* eslint-disable @next/next/no-img-element */
|
||||||
|
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React, { useLayoutEffect, useState } from "react";
|
||||||
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
|
import { useTheme } from "styled-components";
|
||||||
|
|
||||||
|
import { Text } from "@docspace/shared/components/text";
|
||||||
|
import { PRODUCT_NAME } from "@docspace/shared/constants";
|
||||||
|
import { WhiteLabelLogoType } from "@docspace/shared/enums";
|
||||||
|
import { getLogoUrl } from "@docspace/shared/utils/common";
|
||||||
|
|
||||||
|
import { GreetingContainersProps, TConfirmLinkParams } from "@/types";
|
||||||
|
import { DEFAULT_PORTAL_TEXT, DEFAULT_ROOM_TEXT } from "@/utils/constants";
|
||||||
|
import { getInvitationLinkData } from "@/utils";
|
||||||
|
|
||||||
|
export const GreetingLoginContainer = ({
|
||||||
|
greetingSettings,
|
||||||
|
}: GreetingContainersProps) => {
|
||||||
|
const { t } = useTranslation(["Login", "Wizard"]);
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const logoUrl = getLogoUrl(WhiteLabelLogoType.LoginPage, !theme.isBase);
|
||||||
|
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const [invitationLinkData, setInvitationLinkData] = useState({
|
||||||
|
email: "",
|
||||||
|
roomName: "",
|
||||||
|
firstName: "",
|
||||||
|
lastName: "",
|
||||||
|
type: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
if (!searchParams) return;
|
||||||
|
|
||||||
|
const encodeString = searchParams.get("loginData");
|
||||||
|
if (!encodeString) return;
|
||||||
|
|
||||||
|
const queryParams = getInvitationLinkData(encodeString);
|
||||||
|
if (!queryParams) return;
|
||||||
|
|
||||||
|
setInvitationLinkData(queryParams);
|
||||||
|
}, [searchParams]);
|
||||||
|
|
||||||
|
const { type, roomName, firstName, lastName } = invitationLinkData;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<img src={logoUrl} className="logo-wrapper" alt="greeting-logo" />
|
||||||
|
{type !== "invitation" && (
|
||||||
|
<Text
|
||||||
|
fontSize="23px"
|
||||||
|
fontWeight={700}
|
||||||
|
textAlign="center"
|
||||||
|
className="greeting-title"
|
||||||
|
>
|
||||||
|
{greetingSettings}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{type === "invitation" && (
|
||||||
|
<div className="greeting-container">
|
||||||
|
<Text fontSize="16px">
|
||||||
|
<Trans
|
||||||
|
t={t}
|
||||||
|
i18nKey={roomName ? "InvitationToRoom" : "InvitationToPortal"}
|
||||||
|
ns="Common"
|
||||||
|
defaults={roomName ? DEFAULT_ROOM_TEXT : DEFAULT_PORTAL_TEXT}
|
||||||
|
values={{
|
||||||
|
firstName,
|
||||||
|
lastName,
|
||||||
|
productName: PRODUCT_NAME,
|
||||||
|
...(roomName
|
||||||
|
? { roomName }
|
||||||
|
: { spaceAddress: window.location.host }),
|
||||||
|
}}
|
||||||
|
components={{
|
||||||
|
1: <Text fontWeight={600} as="strong" fontSize="16px" />,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
29
packages/login/src/components/GreetingContainer/index.tsx
Normal file
29
packages/login/src/components/GreetingContainer/index.tsx
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// (c) Copyright Ascensio System SIA 2009-2024
|
||||||
|
//
|
||||||
|
// This program is a free software product.
|
||||||
|
// You can redistribute it and/or modify it under the terms
|
||||||
|
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||||
|
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||||
|
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||||
|
// any third-party rights.
|
||||||
|
//
|
||||||
|
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||||
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||||
|
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
//
|
||||||
|
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||||
|
//
|
||||||
|
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||||
|
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||||
|
//
|
||||||
|
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||||
|
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||||
|
// trademark law for use of our trademarks.
|
||||||
|
//
|
||||||
|
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||||
|
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||||
|
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
|
||||||
|
export { GreetingCleateUserContainer } from "./GreetingCreateUserContainer";
|
||||||
|
export { GreetingLoginContainer } from "./GreetingLoginContainer";
|
||||||
|
export { GreetingContainer } from "./GreetingContainer";
|
Loading…
Reference in New Issue
Block a user