Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: display the current language directly at the top and do not disp… #579

Merged
merged 1 commit into from
Apr 28, 2024
Merged
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
4 changes: 4 additions & 0 deletions web/src/layouts/components/right-toolbar/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@
vertical-align: middle;
cursor: pointer;
}

.language {
cursor: pointer;
}
16 changes: 9 additions & 7 deletions web/src/layouts/components/right-toolbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ReactComponent as TranslationIcon } from '@/assets/svg/translation.svg';
import { useTranslate } from '@/hooks/commonHooks';
import { GithubOutlined } from '@ant-design/icons';
import { DownOutlined, GithubOutlined } from '@ant-design/icons';
import { Dropdown, MenuProps, Space } from 'antd';
import camelCase from 'lodash/camelCase';
import React from 'react';
import User from '../user';

import { LanguageList } from '@/constants/common';
import { useChangeLanguage } from '@/hooks/logicHooks';
import { useSelector } from 'umi';
import styled from './index.less';

const Circle = ({ children, ...restProps }: React.PropsWithChildren) => {
Expand All @@ -25,6 +25,7 @@ const handleGithubCLick = () => {
const RightToolBar = () => {
const { t } = useTranslate('common');
const changeLanguage = useChangeLanguage();
const { language = '' } = useSelector((state) => state.settingModel.userInfo);

const handleItemClick: MenuProps['onClick'] = ({ key }) => {
changeLanguage(key);
Expand All @@ -40,14 +41,15 @@ const RightToolBar = () => {
return (
<div className={styled.toolbarWrapper}>
<Space wrap size={16}>
<Dropdown menu={{ items, onClick: handleItemClick }} placement="bottom">
<Space className={styled.language}>
<b>{t(camelCase(language))}</b>
<DownOutlined />
</Space>
</Dropdown>
<Circle>
<GithubOutlined onClick={handleGithubCLick} />
</Circle>
<Dropdown menu={{ items, onClick: handleItemClick }} placement="bottom">
<Circle>
<TranslationIcon />
</Circle>
</Dropdown>
{/* <Circle>
<MonIcon />
</Circle> */}
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/chat/shared-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const useSendSharedMessage = (
async (message: string, id?: string) => {
const retcode = await completeConversation({
conversation_id: id ?? conversationId,
quote: false,
messages: [
...(conversation?.message ?? []).map((x: IMessage) => omit(x, 'id')),
{
Expand Down