From 065ce13d20485fa37c4592a3ebf61b95b1ec3d58 Mon Sep 17 00:00:00 2001
From: Sun Tao <2605127667@qq.com>
Date: Wed, 6 Aug 2025 17:14:39 +0800
Subject: [PATCH] minor front-end style update
---
src/components/TopBar/index.tsx | 44 +++++++++++++++++++++------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/src/components/TopBar/index.tsx b/src/components/TopBar/index.tsx
index 907c56b0..e190cbc2 100644
--- a/src/components/TopBar/index.tsx
+++ b/src/components/TopBar/index.tsx
@@ -53,6 +53,7 @@ function HeaderWin() {
const exportLog = async () => {
try {
const response = await window.electronAPI.exportLog();
+
if (!response.success) {
alert("Export cancelled:" + response.error);
return;
@@ -67,6 +68,20 @@ function HeaderWin() {
}
};
+ // create new project handler reused by plus icon and label
+ const createNewProject = () => {
+ const taskId = Object.keys(chatStore.tasks).find((taskId) => {
+ return chatStore.tasks[taskId].messages.length === 0;
+ });
+ if (taskId) {
+ chatStore.setActiveTaskId(taskId);
+ navigate("/");
+ return;
+ }
+ chatStore.create();
+ navigate("/");
+ };
+
const activeTaskTitle = useMemo(() => {
if (
chatStore.activeTaskId &&
@@ -117,27 +132,24 @@ function HeaderWin() {
variant="ghost"
size="icon"
className="mr-2 no-drag"
- onClick={() => {
- const taskId = Object.keys(chatStore.tasks).find((taskId) => {
- console.log(chatStore.tasks[taskId].messages.length);
- return chatStore.tasks[taskId].messages.length === 0;
- });
- if (taskId) {
- chatStore.setActiveTaskId(taskId);
- navigate(`/`);
- return;
- }
- chatStore.create();
- navigate("/");
- }}
+ onClick={createNewProject}
>