Skip to content

Commit

Permalink
🐛 fix: Fix route
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Sep 9, 2023
1 parent db34a83 commit 2d1e8d6
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 44 deletions.
4 changes: 2 additions & 2 deletions locales/en_US/common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"about": "About",
"advanceSettings": "Advanced Settings",
"agentDefaultMessage": "Hello, I'm **{{name}}**. You can start chatting with me right away or go to [Assistant Settings](/chat/{{id}}/setting) to complete my information.",
"agentDefaultMessage": "Hello, I'm **{{name}}**. You can start chatting with me right away or go to [Assistant Settings](/chat/setting#session={{id}}) to complete my information.",
"agentDefaultMessageWithSystemRole": "Hello, I'm **{{name}}**, {{systemRole}}. Let's start chatting!",
"agentMaxToken": "Max Session Length",
"agentModel": "Model",
Expand Down Expand Up @@ -62,7 +62,7 @@
"stop": "Stop",
"tab": {
"chat": "Chat",
"market": "Assistant Market",
"market": "Discover",
"setting": "Settings"
},
"temp": "Temporary",
Expand Down
2 changes: 1 addition & 1 deletion locales/ru_RU/common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"about": "Наш Github",
"advanceSettings": "Дополнительные настройки",
"agentDefaultMessage": "Здравствуйте, я **{{name}}**. Вы можете начать общаться со мной прямо сейчас или перейти на [Assistant Settings](/chat/{{id}}/setting) для моей настройки.",
"agentDefaultMessage": "Здравствуйте, я **{{name}}**. Вы можете начать общаться со мной прямо сейчас или перейти на [Assistant Settings](/chat/setting#session={{id}}) для моей настройки.",
"agentDefaultMessageWithSystemRole": "Здравствуйте, Я **{{name}}**, {{systemRole}}. Давайте начнем общаться!",
"agentMaxToken": "Максимальная длина запроса",
"agentModel": "Модель",
Expand Down
2 changes: 1 addition & 1 deletion locales/zh_CN/common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"about": "关于",
"advanceSettings": "高级设置",
"agentDefaultMessage": "你好,我是 **{{name}}**,你可以立即与我开始对话,也可以前往 [助手设置](/chat/{{id}}/setting) 完善我的信息。",
"agentDefaultMessage": "你好,我是 **{{name}}**,你可以立即与我开始对话,也可以前往 [助手设置](/chat/setting#session={{id}}) 完善我的信息。",
"agentDefaultMessageWithSystemRole": "你好,我是 **{{name}}**,{{systemRole}},让我们开始对话吧!",
"agentMaxToken": "会话最大长度",
"agentModel": "模型",
Expand Down
2 changes: 1 addition & 1 deletion src/features/MobileTabBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default memo<{ className?: string }>(({ className }) => {
icon: (active) => <Icon className={active ? styles.active : undefined} icon={Sticker} />,
key: 'market',
onClick: () => {
Router.push('/market');
Router.push({ hash: '', pathname: `/market` });
},
title: t('tab.market'),
},
Expand Down
2 changes: 1 addition & 1 deletion src/locales/default/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default {
about: '关于',
advanceSettings: '高级设置',
agentDefaultMessage:
'你好,我是 **{{name}}**,你可以立即与我开始对话,也可以前往 [助手设置](/chat/{{id}}/setting) 完善我的信息。',
'你好,我是 **{{name}}**,你可以立即与我开始对话,也可以前往 [助手设置](/chat/setting#session={{id}}) 完善我的信息。',
agentDefaultMessageWithSystemRole: '你好,我是 **{{name}}**,{{systemRole}},让我们开始对话吧!',
agentMaxToken: '会话最大长度',
agentModel: '模型',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/chat/features/Header/Mobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const MobileHeader = memo(() => {
return (
<MobileNavBar
center={<MobileNavBarTitle desc={model} title={displayTitle} />}
onBackClick={() => Router.push('/chat')}
onBackClick={() => Router.push({ hash: null, pathname: `/chat` })}
right={
<>
<ActionIcon icon={LayoutList} onClick={() => toggleConfig()} />
Expand Down
6 changes: 2 additions & 4 deletions src/pages/chat/setting/features/Header/Desktop.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { ChatHeader, ChatHeaderTitle } from '@lobehub/ui';
import Router from 'next/router';
import { ReactNode, memo } from 'react';
import { useTranslation } from 'react-i18next';

import { useSessionStore } from '@/store/session';

const Header = memo<{ children: ReactNode }>(({ children }) => {
const { t } = useTranslation('setting');
const onBack = useSessionStore((s) => s.switchBackToChat);

return (
<ChatHeader
left={<ChatHeaderTitle title={t('header.session')} />}
onBackClick={onBack}
onBackClick={() => Router.push({ hash: location.hash, pathname: `/chat` })}
right={children}
showBackButton
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/chat/setting/features/Header/Mobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Header = memo<{ children: ReactNode }>(({ children }) => {
return (
<MobileNavBar
center={<MobileNavBarTitle title={t('header.session')} />}
onBackClick={() => Router.back()}
onBackClick={() => Router.push({ hash: location.hash, pathname: `/chat/mobile` })}
right={children}
showBackButton
/>
Expand Down
40 changes: 8 additions & 32 deletions src/pages/market/features/Header/Desktop.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,29 @@
import { ActionIcon, Logo, SearchBar } from '@lobehub/ui';
import { ChatHeader, Logo, SearchBar } from '@lobehub/ui';
import { createStyles } from 'antd-style';
import { MessageSquarePlus } from 'lucide-react';
import Link from 'next/link';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';

import { useSessionStore } from '@/store/session';

export const useStyles = createStyles(({ css, token }) => ({
logo: css`
color: ${token.colorText};
fill: ${token.colorText};
`,
top: css`
position: sticky;
top: 0;
`,
}));

const Header = memo(() => {
const { styles } = useStyles();
const { t } = useTranslation('common');
const [keywords, createSession] = useSessionStore((s) => [s.searchKeywords, s.createSession]);

return (
<Flexbox className={styles.top} gap={16} padding={16}>
<Flexbox distribution={'space-between'} horizontal>
<ChatHeader
left={
<Link href={'/'}>
<Logo className={styles.logo} size={36} type={'text'} />
<Logo className={styles.logo} extra={t('tab.market')} size={36} type={'text'} />
</Link>
<ActionIcon
icon={MessageSquarePlus}
onClick={createSession}
size={{ fontSize: 24 }}
style={{ flex: 'none' }}
title={t('newAgent')}
/>
</Flexbox>
<SearchBar
allowClear
enableShortKey
onChange={(e) => useSessionStore.setState({ searchKeywords: e.target.value })}
placeholder={t('searchAgentPlaceholder')}
shortKey={'k'}
spotlight
type={'ghost'}
value={keywords}
/>
</Flexbox>
}
right={<SearchBar allowClear spotlight type={'ghost'} />}
/>
);
});

Expand Down

0 comments on commit 2d1e8d6

Please sign in to comment.