Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.

Commit fcf4289

Browse files
committed
Merge remote-tracking branch 'origin/v3-dev' into v3-dev
2 parents dfccfbe + b6d3b06 commit fcf4289

File tree

14 files changed

+196
-80
lines changed

14 files changed

+196
-80
lines changed

packages/frontend/src/app/(need-auth)/page.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { IconButton } from '@/components/button';
66
import Chat from '@/components/chat';
77
import AddIcon from '@/icons/add.svg';
88
import ReturnIcon from '@/icons/return.svg';
9+
import ChatGptIcon from '@/icons/bot.svg';
910
import Locale from '@/locales';
1011
import { useStore } from '@/store';
1112
import styles from '@/styles/module/welcome.module.scss';
@@ -25,9 +26,10 @@ export default function ChatPage() {
2526
className={styles['return-btn']}
2627
></IconButton>
2728
<div className={styles['welcome-container']}>
28-
<div className={styles['title']}>{Locale.Index.WelcomeTitle}</div>
29-
<div className={styles['message']}>{Locale.Index.WelcomeMessage}</div>
30-
<div className={styles['caption']}>{Locale.Index.WelcomeCaption}</div>
29+
<div className={styles['logo']}>
30+
</div>
31+
<div className={styles['title']}>{Locale.Index.Title}</div>
32+
<div className={styles['message']}>{Locale.Index.WelcomeCaption}</div>
3133
<IconButton
3234
text={Locale.Home.NewChat}
3335
icon={<AddIcon />}

packages/frontend/src/app/auth/auth.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,7 @@
214214
background-color: var(--primary-hover-color);
215215
}
216216
}
217+
218+
.forceauth-button {
219+
padding: 10px 16px;
220+
}

packages/frontend/src/app/auth/modal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useUserData } from '@/hooks/data/use-user';
77
import usePreventFormSubmit from '@/hooks/use-prevent-form';
88
import Locales from '@/locales';
99
import { useStore } from '@/store';
10+
import clsx from 'clsx';
1011

1112
export function SetUsernameAndPassword(props: { onClose: () => void }) {
1213
const { fetcher } = useStore();
@@ -68,7 +69,7 @@ export function SetUsernameAndPassword(props: { onClose: () => void }) {
6869
disabled={isSubmitting}
6970
onClick={() => handleSubmit(undefined, setup)}
7071
text={Locales.Auth.Submit}
71-
className={styles['auth-submit-btn']}
72+
className={clsx(styles['auth-submit-btn'], styles['forceauth-button'])}
7273
type="primary"
7374
/>
7475
</div>

packages/frontend/src/components/sidebar/index.tsx

Lines changed: 84 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
'use client';
22

33
import Link from 'next/link';
4+
import clsx from 'clsx';
45
import { useEffect, useState } from 'react';
56
import { createRoot } from 'react-dom/client';
67
import useSWR from 'swr';
8+
import Router from 'next/router';
79

810
import { SetUsernameAndPassword } from '@/app/auth/modal';
911
import { ChatList } from '@/components/chat/chat-list';
@@ -22,6 +24,9 @@ import MaskIcon from '@/icons/mask.svg';
2224
import PremiumIcon from '@/icons/premium.svg';
2325
import SettingsIcon from '@/icons/settings.svg';
2426
import UserIcon from '@/icons/user.svg';
27+
import MoreIcon from '@/icons/more.svg';
28+
import LogoutIcon from '@/icons/logout.svg';
29+
import PersonIcon from '@/icons/person.svg';
2530
import Locale from '@/locales';
2631
import { useStore } from '@/store';
2732
import styles from '@/styles/module/home.module.scss';
@@ -91,14 +96,15 @@ function bindPassword() {
9196
}
9297
};
9398
root.render(
94-
<Modal title={Locale.Auth.SetUp} onClose={closeModal}>
99+
<Modal title={Locale.Auth.SetUp} onClose={closeModal} className={styles['force-auth-modal']}>
95100
<SetUsernameAndPassword onClose={closeModal} />
96101
</Modal>,
97102
);
98103
}
99104

