Skip to content
Open
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
1 change: 1 addition & 0 deletions chat2db-community-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"lint:eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --max-warnings=0",
"lint:style": "stylelint \"src/**/*.{css,less}\" --max-warnings=0",
"test:i18n": "node ./scripts/validate-i18n.cjs",
"test:i18n-window-controls": "tsx src/i18n/windowControls.test.ts",
"test:community-boundary": "node ./scripts/verify-community-boundary.cjs",
"test:retired-ai": "tsx src/blocks/AI/retiredAiSurface.test.ts && tsx src/blocks/AI/components/AIChatInput/mentionSelection.test.ts && tsx src/blocks/AI/knowledgeSelection.test.ts",
"test:hot-update": "tsx src/store/global/slices/hotUpdate/action.test.ts",
Expand Down
4 changes: 2 additions & 2 deletions chat2db-community-client/scripts/i18n-source-hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"es-ES": {
"ai.ts": "e7a2fcbfb3ed647bd14f63aca4b6c35c8fb402c49a6a1f36bb04f76f4e8415af",
"chat.ts": "f6c6ab9cbc5c1c828c35c75d83c4adca347ade590b5177e10d64fdd18cc8aef5",
"common.ts": "24aa2228702754bc019f1e21dd7be9f6d1c6ff02ed9bd9227ab319f331248b11",
"common.ts": "1a458636e5d506e16114374bb25f50c0134ce5a9eaed7795ebe8a0245f01c578",
"connection.ts": "d70578a3444978b60ea41c670e8b180849eaab297e33325db56c891e1058e899",
"dashboard.ts": "b99f5e6b81271573a8db1a585ac879724441b7163050899c3abaf9498217bd21",
"editTable.ts": "0f7a808f50053cd52b183d156bb4fd46bb125b8058f8774deb61c7f02894a350",
Expand All @@ -31,7 +31,7 @@
"ko-KR": {
"ai.ts": "e7a2fcbfb3ed647bd14f63aca4b6c35c8fb402c49a6a1f36bb04f76f4e8415af",
"chat.ts": "f6c6ab9cbc5c1c828c35c75d83c4adca347ade590b5177e10d64fdd18cc8aef5",
"common.ts": "24aa2228702754bc019f1e21dd7be9f6d1c6ff02ed9bd9227ab319f331248b11",
"common.ts": "1a458636e5d506e16114374bb25f50c0134ce5a9eaed7795ebe8a0245f01c578",
"connection.ts": "d70578a3444978b60ea41c670e8b180849eaab297e33325db56c891e1058e899",
"dashboard.ts": "b99f5e6b81271573a8db1a585ac879724441b7163050899c3abaf9498217bd21",
"editTable.ts": "0f7a808f50053cd52b183d156bb4fd46bb125b8058f8774deb61c7f02894a350",
Expand Down
4 changes: 4 additions & 0 deletions chat2db-community-client/src/i18n/en-US/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export default {
'common.menu.visitWebsite': 'Visit website',
'common.menu.viewDocs': 'View documentation',
'common.menu.viewChangelog': 'View changelog',
'common.window.minimize': 'Minimize',
'common.window.maximize': 'Maximize',
'common.window.restore': 'Restore',
'common.window.close': 'Close',
'common.text.saveConsole': 'Save console',
'common.text.textToSQL': 'Natural Language to SQL',
'common.text.editorRightClick': 'Right-Click of mouse',
Expand Down
4 changes: 4 additions & 0 deletions chat2db-community-client/src/i18n/es-ES/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export default {
'common.menu.visitWebsite': 'Visitar sitio web',
'common.menu.viewDocs': 'Ver documentación',
'common.menu.viewChangelog': 'Ver registro de cambios',
'common.window.minimize': 'Minimizar',
'common.window.maximize': 'Maximizar',
'common.window.restore': 'Restaurar',
'common.window.close': 'Cerrar',
'common.text.saveConsole': 'Guardar consola',
'common.text.textToSQL': 'Lenguaje natural a SQL',
'common.text.editorRightClick': 'Clic con el botón derecho',
Expand Down
4 changes: 4 additions & 0 deletions chat2db-community-client/src/i18n/ja-JP/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export default {
'common.menu.visitWebsite': '公式サイトを開く',
'common.menu.viewDocs': 'ドキュメントを表示',
'common.menu.viewChangelog': '変更履歴を表示',
'common.window.minimize': '最小化',
'common.window.maximize': '最大化',
'common.window.restore': '元に戻す',
'common.window.close': '閉じる',
'common.text.saveConsole': 'コンソールを保存',
'common.text.textToSQL': 'プレーンテキストをSQLに変換',
'common.text.editorRightClick': 'マウスの右ボタン',
Expand Down
4 changes: 4 additions & 0 deletions chat2db-community-client/src/i18n/ko-KR/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ export default {
'common.menu.visitWebsite': '웹사이트 방문',
'common.menu.viewDocs': '문서 보기',
'common.menu.viewChangelog': '변경 로그 보기',
'common.window.minimize': '최소화',
'common.window.maximize': '최대화',
'common.window.restore': '이전 크기로 복원',
'common.window.close': '닫기',
'common.text.saveConsole': '콘솔 저장',
'common.text.textToSQL': '자연어를 SQL로 변환',
'common.text.editorRightClick': '마우스 오른쪽 클릭',
Expand Down
37 changes: 37 additions & 0 deletions chat2db-community-client/src/i18n/windowControls.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import assert from 'node:assert/strict';

import enUS from './en-US/common';
import esES from './es-ES/common';
import jaJP from './ja-JP/common';
import koKR from './ko-KR/common';
import zhCN from './zh-CN/common';

const WINDOW_CONTROL_KEYS = [
'common.window.minimize',
'common.window.maximize',
'common.window.restore',
'common.window.close',
] as const;

const localeCommonModules: Record<string, Record<string, string>> = {
'en-US': enUS,
'zh-CN': zhCN,
'ja-JP': jaJP,
'ko-KR': koKR,
'es-ES': esES,
};

for (const [locale, common] of Object.entries(localeCommonModules)) {
for (const key of WINDOW_CONTROL_KEYS) {
const value = common[key];
assert.notEqual(
value,
undefined,
`${locale}/common.ts must define ${key} for the title bar window controls`,
);
assert.equal(typeof value, 'string', `${locale}/common.ts: ${key} must be a string`);
assert.ok(value!.trim().length > 0, `${locale}/common.ts: ${key} must not be empty`);
}
}

console.log('windowControls.test.ts: all locales define the window control keys');
4 changes: 4 additions & 0 deletions chat2db-community-client/src/i18n/zh-CN/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export default {
'common.menu.visitWebsite': '访问官网',
'common.menu.viewDocs': '查看文档',
'common.menu.viewChangelog': '查看更新日志',
'common.window.minimize': '最小化',
'common.window.maximize': '最大化',
'common.window.restore': '还原',
'common.window.close': '关闭',
'common.text.saveConsole': '保存控制台',
'common.text.textToSQL': '自然语言转SQL',
'common.text.editorRightClick': '鼠标右键',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useStyles } from './style';
import { Dropdown, type MenuProps } from 'antd';
import { refreshPage } from '@/utils';
import { history } from 'umi';
import i18n from '@/i18n';
import jcefApi from '@/jcef';
import { useGlobalStore } from '@/store/global';
import { isCommunityEnv, isDesktop } from '@/utils/env';
Expand Down Expand Up @@ -185,26 +186,26 @@ const AppBar = memo<AppBarProps>(({ className }) => {
<button
type="button"
className={styles.windowsAction}
aria-label="Minimize window"
title="Minimize"
aria-label={i18n('common.window.minimize')}
title={i18n('common.window.minimize')}
onClick={handleMinimizeWindow}
>
<Minus size={16} strokeWidth={1.75} />
</button>
<button
type="button"
className={styles.windowsAction}
aria-label={isMaximized ? 'Restore window' : 'Maximize window'}
title={isMaximized ? 'Restore' : 'Maximize'}
aria-label={isMaximized ? i18n('common.window.restore') : i18n('common.window.maximize')}
title={isMaximized ? i18n('common.window.restore') : i18n('common.window.maximize')}
onClick={handleToggleMaximizeWindow}
>
{isMaximized ? <Copy size={14} strokeWidth={1.75} /> : <Square size={13} strokeWidth={1.75} />}
</button>
<button
type="button"
className={cx(styles.windowsAction, styles.closeAction)}
aria-label="Close window"
title="Close"
aria-label={i18n('common.window.close')}
title={i18n('common.window.close')}
onClick={handleCloseWindow}
>
<X size={16} strokeWidth={1.75} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export const useStyles = createStyles(({ css, token }) => {
border-bottom: 1px solid ${token.colorBorderLayout};
user-select: none;
-webkit-app-region: drag;
z-index: 10001;
/* Stay above workspace content (max in-flow z-index is 100) but below the
antd popup layer (modals/masks render at z-index 1000), so window
controls cannot float above confirmation dialogs. Dropdown menus
opened from the bar are unaffected: they portal to document.body and
global.ts forces .ant-dropdown to z-index 11000. */
z-index: 999;
`,
windowsAppBar: css`
height: 34px;
Expand Down
Loading