Web: Renamed function.
This commit is contained in:
parent
85e51fd9b2
commit
3c11ddfb3b
@ -36,7 +36,7 @@ import { LanguageCombobox } from "@docspace/shared/components/language-combobox"
|
||||
import { setCookie } from "@docspace/shared/utils/cookie";
|
||||
import { COOKIE_EXPIRATION_YEAR, LANGUAGE } from "@docspace/shared/constants";
|
||||
import i18n from "../../../i18n";
|
||||
import { setLanguageWithoutReload } from "@docspace/shared/utils/common";
|
||||
import { setLanguageForUnauthorized } from "@docspace/shared/utils/common";
|
||||
|
||||
const Header = styled.header`
|
||||
align-items: left;
|
||||
@ -101,7 +101,7 @@ const HeaderUnAuth = ({
|
||||
|
||||
const onSelect = (culture) => {
|
||||
const { key } = culture;
|
||||
setLanguageWithoutReload(key, i18n);
|
||||
setLanguageForUnauthorized(key, i18n);
|
||||
};
|
||||
|
||||
return (
|
||||
@ -129,6 +129,7 @@ const HeaderUnAuth = ({
|
||||
cultures={cultures}
|
||||
selectedCulture={currentCultureName}
|
||||
withBorder={false}
|
||||
isMobileView
|
||||
/>
|
||||
</Header>
|
||||
);
|
||||
|
@ -47,6 +47,10 @@ export const StyledPage = styled.div`
|
||||
width: 100%;
|
||||
padding: ${({ theme }) =>
|
||||
getCorrectFourValuesStyle("32px 8px 0 16px", theme.interfaceDirection)};
|
||||
|
||||
.language-combo-box {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
|
@ -49,7 +49,7 @@ import {
|
||||
createPasswordHash,
|
||||
getOAuthToken,
|
||||
getLoginLink,
|
||||
setLanguageWithoutReload,
|
||||
setLanguageForUnauthorized,
|
||||
} from "@docspace/shared/utils/common";
|
||||
import { login } from "@docspace/shared/utils/loginUtils";
|
||||
import {
|
||||
@ -72,7 +72,6 @@ import {
|
||||
import GreetingUserContainer from "./GreetingUserContainer";
|
||||
import withCultureNames from "SRC_DIR/HOCs/withCultureNames";
|
||||
import { isMobile } from "@docspace/shared/utils";
|
||||
import { ComboBox } from "@docspace/shared/components/combobox";
|
||||
import { LanguageCombobox } from "@docspace/shared/components/language-combobox";
|
||||
import { setCookie } from "@docspace/shared/utils/cookie";
|
||||
|
||||
@ -481,20 +480,18 @@ const CreateUserForm = (props) => {
|
||||
const onSelect = (culture) => {
|
||||
const { key } = culture;
|
||||
|
||||
setLanguageWithoutReload(key, i18n);
|
||||
setLanguageForUnauthorized(key, i18n);
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledPage>
|
||||
{!isMobile() && (
|
||||
<LanguageCombobox
|
||||
<LanguageCombobox
|
||||
className="language-combo-box"
|
||||
onSelectLanguage={onSelect}
|
||||
cultures={cultures}
|
||||
selectedCulture={currentCultureName}
|
||||
withBorder={false}
|
||||
/>
|
||||
)}
|
||||
onSelectLanguage={onSelect}
|
||||
cultures={cultures}
|
||||
selectedCulture={currentCultureName}
|
||||
withBorder={false}
|
||||
/>
|
||||
|
||||
<StyledCreateUserContent>
|
||||
<GreetingContainer>
|
||||
|
@ -24,7 +24,7 @@
|
||||
// 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 { setLanguageWithoutReload } from "@docspace/shared/utils/common";
|
||||
import { setLanguageForUnauthorized } from "@docspace/shared/utils/common";
|
||||
import { LanguageCombobox } from "@docspace/shared/components/language-combobox";
|
||||
import useDeviceType from "@/hooks/useDeviceType";
|
||||
import { DeviceType } from "@docspace/shared/enums";
|
||||
@ -42,7 +42,7 @@ const LanguageComboboxWrapper = (props: TLanguageCombobox) => {
|
||||
const onLanguageSelect = (culture: { key: string }) => {
|
||||
const { key } = culture;
|
||||
|
||||
setLanguageWithoutReload(key, i18n);
|
||||
setLanguageForUnauthorized(key, i18n);
|
||||
};
|
||||
|
||||
const { currentDeviceType } = useDeviceType();
|
||||
|
@ -1083,9 +1083,7 @@ export function getLogoUrl(
|
||||
return `/logo.ashx?logotype=${logoType}&dark=${dark}&default=${def}`;
|
||||
}
|
||||
|
||||
export function setLanguageWithoutReload(culture: string, i18n: TI18n) {
|
||||
i18n.changeLanguage(culture);
|
||||
|
||||
export function setLanguageForUnauthorized(culture: string) {
|
||||
setCookie(LANGUAGE, culture, {
|
||||
"max-age": COOKIE_EXPIRATION_YEAR,
|
||||
});
|
||||
@ -1098,4 +1096,6 @@ export function setLanguageWithoutReload(culture: string, i18n: TI18n) {
|
||||
|
||||
window.history.pushState("", "", newUrl);
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user