Skip to content

Commit a584f0c

Browse files
committed
feat: enhance chat layout and user experience with responsive design adjustments and improved input handling
1 parent aa0148d commit a584f0c

File tree

7 files changed

+294
-129
lines changed

7 files changed

+294
-129
lines changed

.vscode/settings.json

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,39 @@
11
{
2-
"editor.formatOnSave": true,
2+
"makefile.configureOnOpen": true,
33
"terminal.integrated.fontSize": 14,
4+
"editor.formatOnSave": true,
45
"editor.codeActionsOnSave": {
5-
"source.fixAll.eslint": "explicit"
6+
"source.fixAll.eslint": "explicit",
7+
"source.organizeImports": "explicit"
68
},
7-
"editor.defaultFormatter": "esbenp.prettier-vscode",
9+
"eslint.workingDirectories": ["."],
10+
"eslint.format.enable": true,
811
"[typescript]": {
9-
"editor.defaultFormatter": "esbenp.prettier-vscode"
12+
"editor.defaultFormatter": "esbenp.prettier-vscode",
13+
"editor.codeActionsOnSave": {
14+
"source.fixAll.eslint": "explicit",
15+
"source.organizeImports": "explicit"
16+
}
1017
},
1118
"[typescriptreact]": {
12-
"editor.defaultFormatter": "esbenp.prettier-vscode"
19+
"editor.defaultFormatter": "esbenp.prettier-vscode",
20+
"editor.codeActionsOnSave": {
21+
"source.fixAll.eslint": "explicit",
22+
"source.organizeImports": "explicit"
23+
}
1324
},
1425
"[javascript]": {
15-
"editor.defaultFormatter": "esbenp.prettier-vscode"
26+
"editor.defaultFormatter": "esbenp.prettier-vscode",
27+
"editor.codeActionsOnSave": {
28+
"source.fixAll.eslint": "explicit",
29+
"source.organizeImports": "explicit"
30+
}
1631
},
17-
"[json]": {
18-
"editor.defaultFormatter": "esbenp.prettier-vscode"
32+
"[javascriptreact]": {
33+
"editor.defaultFormatter": "esbenp.prettier-vscode",
34+
"editor.codeActionsOnSave": {
35+
"source.fixAll.eslint": "explicit",
36+
"source.organizeImports": "explicit"
37+
}
1938
}
20-
}
39+
}

src/page/chat/ChatPanel.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { chatEvents } from '@/store/useChatStore.ts';
2-
import useChatStore from '@/store/useChatStore.ts';
1+
import useChatStore, { chatEvents } from '@/store/useChatStore.ts';
2+
import { GroupChat } from '@/types/chat.ts';
3+
import { cleanRoomId } from '@/utils/roomUtils.ts';
34
import { Content, Description, Overlay, Portal, Root, Title } from '@radix-ui/react-dialog';
45
import { Root as SeparatorRoot } from '@radix-ui/react-separator';
56
import React, { useCallback, useEffect, useState } from 'react';
@@ -8,8 +9,6 @@ import GroupChatHeader from '../group/GroupChatHeader.tsx';
89
import GroupUserList from '../group/GroupUserList.tsx';
910
import ChatInput from '../input/ChatInput.tsx';
1011
import MessageList from './MessageList.tsx';
11-
import { GroupChat } from '@/types/chat.ts';
12-
import { cleanRoomId } from '@/utils/roomUtils.ts';
1312

1413
// 动画常量
1514
const overlayShow = 'animate-[overlay-show_150ms_cubic-bezier(0.16,1,0.3,1)]';
@@ -408,7 +407,7 @@ const ChatPanel: React.FC = () => {
408407
value={tempUserName}
409408
onChange={(e) => setTempUserName(e.target.value)}
410409
placeholder="请输入您的用户名"
411-
className="w-full px-3 py-2 border border-gray-300 rounded-md mb-4 focus:outline-none focus:ring-2 focus:ring-blue-500"
410+
className="w-full px-3 py-2 border border-gray-300 rounded-md mb-4 focus:outline-none focus:ring-2 focus:ring-blue-500 text-base"
412411
autoFocus
413412
/>
414413
<div className="flex justify-end space-x-2">
@@ -449,7 +448,7 @@ const ChatPanel: React.FC = () => {
449448
onChange={(e) => setRoomIdInput(e.target.value)}
450449
onKeyDown={handleKeyDown}
451450
placeholder="输入群聊ID或粘贴邀请链接"
452-
className="w-full px-3 py-2 border border-gray-300 rounded-md mb-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
451+
className="w-full px-3 py-2 border border-gray-300 rounded-md mb-2 focus:outline-none focus:ring-2 focus:ring-blue-500 text-base"
453452
autoFocus
454453
disabled={isJoining}
455454
/>
@@ -634,7 +633,8 @@ const ChatPanel: React.FC = () => {
634633
<>
635634
<GroupChatHeader />
636635
<div className="flex flex-1 overflow-hidden">
637-
<div className="w-64 bg-gray-50 border-r border-gray-200 overflow-y-auto">
636+
{/* 桌面端用户列表 */}
637+
<div className="hidden md:block w-64 bg-gray-50 border-r border-gray-200 overflow-y-auto">
638638
<GroupUserList />
639639
</div>
640640
<div className="flex-1 flex flex-col">
@@ -666,7 +666,7 @@ const ChatPanel: React.FC = () => {
666666
<Overlay className={`fixed inset-0 bg-black/30 ${overlayShow}`} />
667667
<Content
668668
className={`fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]
669-
w-[90vw] max-w-[450px] rounded-lg bg-white p-6 shadow-xl focus:outline-none
669+
w-[95vw] max-w-[450px] rounded-lg bg-white p-4 md:p-6 shadow-xl focus:outline-none
670670
${contentShow}`}
671671
onEscapeKeyDown={(e) => {
672672
// 如果是首次设置用户名(没有用户名),阻止关闭
@@ -692,7 +692,7 @@ const ChatPanel: React.FC = () => {
692692
value={tempUserName}
693693
onChange={(e) => setTempUserName(e.target.value)}
694694
placeholder="请输入您的用户名"
695-
className="w-full px-3 py-2 border border-gray-300 rounded-md mb-4 focus:outline-none focus:ring-2 focus:ring-blue-500"
695+
className="w-full px-3 py-2 border border-gray-300 rounded-md mb-4 focus:outline-none focus:ring-2 focus:ring-blue-500 text-base"
696696
autoFocus
697697
/>
698698
<div className="flex justify-end space-x-2">
@@ -721,7 +721,7 @@ const ChatPanel: React.FC = () => {
721721
<Overlay className={`fixed inset-0 bg-black/30 ${overlayShow}`} />
722722
<Content
723723
className={`fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]
724-
w-[90vw] max-w-[450px] rounded-lg bg-white p-6 shadow-xl focus:outline-none
724+
w-[95vw] max-w-[450px] rounded-lg bg-white p-4 md:p-6 shadow-xl focus:outline-none
725725
${contentShow}`}
726726
>
727727
<Title className="text-xl font-semibold mb-4">切换网络模式</Title>

0 commit comments

Comments
 (0)