Skip to content

Commit a8906c7

Browse files
authored
Merge pull request #90 from running-elephant/dev
Dev
2 parents 772d305 + d89700c commit a8906c7

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

frontend/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@
211211
"webpackbar": "5.0.2"
212212
},
213213
"resolutions": {
214-
"react-error-overlay": "6.0.9"
214+
"react-error-overlay": "6.0.9",
215+
"@types/react": "17.0.38",
216+
"@types/react-dom": "17.0.11"
215217
},
216218
"config": {
217219
"commitizen": {

frontend/src/app/pages/DashBoardPage/pages/Board/slice/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ const boardSlice = createSlice({
210210
action: PayloadAction<{ boardId: string; wh: [number, number] }>,
211211
) {
212212
const { boardId, wh } = action.payload;
213-
state.boardInfoRecord[boardId].boardWidthHeight = wh;
213+
let boardInfo = state.boardInfoRecord?.[boardId];
214+
if (boardInfo) {
215+
state.boardInfoRecord[boardId].boardWidthHeight = wh;
216+
}
214217
},
215218
changeBoardPublish(
216219
state,

frontend/src/app/pages/DashBoardPage/utils/board.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export const isElView = el => {
220220
// bottom 元素底部端到可见区域顶端的距离
221221
var viewHeight = window.innerHeight || document.documentElement.clientHeight; // 浏览器可见区域高度。
222222

223-
if (top < viewHeight && bottom > 0) {
223+
if (top <= viewHeight && bottom >= 0) {
224224
bool = true;
225225
} else if (top >= viewHeight || bottom <= 0) {
226226
bool = false;

frontend/src/app/pages/MainPage/pages/VizPage/Main/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { EmptyFiller, TabPane, Tabs } from 'app/components';
33
import useI18NPrefix from 'app/hooks/useI18NPrefix';
44
import BoardEditor from 'app/pages/DashBoardPage/pages/BoardEditor';
55
import { selectOrgId } from 'app/pages/MainPage/slice/selectors';
6+
import { dispatchResize } from 'app/utils/dispatchResize';
67
import { useCallback, useEffect } from 'react';
78
import { useDispatch, useSelector } from 'react-redux';
89
import {
@@ -120,6 +121,9 @@ export function Main({ sliderVisible }: { sliderVisible: boolean }) {
120121
`/organizations/${orgId}/vizs/${activeKey}${activeTab.search || ''}`,
121122
);
122123
}
124+
setTimeout(() => {
125+
dispatchResize();
126+
}, 500);
123127
},
124128
[history, orgId, tabs],
125129
);

frontend/src/locales/i18n.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@ export const translationsJson = {
2424
convertLanguageJsonToObject(en);
2525

2626
export const changeLang = lang => {
27-
i18next.changeLanguage(lang);
28-
requestInstance.defaults.headers['Accept-Language'] =
29-
lang === 'zh' ? 'zh-CN' : 'en-US'; // FIXME locale
3027
localStorage.setItem(StorageKeys.Locale, lang);
31-
moment.locale(lang === 'zh' ? 'zh-cn' : 'en-us'); // FIXME locale
3228
window.location && window.location.reload();
3329
};
3430

3531
const initialLocale = getInitialLocale();
36-
moment.locale(initialLocale);
32+
requestInstance.defaults.headers['Accept-Language'] =
33+
initialLocale === 'zh' ? 'zh-CN' : 'en-US'; // FIXME locale
34+
moment.locale(initialLocale === 'zh' ? 'zh-cn' : 'en-us'); // FIXME locale
3735

3836
export const i18n = i18next
3937
// pass the i18n instance to react-i18next.

0 commit comments

Comments
 (0)