Missed remaining 'homepages' imports

This is a follow-up for #1016

Still doesn't affect anything at the moment, but this reduce the amount of work needed when we yank out the homepages from our bundle later.
This commit is contained in:
infinite-persistence 2022-03-04 10:05:11 +08:00
parent 8772ebe0ad
commit 76493d48ee
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
4 changed files with 3 additions and 6 deletions

View file

@ -10,8 +10,6 @@ import HomepageSelector from 'component/homepageSelector';
import SettingLanguage from 'component/settingLanguage';
import SettingsRow from 'component/settingsRow';
import ThemeSelector from 'component/themeSelector';
// $FlowFixMe
import homepages from 'homepages';
type Props = {
clock24h: boolean,
@ -28,6 +26,7 @@ export default function SettingAppearance(props: Props) {
location: { hash },
} = useHistory();
const highlightSearchInLanguage = hash === `#${SEARCH_IN_LANGUAGE}`;
const homepages = window.homepages || {};
return (
<>

View file

@ -9,8 +9,6 @@ import { FormField } from 'component/common/form';
import HomepageSelector from 'component/homepageSelector';
import SettingLanguage from 'component/settingLanguage';
import SettingsRow from 'component/settingsRow';
// $FlowFixMe
import homepages from 'homepages';
type Props = {
searchInLanguage: boolean,
@ -19,6 +17,7 @@ type Props = {
export default function SettingUnauthenticated(props: Props) {
const { searchInLanguage, setSearchInLanguage } = props;
const homepages = window.homepages || {};
return (
<Card

View file

@ -313,7 +313,6 @@ export function doFetchHomepages() {
// @if USE_LOCAL_HOMEPAGE_DATA='true'
const homepages = require('homepages');
if (homepages) {
console.log('doing homepages');
window.homepages = homepages;
return;
}

View file

@ -1,4 +1,3 @@
import homepages from 'homepages';
import SUPPORTED_BROWSER_LANGUAGES from 'constants/supported_browser_languages';
const DEFAULT_LANG = 'en';
@ -24,6 +23,7 @@ export const getDefaultLanguage = () => {
// If homepages has a key "zh-Hant" return that, otherwise return "zh", otherwise "en"
export const getDefaultHomepageKey = () => {
const language = getDefaultLanguage();
const homepages = window.homepages || {};
return (homepages[language] && language) || (homepages[language.slice(0, 2)] && language.slice(0, 2)) || DEFAULT_LANG;
};