Remove clear chat button
This commit is contained in:
parent
602abb1175
commit
37d48a4e8b
|
|
@ -361,15 +361,6 @@ export const ChatPanel = ({ visible }: { visible: boolean }) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClear = () => {
|
|
||||||
if (!currentStory || !currentWorld) return;
|
|
||||||
dispatch({
|
|
||||||
type: 'CLEAR_CHAT',
|
|
||||||
worldId: currentWorld.id,
|
|
||||||
storyId: currentStory.id,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDeleteMessage = useCallback((messageId: string) => {
|
const handleDeleteMessage = useCallback((messageId: string) => {
|
||||||
if (!currentStory || !currentWorld) return;
|
if (!currentStory || !currentWorld) return;
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
@ -542,9 +533,6 @@ export const ChatPanel = ({ visible }: { visible: boolean }) => {
|
||||||
<div class={styles.errorText}>{error}</div>
|
<div class={styles.errorText}>{error}</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<button class={styles.clearButton} onClick={handleClear}>
|
|
||||||
Clear chat
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{currentStory && (
|
{currentStory && (
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,6 @@ type Action =
|
||||||
| { type: 'SET_CHAT_OPEN'; open: boolean }
|
| { type: 'SET_CHAT_OPEN'; open: boolean }
|
||||||
// Chat
|
// Chat
|
||||||
| { type: 'ADD_CHAT_MESSAGE'; worldId: string; storyId: string; message: ChatMessage }
|
| { type: 'ADD_CHAT_MESSAGE'; worldId: string; storyId: string; message: ChatMessage }
|
||||||
| { type: 'CLEAR_CHAT'; worldId: string; storyId: string }
|
|
||||||
| { type: 'DELETE_CHAT_MESSAGES_FROM'; worldId: string; storyId: string; messageId: string }
|
| { type: 'DELETE_CHAT_MESSAGES_FROM'; worldId: string; storyId: string; messageId: string }
|
||||||
| { type: 'EDIT_CHAT_MESSAGE'; worldId: string; storyId: string; messageId: string; content: string }
|
| { type: 'EDIT_CHAT_MESSAGE'; worldId: string; storyId: string; messageId: string; content: string }
|
||||||
// Connection
|
// Connection
|
||||||
|
|
@ -440,9 +439,6 @@ function reducer(state: IState, action: Action): IState {
|
||||||
return { ...s, chatMessages: [...s.chatMessages, action.message] };
|
return { ...s, chatMessages: [...s.chatMessages, action.message] };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
case 'CLEAR_CHAT': {
|
|
||||||
return updateStory(state, action.worldId, action.storyId, s => ({ ...s, chatMessages: [] }));
|
|
||||||
}
|
|
||||||
case 'DELETE_CHAT_MESSAGES_FROM': {
|
case 'DELETE_CHAT_MESSAGES_FROM': {
|
||||||
return updateStory(state, action.worldId, action.storyId, s => {
|
return updateStory(state, action.worldId, action.storyId, s => {
|
||||||
const messageIndex = s.chatMessages.findIndex(m => m.id === action.messageId);
|
const messageIndex = s.chatMessages.findIndex(m => m.id === action.messageId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue