Skip to content

Commit b317b62

Browse files
authored
Fix errors when importing common packages (#432)
* fix: temporarily comment out error codes in Feeds * fix: update esbuild and fix tailwind build command * fix: temporarily change the target of ReactModal.setAppElement * fix: commented out translation & navigation function and fix typo of color variables * fix: language switch icon size * fix: move i18n config from packages folder to each microfrontend * fix: recover sign in modal
1 parent d04f3c6 commit b317b62

36 files changed

+6361
-5971
lines changed

apps/campus/src/bus/Bus.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,10 @@ const Bus = (): JSX.Element => {
321321

322322
const { t, i18n } = useTranslation()
323323
useEffect(() => {
324-
i18n.changeLanguage(localStorage.getItem("wasedatime-lng"))
324+
// i18n.changeLanguage(localStorage.getItem("wasedatime-lng"))
325325
}, [])
326326

327-
const lng = i18n.language
327+
const lng = i18n.language || "en"
328328
const { wasedaStatus, nishiStatus } = getBusStatuses(date, lng, t)
329329
const wasedaStatusComponent = createStatusComponent(wasedaStatus, t)
330330
const nishiStatusComponent = createStatusComponent(nishiStatus, t)

apps/campus/src/root.component.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
import React, { Suspense, useContext, useEffect } from "react"
2-
import { Lang, LoadingSpinner, i18nConfig } from "wasedatime-ui"
3-
import i18next from "i18next"
2+
import { LoadingSpinner } from "wasedatime-ui"
43
import { useTranslation } from "react-i18next"
54
import { BrowserRouter, Routes, Route } from "react-router-dom"
65

76
import App from "@app/App"
8-
import translationEN from "@app/constants/locales/en/translation.json"
9-
import translationJA from "@app/constants/locales/ja/translation.json"
7+
import "@app/utils/i18n"
108
import { ThemeContext, ThemeProvider } from "@app/utils/theme-context"
119

12-
i18nConfig({
13-
i18n: i18next,
14-
customTranslations: {
15-
[Lang.EN]: translationEN,
16-
[Lang.JA]: translationJA,
17-
},
18-
})
19-
2010
const LoadingSpinnerContainer = () => {
2111
const { theme } = useContext(ThemeContext)
2212

apps/campus/src/utils/i18n.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { initReactI18next } from "react-i18next"
2+
import i18next from "i18next"
3+
import { getCoreTranslation, getI18nLanguageDetector, getI18nHttpBackend, Lang } from "wasedatime-ui"
4+
import translationEN from "@app/constants/locales/en/translation.json"
5+
import translationJA from "@app/constants/locales/ja/translation.json"
6+
7+
const resources = {
8+
[Lang.EN]: {
9+
translation: { ...getCoreTranslation(Lang.EN), ...translationEN },
10+
},
11+
[Lang.JA]: {
12+
translation: { ...getCoreTranslation(Lang.JA), ...translationJA },
13+
},
14+
}
15+
16+
const detectorOptions = {
17+
order: ["localStorage"],
18+
lookupLocalStorage: "wasedatime-lng",
19+
caches: ["localStorage"],
20+
}
21+
22+
i18next
23+
.use(getI18nHttpBackend())
24+
.use(getI18nLanguageDetector())
25+
.use(initReactI18next) // passes i18n down to react-i18next
26+
.init({
27+
resources,
28+
fallbackLng: Lang.EN,
29+
keySeparator: ".",
30+
interpolation: {
31+
// react already safes from xss
32+
escapeValue: false,
33+
},
34+
// Configure the withNamespaces / NamespacesConsumer to
35+
// not render the content until needed namespaces are loaded.
36+
// react: {
37+
// wait: true,
38+
// },
39+
detection: detectorOptions,
40+
})

apps/campus/src/wasedatime-campus.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
import React from "react"
2-
3-
import { Lang, i18nConfig } from "wasedatime-ui"
4-
import i18next from "i18next"
52
import ReactDOM from "react-dom"
63
import singleSpaReact from "single-spa-react"
7-
8-
import translationEN from "@app/constants/locales/en/translation.json"
9-
import translationJA from "@app/constants/locales/ja/translation.json"
104
import Root from "@app/root.component"
115

12-
i18nConfig({
13-
i18n: i18next,
14-
customTranslations: {
15-
[Lang.EN]: translationEN,
16-
[Lang.JA]: translationJA,
17-
},
18-
})
19-
206
const lifecycles = singleSpaReact({
217
React,
228
ReactDOM,

apps/feeds/components/FeedLink.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ const FeedLink = ({ name, feed, locale }: Props) => {
113113
</p>
114114
</CardContent>
115115
</div>
116-
<Hidden xsDown>
116+
{/* <Hidden xsDown> */}
117117
<CardMedia
118118
sx={{
119119
width: 200,
120120
}}
121121
image={cover}
122122
title="Feed Cover Image"
123123
/>
124-
</Hidden>
124+
{/* </Hidden> */}
125125
</Card>
126126
</Link>
127127
</CardActionArea>

apps/feeds/pages copy/_app.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ import "../styles/globals.css"
22
import "../styles/feed.css"
33
import type { AppProps } from "next/app"
44
import { useEffect } from "react"
5+
import type { NextComponentType } from "next";
56

6-
function MyApp({ Component, pageProps }: AppProps) {
7-
useEffect(() => {
8-
// Remove the server-side injected CSS.
9-
const jssStyles = document.querySelector("#jss-server-side")
10-
if (jssStyles) {
11-
jssStyles.parentElement?.removeChild(jssStyles)
12-
}
13-
}, [])
7+
// function MyApp({ Component, pageProps }: AppProps) {
8+
// useEffect(() => {
9+
// // Remove the server-side injected CSS.
10+
// const jssStyles = document.querySelector("#jss-server-side")
11+
// if (jssStyles) {
12+
// jssStyles.parentElement?.removeChild(jssStyles)
13+
// }
14+
// }, [])
1415

15-
return <Component {...pageProps} />
16-
}
17-
export default MyApp
16+
// return <Component {...pageProps} />
17+
// }
18+
// export default MyApp

apps/feeds/pages copy/_document.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export default class CustomDocument extends Document {
1414
const sheets = new ServerStyleSheets()
1515
const originalRenderPage = ctx.renderPage
1616

17-
ctx.renderPage = () =>
18-
originalRenderPage({
19-
enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
20-
})
17+
// ctx.renderPage = () =>
18+
// originalRenderPage({
19+
// enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
20+
// })
2121

2222
const initialProps = await Document.getInitialProps(ctx)
2323
return {

apps/root/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\"",
1616
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
1717
"local": "concurrently --kill-others \"pnpm start\" \"cd ../syllabus && pnpm start\" \"cd ../campus && pnpm start\" \"cd ../career && pnpm start\" \"cd ../blog && pnpm start\"",
18-
"tailwind:build": "pnpx tailwind build -i ./src/styles/styles.css -o ./src/styles/tailwind-build-output.css"
18+
"tailwind:build": "pnpx tailwindcss build -i ./src/styles/styles.css -o ./src/styles/tailwind-build-output.css"
1919
},
2020
"devDependencies": {
2121
"@babel/core": "7.18.2",
@@ -35,9 +35,9 @@
3535
"concurrently": "7.2.1",
3636
"cssnano": "5.1.11",
3737
"dotenv": "16.0.1",
38+
"esbuild": "^0.18.6",
3839
"eslint": "8.17.0",
3940
"eslint-config-custom": "workspace:*",
40-
"i18next": "21.8.9",
4141
"postcss": "8.4.14",
4242
"prettier": "2.6.2",
4343
"prettier-plugin-tailwindcss": "^0.2.8",
@@ -72,15 +72,15 @@
7272
"@types/styled-components": "5.1.25",
7373
"daisyui": "2.15.2",
7474
"history": "5.3.0",
75-
"i18next": "21.8.9",
75+
"i18next": "23.2.3",
7676
"localforage": "1.10.0",
7777
"lodash": "4.17.21",
7878
"react": "17.0.2",
7979
"react-dom": "17.0.2",
8080
"react-error-boundary": "3.1.4",
8181
"react-ga": "3.3.0",
8282
"react-helmet": "6.1.0",
83-
"react-i18next": "11.17.0",
83+
"react-i18next": "13.0.1",
8484
"react-responsive": "9.0.0-beta.10",
8585
"react-router-dom": "6.3.0",
8686
"react-vertical-timeline-component": "3.5.2",

0 commit comments

Comments
 (0)