some minor fix
Browse files
app/components/sidebar/HistoryItem.tsx
CHANGED
@@ -57,7 +57,7 @@ export function HistoryItem({ item, onDelete, onDuplicate, exportChat }: History
|
|
57 |
<div
|
58 |
className={classNames(
|
59 |
'absolute right-0 z-1 top-0 bottom-0 bg-gradient-to-l from-bolt-elements-background-depth-2 group-hover:from-bolt-elements-background-depth-3 box-content pl-3 to-transparent w-10 flex justify-end group-hover:w-22 group-hover:from-99%',
|
60 |
-
{ 'from-bolt-elements-background-depth-3 w-
|
61 |
)}
|
62 |
>
|
63 |
<div className="flex items-center p-1 text-bolt-elements-textSecondary opacity-0 group-hover:opacity-100 transition-opacity">
|
|
|
57 |
<div
|
58 |
className={classNames(
|
59 |
'absolute right-0 z-1 top-0 bottom-0 bg-gradient-to-l from-bolt-elements-background-depth-2 group-hover:from-bolt-elements-background-depth-3 box-content pl-3 to-transparent w-10 flex justify-end group-hover:w-22 group-hover:from-99%',
|
60 |
+
{ 'from-bolt-elements-background-depth-3 w-10 ': isActiveChat },
|
61 |
)}
|
62 |
>
|
63 |
<div className="flex items-center p-1 text-bolt-elements-textSecondary opacity-0 group-hover:opacity-100 transition-opacity">
|
app/lib/hooks/useEditChatDescription.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import { useCallback, useEffect, useState } from 'react';
|
2 |
import { toast } from 'react-toastify';
|
3 |
import {
|
@@ -43,10 +44,15 @@ export function useEditChatDescription({
|
|
43 |
customChatId,
|
44 |
syncWithGlobalStore,
|
45 |
}: EditChatDescriptionOptions): EditChatDescriptionHook {
|
46 |
-
const
|
47 |
const [editing, setEditing] = useState(false);
|
48 |
const [currentDescription, setCurrentDescription] = useState(initialDescription);
|
49 |
|
|
|
|
|
|
|
|
|
|
|
50 |
useEffect(() => {
|
51 |
setCurrentDescription(initialDescription);
|
52 |
}, [initialDescription]);
|
@@ -115,6 +121,11 @@ export function useEditChatDescription({
|
|
115 |
return;
|
116 |
}
|
117 |
|
|
|
|
|
|
|
|
|
|
|
118 |
await updateChatDescription(db, chatId, currentDescription);
|
119 |
|
120 |
if (syncWithGlobalStore) {
|
|
|
1 |
+
import { useStore } from '@nanostores/react';
|
2 |
import { useCallback, useEffect, useState } from 'react';
|
3 |
import { toast } from 'react-toastify';
|
4 |
import {
|
|
|
44 |
customChatId,
|
45 |
syncWithGlobalStore,
|
46 |
}: EditChatDescriptionOptions): EditChatDescriptionHook {
|
47 |
+
const chatIdFromStore = useStore(chatIdStore);
|
48 |
const [editing, setEditing] = useState(false);
|
49 |
const [currentDescription, setCurrentDescription] = useState(initialDescription);
|
50 |
|
51 |
+
const [chatId, setChatId] = useState<string>();
|
52 |
+
|
53 |
+
useEffect(() => {
|
54 |
+
setChatId(customChatId || chatIdFromStore);
|
55 |
+
}, [customChatId, chatIdFromStore]);
|
56 |
useEffect(() => {
|
57 |
setCurrentDescription(initialDescription);
|
58 |
}, [initialDescription]);
|
|
|
121 |
return;
|
122 |
}
|
123 |
|
124 |
+
if (!chatId) {
|
125 |
+
toast.error('Chat Id is not available');
|
126 |
+
return;
|
127 |
+
}
|
128 |
+
|
129 |
await updateChatDescription(db, chatId, currentDescription);
|
130 |
|
131 |
if (syncWithGlobalStore) {
|