mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-22 19:47:28 +00:00
chore: minor front-end style update (#80)
This commit is contained in:
commit
427fdf1df9
1 changed files with 28 additions and 16 deletions
|
|
@ -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}
|
||||
>
|
||||
<Plus className="w-4 h-4" />
|
||||
</Button>
|
||||
{location.pathname !== "/history" && (
|
||||
<>
|
||||
<div className="font-bold leading-10 text-base ">
|
||||
{activeTaskTitle}
|
||||
</div>
|
||||
{activeTaskTitle === "New Project" ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="font-bold text-base no-drag"
|
||||
onClick={createNewProject}
|
||||
>
|
||||
{activeTaskTitle}
|
||||
</Button>
|
||||
) : (
|
||||
<div className="font-bold leading-10 text-base ">{activeTaskTitle}</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue