Skip to content

Commit

Permalink
edit buttons hidden on generate
Browse files Browse the repository at this point in the history
  • Loading branch information
jackschedel committed Jan 11, 2024
1 parent 5ab4905 commit 003f2b5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
45 changes: 23 additions & 22 deletions src/components/Chat/ChatContent/Message/View/ContentView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const ContentView = memo(
);
const inlineLatex = useStore((state) => state.inlineLatex);
const markdownMode = useStore((state) => state.markdownMode);
const generating = useStore((state) => state.generating);

const handleDelete = () => {
const updatedChats: ChatInterface[] = JSON.parse(
Expand Down Expand Up @@ -141,28 +142,11 @@ const ContentView = memo(
)}
</div>
<div className='flex justify-end gap-2 w-full mt-2'>
{isDelete || (
<>
{!useStore.getState().generating &&
role === 'assistant' &&
messageIndex === lastMessageIndex && (
<RefreshButton onClick={handleRefresh} />
)}
{messageIndex !== 0 && <UpButton onClick={handleMoveUp} />}
{messageIndex !== lastMessageIndex && (
<DownButton onClick={handleMoveDown} />
)}

<MarkdownModeButton />
<CopyButton onClick={handleCopy} />
<EditButton
setEditingMessageIndex={setEditingMessageIndex}
messageIndex={messageIndex}
/>
<DeleteButton setIsDelete={setIsDelete} />
</>
)}
{isDelete && (
{generating ? (
<div className='p-1 invisible'>
<TickIcon />
</div>
) : isDelete ? (
<>
<button
className='p-1 text-custom-white hover:text-neutral-dark hover:bg-custom-white/70 hover:rounded'
Expand All @@ -179,6 +163,23 @@ const ContentView = memo(
<TickIcon />
</button>
</>
) : (
<>
{role === 'assistant' && messageIndex === lastMessageIndex && (
<RefreshButton onClick={handleRefresh} />
)}
{messageIndex !== 0 && <UpButton onClick={handleMoveUp} />}
{messageIndex !== lastMessageIndex && (
<DownButton onClick={handleMoveDown} />
)}
<MarkdownModeButton />
<CopyButton onClick={handleCopy} />
<EditButton
setEditingMessageIndex={setEditingMessageIndex}
messageIndex={messageIndex}
/>
<DeleteButton setIsDelete={setIsDelete} />
</>
)}
</div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import useStore from '@store/store';
const StopGeneratingButton = () => {
const setGenerating = useStore((state) => state.setGenerating);
const generating = useStore((state) => state.generating);
// setGenerating(true);

return generating ? (
<div className='absolute bottom-6 left-0 right-0 m-auto flex md:w-full md:m-auto gap-0 md:gap-2 justify-center'>
Expand Down

0 comments on commit 003f2b5

Please sign in to comment.