Merge pull request #583 from ONLYOFFICE/feature/logohandler-culture-param

Shared:Utils:Common: pass culture to handler logo url
This commit is contained in:
Alexey Safronov 2024-08-12 18:21:08 +04:00 committed by GitHub
commit 3462ea7708
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 29 additions and 7 deletions

View File

@ -35,6 +35,7 @@ import SimpleNav from "@/components/SimpleNav";
import { LoginContent, LoginFormWrapper } from "@/components/Login";
import GreetingContainer from "@/components/GreetingContainer";
import { getColorTheme, getSettings } from "@/utils/actions";
import { cookies } from "next/headers";
const LanguageComboboxWrapper = dynamic(
() => import("@/components/LanguageCombobox"),
@ -59,9 +60,12 @@ export default async function Layout({
const isRegisterContainerVisible = objectSettings?.enabledJoin;
const culture =
cookies().get("asc_language")?.value ?? objectSettings?.culture;
return (
<div style={{ width: "100%", height: "100%" }}>
<SimpleNav />
<SimpleNav culture={culture} />
<LoginFormWrapper id="login-page" bgPattern={bgPattern}>
<div className="bg-cover" />
<Scrollbar id="customScrollBar">
@ -73,6 +77,7 @@ export default async function Layout({
>
<GreetingContainer
greetingSettings={objectSettings?.greetingSettings}
culture={culture}
/>
<FormWrapper id="login-form">{children}</FormWrapper>
</ColorTheme>

View File

@ -40,11 +40,19 @@ import { GreetingContainersProps } from "@/types";
import { DEFAULT_PORTAL_TEXT, DEFAULT_ROOM_TEXT } from "@/utils/constants";
import { getInvitationLinkData } from "@/utils";
const GreetingContainer = ({ greetingSettings }: GreetingContainersProps) => {
const GreetingContainer = ({
greetingSettings,
culture,
}: GreetingContainersProps) => {
const { t } = useTranslation(["Login"]);
const theme = useTheme();
const logoUrl = getLogoUrl(WhiteLabelLogoType.LoginPage, !theme.isBase);
const logoUrl = getLogoUrl(
WhiteLabelLogoType.LoginPage,
!theme.isBase,
false,
culture,
);
const searchParams = useSearchParams();

View File

@ -61,14 +61,21 @@ const StyledSimpleNav = styled.div`
StyledSimpleNav.defaultProps = { theme: Base };
interface SimpleNavProps {}
interface SimpleNavProps {
culture?: string;
}
const SimpleNav = ({}: SimpleNavProps) => {
const SimpleNav = ({ culture }: SimpleNavProps) => {
const theme = useTheme();
const isDark = !theme.isBase;
const logoUrl = getLogoUrl(WhiteLabelLogoType.LightSmall, isDark);
const logoUrl = getLogoUrl(
WhiteLabelLogoType.LightSmall,
isDark,
false,
culture,
);
return (
<StyledSimpleNav id="login-header">

View File

@ -43,6 +43,7 @@ export type TDataContext = {
export type GreetingContainersProps = {
greetingSettings?: string;
culture?: string;
};
export type LoginProps = {

View File

@ -1103,8 +1103,9 @@ export function getLogoUrl(
logoType: WhiteLabelLogoType,
dark: boolean = false,
def: boolean = false,
culture?: string,
) {
return `/logo.ashx?logotype=${logoType}&dark=${dark}&default=${def}`;
return `/logo.ashx?logotype=${logoType}&dark=${dark}&default=${def}${culture ? `&culture=${culture}` : ""}`;
}
export const getUserTypeName = (