Skip to content

Commit

Permalink
revert to main code
Browse files Browse the repository at this point in the history
  • Loading branch information
wadabee committed Nov 15, 2024
1 parent a8066d4 commit 4dd8645
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
11 changes: 3 additions & 8 deletions packages/web/src/components/ChatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import useChatList from '../hooks/useChatList';
import { useNavigate, useParams } from 'react-router-dom';
import ChatListItem from './ChatListItem';
import { decomposeId } from '../utils/ChatUtils';
import { ROUTE_INDEX_USE_CASE_BUILDER } from '../main';

type Props = BaseProps & {
searchWords: string[];
isUseCaseBuilder?: boolean;
};

const ChatList: React.FC<Props> = (props) => {
Expand All @@ -19,14 +17,12 @@ const ChatList: React.FC<Props> = (props) => {

const onDelete = useCallback(
(_chatId: string) => {
navigate(props.isUseCaseBuilder ? ROUTE_INDEX_USE_CASE_BUILDER : '/chat');
navigate('/chat');
return deleteChat(_chatId).catch(() => {
navigate(
`${props.isUseCaseBuilder ? ROUTE_INDEX_USE_CASE_BUILDER : ''}/chat/${_chatId}`
);
navigate(`/chat/${_chatId}`);
});
},
[deleteChat, navigate, props.isUseCaseBuilder]
[deleteChat, navigate]
);

const onUpdateTitle = useCallback(
Expand Down Expand Up @@ -66,7 +62,6 @@ const ChatList: React.FC<Props> = (props) => {
onDelete={onDelete}
onUpdateTitle={onUpdateTitle}
highlightWords={props.searchWords}
isUseCaseBuilder={props.isUseCaseBuilder}
/>
);
})}
Expand Down
4 changes: 1 addition & 3 deletions packages/web/src/components/ChatListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { Chat } from 'generative-ai-use-cases-jp';
import { decomposeId } from '../utils/ChatUtils';
import DialogConfirmDeleteChat from './DialogConfirmDeleteChat';
import HighlightWithinTextarea from 'react-highlight-within-textarea';
import { ROUTE_INDEX_USE_CASE_BUILDER } from '../main';

type Props = BaseProps & {
active: boolean;
Expand All @@ -24,7 +23,6 @@ type Props = BaseProps & {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onUpdateTitle: (chatId: string, title: string) => Promise<any>;
highlightWords: string[];
isUseCaseBuilder?: boolean;
};

const ChatListItem: React.FC<Props> = (props) => {
Expand Down Expand Up @@ -107,7 +105,7 @@ const ChatListItem: React.FC<Props> = (props) => {
props.active && 'bg-aws-sky'
}
${props.className}`}
to={`${props.isUseCaseBuilder ? ROUTE_INDEX_USE_CASE_BUILDER : ''}/chat/${chatId}`}>
to={`/chat/${chatId}`}>
<div
className={`flex h-8 max-h-5 w-full justify-start overflow-hidden`}>
<div className="mr-2 ">
Expand Down

0 comments on commit 4dd8645

Please sign in to comment.