100105
export function Sidebar({ children }: { children: React.ReactNode }) {
101106
const {
107+
setSessionToken,
102108
showSideBar,
103109
setShowSideBar,
104110
fetcher,
@@ -107,6 +113,7 @@ export function Sidebar({ children }: { children: React.ReactNode }) {
107113
config,
108114
} = useStore();
109115
const [newbtnExpanded, setNewbtnExpanded] = useState<boolean>(false);
116+
const [morebtnExpanded, setMorebtnExpanded] = useState<boolean>(false);
110117

111118
useSWR('/announcement/recent', (url) =>
112119
fetcher(url)
@@ -159,11 +166,10 @@ export function Sidebar({ children }: { children: React.ReactNode }) {
159166

160167
return (
161168
<div
162-
className={`${
163-
config.tightBorder && !isMobileScreen()
164-
? styles['tight-container']
165-
: styles.container
166-
}`}
169+
className={`${config.tightBorder && !isMobileScreen()
170+
? styles['tight-container']
171+
: styles.container
172+
}`}
167173
>
168174
<div
169175
className={styles.sidebar + ` ${showSideBar && styles['sidebar-show']}`}
@@ -202,6 +208,7 @@ export function Sidebar({ children }: { children: React.ReactNode }) {
202208
onClick={() => {
203209
setShowSideBar(false);
204210
setNewbtnExpanded(false);
211+
setMorebtnExpanded(false);
205212
}}
206213
className={styles['link-full']}
207214
style={{ color: 'inherit', textDecoration: 'inherit' }}
@@ -250,41 +257,92 @@ export function Sidebar({ children }: { children: React.ReactNode }) {
250257

251258
<div className={styles['sidebar-tail']}>
252259
{userData && <Premium userData={userData} />}
253-
<Link
254-
href="/profile"
255-
onClick={() => {
256-
setShowSideBar(false);
257-
}}
258-
style={{ color: 'inherit', textDecoration: 'inherit' }}
259-
prefetch={true}
260-
className={styles['link-full']}
261-
>
262-
<div className={styles['sidebar-accountbtn']}>
263-
<div
264-
className={styles['sidebar-account']}
260+
<div className={styles['sidebar-accountbtn']}>
261+
<div className={morebtnExpanded ? styles['sidebar-account-ext'] : clsx(styles['sidebar-account-ext'], styles['sidebar-account-ext-dis'])}>
262+
<Link
263+
href="/profile"
265264
onClick={() => {
266265
setShowSideBar(false);
266+
setNewbtnExpanded(false);
267+
setMorebtnExpanded(false);
267268
}}
269+
className={styles['link-full']}
270+
style={{ color: 'inherit', textDecoration: 'inherit' }}
268271
>
269-
<div className={styles['avatar']}>
270-
<UserIcon />
271-
</div>
272-
<div className={styles['account-name']}>
273-
{userData?.name ?? Locale.Index.DefaultUser}
272+
<div className={styles['sidebar-account-ext-item']}>
273+
<div className={styles['icon']}>
274+
<PersonIcon />
275+
</div>
276+
<div className={styles['text']}>
277+
{Locale.Index.Profile}
278+
</div>
274279
</div>
275-
</div>
280+
</Link>
276281
<Link
277282
href="/settings"
278283
onClick={() => {
279284
setShowSideBar(false);
285+
setNewbtnExpanded(false);
286+
setMorebtnExpanded(false);
280287
}}
288+
className={styles['link-full']}
289+
style={{ color: 'inherit', textDecoration: 'inherit' }}
281290
>
282-
<div className={styles['account-settingbtn']}>
291+
<div className={styles['sidebar-account-ext-item']}>
292+
<div className={styles['icon']}>
283293
<SettingsIcon />
284294
</div>
295+
<div className={styles['text']}>
296+
{Locale.Index.Settings}
297+
</div>
298+
</div>
299+
</Link>
300+
<Link
301+
href="/announcement"
302+
onClick={() => {
303+
setShowSideBar(false);
304+
setNewbtnExpanded(false);
305+
setMorebtnExpanded(false);
306+
}}
307+
className={styles['link-full']}
308+
style={{ color: 'inherit', textDecoration: 'inherit' }}
309+
>
310+
<div className={styles['sidebar-account-ext-item']}>
311+
<div className={styles['icon']}>
312+
<AnnouncementIcon />
313+
</div>
314+
<div className={styles['text']}>
315+
{Locale.Index.Announcement}
316+
</div>
317+
</div>
285318
</Link>
319+
<div className={styles['sidebar-account-ext-item']} onClick={() => {
320+
setSessionToken(undefined);
321+
setShowSideBar(false);
322+
setNewbtnExpanded(false);
323+
setMorebtnExpanded(false);
324+
Router.reload();
325+
}}>
326+
<div className={styles['icon']}>
327+
<LogoutIcon />
328+
</div>
329+
<div className={styles['text']}>
330+
{Locale.Index.LogOut}
331+
</div>
332+
</div>
286333
</div>
287-
</Link>
334+
<div className={styles['sidebar-account']} onClick={() => setMorebtnExpanded(!morebtnExpanded)}>
335+
<div className={styles['avatar']}>
336+
<UserIcon />
337+
</div>
338+
<div className={styles['account-name']}>
339+
{userData?.name ?? Locale.Index.DefaultUser}
340+
</div>
341+
<div className={styles['account-settingbtn']}>
342+
<MoreIcon />
343+
</div>
344+
</div>
345+
</div>
288346
</div>
289347
</div>
290348
<div className={styles['window-content']}>{children}</div>

packages/frontend/src/components/ui-lib.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ReturnIcon from '@/icons/return.svg';
66
import LoadingIcon from '@/icons/three-dots.svg';
77
import Locale from '@/locales';
88
import styles from '@/styles/module/ui-lib.module.scss';
9+
import clsx from 'clsx';
910

1011
export function Popover(props: {
1112
children: JSX.Element;
@@ -79,11 +80,13 @@ interface ModalProps {
7980
children?: JSX.Element;
8081
actions?: JSX.Element[];
8182
onClose?: () => void;
83+
className?: string;
84+
style?: React.CSSProperties;
8285
}
8386

8487
export function Modal(props: ModalProps) {
8588
return (
86-
<div className={styles['modal-container']}>
89+
<div className={clsx(styles['modal-container'],props.className)} style={props.style}>
8790
<div className={styles['modal-header']}>
8891
<div className={styles['modal-title']}>{props.title}</div>
8992

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

packages/frontend/src/locales/cn.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ const cn = {
2323
SubTitle: '欢迎关注微信公众号:',
2424
PremiumLimit: (count: number) => `当前可用:${count} 条`,
2525
UpgradePremium: '升级到高级版',
26-
WelcomeTitle: `欢迎使用${TITLE}`,
27-
WelcomeMessage:
28-
'你好,我是ChatGPT,一个基于GPT架构的人工智能助手。我被设计用来回答各种问题、提供信息、提供建议和与您进行对话。我在各种主题上有一定的知识,并且可以用多种语言与您交流。如果您有任何问题或需要帮助,随时问我,我会尽力为您提供所需的信息和支持。',
2926
Return: '返回',
30-
WelcomeCaption: '点击下面的按钮开始聊天吧!',
27+
WelcomeCaption: '生产力的飞跃',
28+
Settings: '设置',
29+
Profile: '用户信息',
30+
Announcement: '公告',
31+
LogOut: '退出登录',
3132
},
3233
Premium: {
3334
Title: '升级到高级版',

packages/frontend/src/locales/en.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ const en: LocaleType = {
2323
DefaultUser: 'User',
2424
Title: TITLE,
2525
SubTitle: 'Welcome to follow WeChat official account:',
26-
PremiumLimit: (count: number) => `Currently available: ${count} items`,
26+
PremiumLimit: (count: number) => `${count} times available.`,
2727
UpgradePremium: 'Upgrade to Premium',
28-
WelcomeTitle: `Welcome to ${TITLE}`,
29-
WelcomeMessage:
30-
'Hello, I am ChatGPT, an artificial intelligence assistant based on GPT. I am designed to answer various questions, provide information, offer suggestions, and engage in conversation with you. I have knowledge on a variety of topics and can communicate with you in multiple languages. If you have any questions or need assistance, feel free to ask me, and I will do my best to provide you with the required information and support.',
3128
Return: 'Return',
32-
WelcomeCaption: 'Click the button below to start chatting!',
29+
WelcomeCaption: 'Leap of productivity',
30+
Settings: 'Settings',
31+
Profile: 'Profile',
32+
Announcement: 'Announcements',
33+
LogOut: 'Log Out',
3334
},
3435
Premium: {
3536
Title: 'Upgrade to Premium',

0 commit comments

Comments
 (0)