Skip to content

Commit 0ca3a6a

Browse files
committed
refactor(frontend): clean up chat components and improve sidebar styling for better layout
1 parent 3f20e19 commit 0ca3a6a

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

frontend/src/components/chat/chat-bottombar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default function ChatBottombar({
126126
<button
127127
type="button"
128128
onClick={() => removeAttachment(index)}
129-
className="absolute -top-1 -right-1 size-5 bg-red-500 rounded-full flex items-center justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity"
129+
className="absolute -top-1 -right-1 size-5 rounded-full flex items-center justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity"
130130
>
131131
<X className="size-3" />
132132
</button>

frontend/src/components/sidebar.tsx

+2-9
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,6 @@ function ChatSideBarComponent({
9898
const [currentChatid, setCurrentChatid] = useState('');
9999
const { setCurProject, pollChatProject } = useContext(ProjectContext);
100100

101-
const handleNewChat = useCallback(() => {
102-
router.push('/');
103-
setCurrentChatid('');
104-
const event = new Event(EventEnum.NEW_CHAT);
105-
window.dispatchEvent(event);
106-
}, [router]);
107-
108101
const handleChatSelect = useCallback(
109102
(chatId: string) => {
110103
setCurrentChatid(chatId);
@@ -238,8 +231,8 @@ function ChatSideBarComponent({
238231

239232
{/* Footer Settings */}
240233
<SidebarFooter
241-
className={`mt-auto border-t border-gray-200 dark:border-gray-700 ${
242-
isCollapsed ? 'flex justify-center px-0' : 'px-3'
234+
className={`mt-auto border-t border-gray-200 dark:border-gray-700 ${
235+
isCollapsed ? 'flex justify-center items-center px-0' : 'px-3'
243236
}`}
244237
>
245238
<UserSettingsBar isSimple={false} />

frontend/src/components/ui/sidebar.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ const SidebarRail = React.forwardRef<
290290
>(({ className, setIsSimple, isSimple, ...props }, ref) => {
291291
const { toggleSidebar } = useSidebar();
292292
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
293-
toggleSidebar(); // 保留原有的逻辑
294-
setIsSimple(!isSimple); // 更新 isSimple 状态
293+
toggleSidebar();
294+
setIsSimple(!isSimple);
295295
};
296296

297297
return (

frontend/src/components/user-settings-bar.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export const UserSettingsBar = ({ isSimple }: UserSettingsProps) => {
8989
/>
9090
<AvatarFallback>{avatarFallback}</AvatarFallback>
9191
</SmallAvatar>
92-
{!isSimple && <span className="truncate">{displayUsername}</span>}
9392
</Button>
9493
);
9594
}, [

0 commit comments

Comments
 (0)