mirror of
https://github.com/stackblitz/bolt.new
synced 2025-02-06 04:48:04 +00:00
some minor fix
This commit is contained in:
parent
d92029d573
commit
507a7f94bd
@ -57,7 +57,7 @@ export function HistoryItem({ item, onDelete, onDuplicate, exportChat }: History
|
|||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'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%',
|
'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%',
|
||||||
{ 'from-bolt-elements-background-depth-3 w-22 from-99%': isActiveChat },
|
{ 'from-bolt-elements-background-depth-3 w-10 ': isActiveChat },
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex items-center p-1 text-bolt-elements-textSecondary opacity-0 group-hover:opacity-100 transition-opacity">
|
<div className="flex items-center p-1 text-bolt-elements-textSecondary opacity-0 group-hover:opacity-100 transition-opacity">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { useStore } from '@nanostores/react';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import {
|
import {
|
||||||
@ -43,10 +44,15 @@ export function useEditChatDescription({
|
|||||||
customChatId,
|
customChatId,
|
||||||
syncWithGlobalStore,
|
syncWithGlobalStore,
|
||||||
}: EditChatDescriptionOptions): EditChatDescriptionHook {
|
}: EditChatDescriptionOptions): EditChatDescriptionHook {
|
||||||
const chatId = (customChatId || chatIdStore.get()) as string;
|
const chatIdFromStore = useStore(chatIdStore);
|
||||||
const [editing, setEditing] = useState(false);
|
const [editing, setEditing] = useState(false);
|
||||||
const [currentDescription, setCurrentDescription] = useState(initialDescription);
|
const [currentDescription, setCurrentDescription] = useState(initialDescription);
|
||||||
|
|
||||||
|
const [chatId, setChatId] = useState<string>();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setChatId(customChatId || chatIdFromStore);
|
||||||
|
}, [customChatId, chatIdFromStore]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentDescription(initialDescription);
|
setCurrentDescription(initialDescription);
|
||||||
}, [initialDescription]);
|
}, [initialDescription]);
|
||||||
@ -115,6 +121,11 @@ export function useEditChatDescription({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!chatId) {
|
||||||
|
toast.error('Chat Id is not available');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await updateChatDescription(db, chatId, currentDescription);
|
await updateChatDescription(db, chatId, currentDescription);
|
||||||
|
|
||||||
if (syncWithGlobalStore) {
|
if (syncWithGlobalStore) {
|
||||||
|
Loading…
Reference in New Issue
Block a user