feat: 删除中英文切换

This commit is contained in:
cp3hnu 2025-04-03 09:31:24 +08:00
parent b4e1e31e31
commit b59de032a0
11 changed files with 6740 additions and 6541 deletions

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
v18.20.7

View File

@ -7,7 +7,7 @@ import { Route, BrowserRouter as Router, Switch, useHistory } from 'react-router
import { observer } from 'mobx-react-lite';
import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration';
import Cookie from 'js-cookie';
// import Cookie from 'js-cookie';
import { trackPageView } from '@app/utils/stat';
import { I18nProvider, getI18n, useI18n } from '@vesoft-inc/i18n';
import { INTL_LOCALES } from '@app/config/constants';
@ -26,10 +26,10 @@ message.config({ maxCount: 1 });
const Login = lazy(() => import('@app/pages/Login'));
const MainPage = lazy(() => import('@app/pages/MainPage'));
const defaultLanguage = Cookie.get('lang') || document.documentElement.getAttribute('lang');
const defaultLanguage = 'ZH_CN'; // Cookie.get('lang') || document.documentElement.getAttribute('lang');
const { initI18n } = getI18n();
initI18n(defaultLanguage, INTL_LOCALES);
dayjs.locale(defaultLanguage === 'EN_US' ? 'en' : 'zh-cn');
dayjs.locale('zh-cn');
const PageRoot = observer(() => {
const {
global: { version },

View File

@ -16,7 +16,7 @@ const LanguageSelect: React.FC = () => {
onChange={updateI18n}
optionLabelProp="label"
>
{Object.keys(INTL_LOCALE_SELECT).map(locale => (
{Object.keys(INTL_LOCALE_SELECT).map((locale) => (
<Option
className={styles.dark}
key={locale}

View File

@ -6,7 +6,7 @@ import { observer } from 'mobx-react-lite';
import { trackPageView } from '@app/utils/stat';
import { useStore } from '@app/stores';
import nebulaLogo from '@app/static/images/nebula_logo.png';
import LanguageSelect from './LanguageSelect';
// import LanguageSelect from './LanguageSelect';
import styles from './index.module.less';
const FormItem = Form.Item;
@ -42,7 +42,11 @@ const LoginPage: React.FC = () => {
<FormItem noStyle>
<span className={styles.formTitle}>{intl.get('configServer.title')}</span>
</FormItem>
<Button type="link" className={styles.loginTip} onClick={() => window.open(intl.get('link.loginHref'), '_blank')}>
<Button
type="link"
className={styles.loginTip}
onClick={() => window.open(intl.get('link.loginHref'), '_blank')}
>
{intl.get('configServer.tip')}
</Button>
<Row>
@ -77,7 +81,7 @@ const LoginPage: React.FC = () => {
<span className={styles.version}>
{intl.get('common.version')}v{version}
</span>
<LanguageSelect />
{/* <LanguageSelect /> */}
</div>
</div>
</div>

View File

@ -2,11 +2,13 @@
.helpMenu {
background-color: @headerBlack;
&:global(.ant-menu-dark.ant-menu-submenu>.ant-menu) {
&:global(.ant-menu-dark.ant-menu-submenu > .ant-menu) {
background-color: #2f3a4a;
}
:global {
.ant-menu-submenu, .ant-menu-item, .ant-menu-title-content {
.ant-menu-submenu,
.ant-menu-item,
.ant-menu-title-content {
display: flex;
align-items: center;
}
@ -22,9 +24,13 @@
width: 24px;
height: 24px;
}
.gitlinkIcon {
width: 24px;
height: 24px;
}
}
.accountMenu {
&:global(.ant-menu-dark.ant-menu-submenu>.ant-menu) {
&:global(.ant-menu-dark.ant-menu-submenu > .ant-menu) {
background-color: #2f3a4a;
}
:global(.ant-menu-title-content) {
@ -43,7 +49,7 @@
}
}
.langMenu {
&:global(.ant-menu-dark.ant-menu-submenu>.ant-menu) {
&:global(.ant-menu-dark.ant-menu-submenu > .ant-menu) {
background-color: #2f3a4a;
}
& :global {
@ -51,4 +57,4 @@
color: #fff;
}
}
}
}

View File

@ -4,15 +4,16 @@ import Icon from '@app/components/Icon';
import { Link } from 'react-router-dom';
import Avatar from '@app/components/Avatar';
import { useI18n } from '@vesoft-inc/i18n';
import { INTL_LOCALE_SELECT } from '@app/config';
// import { INTL_LOCALE_SELECT } from '@app/config';
import { observer } from 'mobx-react-lite';
import { useStore } from '@app/stores';
import styles from './index.module.less';
import gitlinkImg from '@app/static/images/gitlink.png';
const HelpMenu = () => {
const { currentLocale, updateI18n, intl } = useI18n();
const { currentLocale, /*updateI18n,*/ intl } = useI18n();
const {
global: { username, logout, version },
global: { username, logout },
} = useStore();
const items = useMemo(
() => [
@ -21,112 +22,113 @@ const HelpMenu = () => {
label: (
<a
className={styles.nebulaLink}
href="https://github.com/vesoft-inc/nebula"
href="https://gitlink.org.cn/ci4s/knowlegegraph-studio"
target="_blank"
data-track-category="navigation"
data-track-action="star_nebula"
data-track-label="from_navigation"
rel="noreferrer"
>
<Icon className={styles.navIcon} type="icon-studio-nav-github" />
{/* <Icon className={styles.navIcon} type="icon-studio-nav-github" /> */}
<img src={gitlinkImg} className={styles.gitlinkIcon} />
</a>
),
},
{
key: 'language',
label: <Icon className={styles.navIcon} type="icon-studio-nav-language" />,
popupClassName: styles.langMenu,
popupOffset: [-66, 20],
children: Object.keys(INTL_LOCALE_SELECT).map((locale) => ({
key: `language-${locale}`,
onClick: () => updateI18n(INTL_LOCALE_SELECT[locale].NAME),
label: INTL_LOCALE_SELECT[locale].TEXT,
})),
},
{
key: 'welcome',
label: (
<Link className={styles.nebulaLink} to="/welcome">
<Icon className={styles.navIcon} type="icon-studio-nav-help" />
</Link>
),
},
{
key: 'feedbackEntrance',
popupClassName: styles.accountMenu,
popupOffset: [0, 20],
label: <Icon className={styles.navIcon} type="icon-navbar-feedback" />,
children: [
{
key: 'feedback',
label: (
<a
className={styles.nebulaLink}
href={intl.get('link.feedback')}
target="_blank"
rel="noreferrer"
data-track-category="navigation"
data-track-action="feedback"
data-track-label="from_navigation"
>
<Icon className={styles.menuIcon} type="icon-navbar-troubleFeedback" />
{intl.get('menu.feedback')}
</a>
),
},
{
key: 'repo',
label: (
<a
className={styles.nebulaLink}
href="https://github.com/vesoft-inc/nebula-studio"
target="_blank"
rel="noreferrer"
data-track-category="navigation"
data-track-action="repo"
data-track-label="from_navigation"
>
<Icon className={styles.menuIcon} type="icon-studio-nav-github" />
{intl.get('menu.repo')}
</a>
),
},
{
key: 'trial',
label: (
<a
className={styles.nebulaLink}
href={intl.get('link.trial')}
target="_blank"
rel="noreferrer"
data-track-category="navigation"
data-track-action="trial"
data-track-label="from_navigation"
>
<Icon className={styles.menuIcon} type="icon-navbar-enterprise" />
{intl.get('menu.trial')}
</a>
),
},
{
key: 'contact',
label: (
<a
className={styles.nebulaLink}
href={intl.get('link.contact')}
target="_blank"
rel="noreferrer"
data-track-category="navigation"
data-track-action="contact"
data-track-label="from_navigation"
>
<Icon className={styles.menuIcon} type="icon-navbar-contactUs" />
{intl.get('menu.contact')}
</a>
),
},
],
},
// {
// key: 'language',
// label: <Icon className={styles.navIcon} type="icon-studio-nav-language" />,
// popupClassName: styles.langMenu,
// popupOffset: [-66, 20],
// children: Object.keys(INTL_LOCALE_SELECT).map((locale) => ({
// key: `language-${locale}`,
// onClick: () => updateI18n(INTL_LOCALE_SELECT[locale].NAME),
// label: INTL_LOCALE_SELECT[locale].TEXT,
// })),
// },
// {
// key: 'welcome',
// label: (
// <Link className={styles.nebulaLink} to="/welcome">
// <Icon className={styles.navIcon} type="icon-studio-nav-help" />
// </Link>
// ),
// },
// {
// key: 'feedbackEntrance',
// popupClassName: styles.accountMenu,
// popupOffset: [0, 20],
// label: <Icon className={styles.navIcon} type="icon-navbar-feedback" />,
// children: [
// {
// key: 'feedback',
// label: (
// <a
// className={styles.nebulaLink}
// href={intl.get('link.feedback')}
// target="_blank"
// rel="noreferrer"
// data-track-category="navigation"
// data-track-action="feedback"
// data-track-label="from_navigation"
// >
// <Icon className={styles.menuIcon} type="icon-navbar-troubleFeedback" />
// {intl.get('menu.feedback')}
// </a>
// ),
// },
// {
// key: 'repo',
// label: (
// <a
// className={styles.nebulaLink}
// href="https://github.com/vesoft-inc/nebula-studio"
// target="_blank"
// rel="noreferrer"
// data-track-category="navigation"
// data-track-action="repo"
// data-track-label="from_navigation"
// >
// <Icon className={styles.menuIcon} type="icon-studio-nav-github" />
// {intl.get('menu.repo')}
// </a>
// ),
// },
// {
// key: 'trial',
// label: (
// <a
// className={styles.nebulaLink}
// href={intl.get('link.trial')}
// target="_blank"
// rel="noreferrer"
// data-track-category="navigation"
// data-track-action="trial"
// data-track-label="from_navigation"
// >
// <Icon className={styles.menuIcon} type="icon-navbar-enterprise" />
// {intl.get('menu.trial')}
// </a>
// ),
// },
// {
// key: 'contact',
// label: (
// <a
// className={styles.nebulaLink}
// href={intl.get('link.contact')}
// target="_blank"
// rel="noreferrer"
// data-track-category="navigation"
// data-track-action="contact"
// data-track-label="from_navigation"
// >
// <Icon className={styles.menuIcon} type="icon-navbar-contactUs" />
// {intl.get('menu.contact')}
// </a>
// ),
// },
// ],
// },
{
key: 'setting',
label: (
@ -145,22 +147,22 @@ const HelpMenu = () => {
</div>
),
children: [
{
key: 'version-log',
label: (
<a
className={styles.nebulaLink}
data-track-category="navigation"
data-track-action="view_changelog"
href={intl.get('link.versionLogHref')}
target="_blank"
rel="noreferrer"
>
<Icon className={styles.menuIcon} type="icon-studio-nav-version" />
{intl.get('menu.release')}
</a>
),
},
// {
// key: 'version-log',
// label: (
// <a
// className={styles.nebulaLink}
// data-track-category="navigation"
// data-track-action="view_changelog"
// href={intl.get('link.versionLogHref')}
// target="_blank"
// rel="noreferrer"
// >
// <Icon className={styles.menuIcon} type="icon-studio-nav-version" />
// {intl.get('menu.release')}
// </a>
// ),
// },
{
key: 'user-logout',
label: (
@ -170,10 +172,10 @@ const HelpMenu = () => {
</span>
),
},
{
key: 'version',
label: `v${version}`,
},
// {
// key: 'version',
// label: `v${version}`,
// },
],
},
],

View File

@ -7,7 +7,7 @@ import { useStore } from '@app/stores';
import { trackEvent } from '@app/utils/stat';
import { useForm } from 'antd/lib/form/Form';
import { post } from '@app/utils/http';
import LanguageSelect from '../Login/LanguageSelect';
// import LanguageSelect from '../Login/LanguageSelect';
import styles from './index.module.less';
const Setting = observer(() => {
@ -54,14 +54,14 @@ const Setting = observer(() => {
<div className={styles.settingPage}>
<div className={styles.pageTitle}>{intl.get('setting.globalSetting')}</div>
<div className={styles.pageContent}>
<Row className={styles.settingItem}>
{/* <Row className={styles.settingItem}>
<Col className={styles.title} style={{ alignItems: 'center' }}>
{intl.get('common.language')}
</Col>
<Col>
<LanguageSelect />
</Col>
</Row>
</Row> */}
<Row className={styles.settingItem}>
<Col className={styles.title} style={{ display: 'flex', flexDirection: 'column' }}>
<span style={{ marginBottom: '20px' }}>{intl.get('setting.betaFunction')}</span>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="EN_US">
<html lang="ZH_CN">
<head>
<meta charset="UTF-8">

12993
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,8 @@ import { getAppConfig } from './build/config';
import pkg from './package.json';
const appConfig = getAppConfig();
const proxyHost = '127.0.0.1:9000';
// const proxyHost = '172.20.32.88:17001';
const proxyHost = '172.20.32.197:32701';
const htmlPlugin = (data?: Record<string, unknown>): Plugin => {
let viteConfig = undefined as unknown as ResolvedConfig;