Web: Client: wait ready translations

This commit is contained in:
Viktor Fomin 2022-05-26 18:13:20 +03:00
parent 437808b6bd
commit 4bb7ee25e8
2 changed files with 19 additions and 20 deletions

View File

@ -238,7 +238,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
});
}, [socketHelper]);
const { t } = useTranslation(["Common", "SmartBanner"]);
const { t, ready } = useTranslation(["Common", "SmartBanner"]);
let snackTimer = null;
let fbInterval = null;
@ -522,7 +522,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
<Layout>
<Router history={history}>
<>
{isDocuments ? <ReactSmartBanner t={t} /> : <></>}
{isDocuments ? <ReactSmartBanner t={t} ready={ready} /> : <></>}
{isEditor ? <></> : <NavMenu />}
<ScrollToTop />
<Main isDesktop={isDesktop}>

View File

@ -9,7 +9,7 @@ const Wrapper = styled.div`
`;
const ReactSmartBanner = (props) => {
const { t } = props;
const { t, ready } = props;
const [isVisible, setIsVisible] = useState(true);
const force = isIOS ? "ios" : "android";
@ -55,23 +55,22 @@ const ReactSmartBanner = (props) => {
kindle: "kindle-fire-app",
};
return (
isMobile &&
isVisible && (
<Wrapper>
<SmartBanner
title={t("SmartBanner:AppName")}
author="Ascensio System SIA"
button={t("Common:View")}
force={force}
onClose={hideBanner}
onInstall={hideBanner}
storeText={storeText}
price={priceText}
appMeta={appMeta}
/>
</Wrapper>
)
return isMobile && isVisible && ready ? (
<Wrapper>
<SmartBanner
title={t("SmartBanner:AppName")}
author="Ascensio System SIA"
button={t("Common:View")}
force={force}
onClose={hideBanner}
onInstall={hideBanner}
storeText={storeText}
price={priceText}
appMeta={appMeta}
/>
</Wrapper>
) : (
<></>
);
};