Ilya Oleshko
19e8b2210a
# Conflicts: # packages/client/src/helpers/constants.js # packages/client/src/pages/AccountsHome/Section/Filter/index.js # packages/client/src/pages/Home/InfoPanel/Body/sub-components/ItemTitle/AccountsItemTitle.js # packages/client/src/pages/Home/Section/AccountsBody/RowView/userContent.js # packages/client/src/pages/Home/Section/Header/index.js # packages/client/src/pages/Home/index.js # packages/client/src/pages/PortalSettings/categories/common/Customization/dns-settings.js # packages/client/src/pages/PortalSettings/categories/common/branding.js # packages/client/src/pages/PortalSettings/categories/security/access-portal/index.js # packages/client/src/store/FilesActionsStore.js # packages/common/components/Article/sub-components/article-payment-alert.js # packages/common/components/Section/index.js # packages/components/floating-button/styled-floating-button.js # packages/login/src/client/App.tsx # packages/login/src/client/components/Invalid/index.tsx # products/ASC.Files/Core/Core/FileStorageService.cs # products/ASC.Files/Core/Utils/FileConverter.cs # yarn.lock
85 lines
2.0 KiB
JavaScript
85 lines
2.0 KiB
JavaScript
import React from "react";
|
|
import { inject, observer } from "mobx-react";
|
|
import { useNavigate } from "react-router-dom";
|
|
import { useTranslation, Trans } from "react-i18next";
|
|
|
|
import { combineUrl } from "@docspace/common/utils";
|
|
|
|
import AlertComponent from "../../AlertComponent";
|
|
import Loaders from "../../Loaders";
|
|
|
|
const PROXY_BASE_URL = combineUrl(
|
|
window.DocSpaceConfig?.proxy?.url,
|
|
"/portal-settings"
|
|
);
|
|
|
|
const ArticlePaymentAlert = ({
|
|
isFreeTariff,
|
|
theme,
|
|
currentTariffPlanTitle,
|
|
toggleArticleOpen,
|
|
}) => {
|
|
const { t, ready } = useTranslation("Common");
|
|
|
|
const navigate = useNavigate();
|
|
|
|
const onClick = () => {
|
|
const paymentPageUrl = combineUrl(
|
|
PROXY_BASE_URL,
|
|
"/payments/portal-payments"
|
|
);
|
|
navigate(paymentPageUrl);
|
|
toggleArticleOpen();
|
|
};
|
|
|
|
const title = isFreeTariff ? (
|
|
<Trans t={t} i18nKey="FreeStartupPlan" ns="Common">
|
|
{{ planName: currentTariffPlanTitle }}
|
|
</Trans>
|
|
) : (
|
|
t("Common:LatePayment")
|
|
);
|
|
|
|
const description = isFreeTariff
|
|
? t("Common:GetMoreOptions")
|
|
: t("Common:PayBeforeTheEndGracePeriod");
|
|
|
|
const additionalDescription = isFreeTariff
|
|
? t("Common:ActivatePremiumFeatures")
|
|
: t("Common:GracePeriodActivated");
|
|
|
|
const color = isFreeTariff
|
|
? theme.catalog.paymentAlert.color
|
|
: theme.catalog.paymentAlert.warningColor;
|
|
|
|
const isShowLoader = !ready;
|
|
|
|
return isShowLoader ? (
|
|
<Loaders.Rectangle width="210px" height="88px" />
|
|
) : (
|
|
<AlertComponent
|
|
id="document_catalog-payment-alert"
|
|
borderColor={color}
|
|
titleColor={color}
|
|
onAlertClick={onClick}
|
|
title={title}
|
|
titleFontSize="11px"
|
|
description={description}
|
|
additionalDescription={additionalDescription}
|
|
needArrowIcon
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default inject(({ auth }) => {
|
|
const { currentQuotaStore, settingsStore } = auth;
|
|
const { currentTariffPlanTitle } = currentQuotaStore;
|
|
const { theme, toggleArticleOpen } = settingsStore;
|
|
|
|
return {
|
|
toggleArticleOpen,
|
|
theme,
|
|
currentTariffPlanTitle,
|
|
};
|
|
})(observer(ArticlePaymentAlert));
|