Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): update language setting in extension based on client setting #99

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/src/components/pages/extensions/sharedProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "@marketplace/index.css";

export default function SharedProviders({
theme,
// lang,
lang,
mulengawilfred marked this conversation as resolved.
Show resolved Hide resolved
accessToken,
children,
}: {
Expand All @@ -26,7 +26,7 @@ export default function SharedProviders({
theme={{
algorithm: theme === "dark" ? ProviderTheme.darkAlgorithm : ProviderTheme.defaultAlgorithm,
}}>
<I18nProvider>
<I18nProvider extensionSetLang={lang}>
<GqlProvider accessToken={accessToken}>
<ThemeProvider theme={theme}>{children}</ThemeProvider>
</GqlProvider>
Expand Down
11 changes: 9 additions & 2 deletions web/src/i18n/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ const getBrowserLanguage = () => {
}
};

export default function Provider({ children }: { children?: ReactNode }) {
export default function Provider({
extensionSetLang,
children,
}: {
extensionSetLang?: string;
children?: ReactNode;
}) {
const { isAuthenticated } = useAuth();
const [currentLang, setLang] = useCurrentLang();

Expand All @@ -26,7 +32,8 @@ export default function Provider({ children }: { children?: ReactNode }) {
},
skip: !isAuthenticated,
});
const locale = data?.me.lang ?? currentLang;

const locale = extensionSetLang ? extensionSetLang : data?.me.lang ?? currentLang;

useEffect(() => {
const lang = locale === "und" ? getBrowserLanguage() : locale;
Expand Down
62 changes: 30 additions & 32 deletions web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,34 @@ p {
margin: 0;
}

.homepage-tabs {
.ant-tabs-ink-bar {
height: 5px;
color: #ffffff;
}

.ant-tabs .ant-tabs-tab {
color: rgba(255, 255, 255, 0.8);
font-size: 16px !important;
line-height: 22px;
font-weight: 500;
}

.ant-tabs .ant-tabs-ink-bar {
background: #ffffff !important;
}

.ant-tabs-tab:hover {
color: #ffffff !important;
}

.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
color: #ffffff !important;
}

.ant-tabs-nav::before {
border-bottom: none !important;
}

.ant-tabs-nav {
margin-bottom: 2px !important;
}
.homepage-tabs .ant-tabs-ink-bar {
height: 5px;
color: #ffffff;
}

.homepage-tabs .ant-tabs .ant-tabs-tab {
color: rgba(255, 255, 255, 0.8);
font-size: 16px !important;
line-height: 22px;
font-weight: 500;
}

.homepage-tabs .ant-tabs .ant-tabs-ink-bar {
background: #ffffff !important;
}

.homepage-tabs .ant-tabs-tab:hover {
color: #ffffff !important;
}

.homepage-tabs .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
color: #ffffff !important;
}

.homepage-tabs .ant-tabs-nav::before {
border-bottom: none !important;
}

.homepage-tabs .ant-tabs-nav {
margin-bottom: 2px !important;
}
Loading