Skip to content

Commit d398723

Browse files
Merge pull request #59 from microsoft/main
Merge: Merging current branch from main branch
2 parents a6ea3f9 + 123f9bc commit d398723

File tree

5 files changed

+100
-3
lines changed

5 files changed

+100
-3
lines changed
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

ClientAdvisor/App/frontend/src/components/ChatHistory/ChatHistoryPanel.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import ChatHistoryList from './ChatHistoryList'
2626

2727
import styles from './ChatHistoryPanel.module.css'
2828

29-
interface ChatHistoryPanelProps {}
29+
interface ChatHistoryPanelProps {
30+
isLoading: boolean
31+
}
3032

3133
export enum ChatHistoryPanelTabs {
3234
History = 'History'
@@ -44,6 +46,7 @@ const commandBarStyle: ICommandBarStyles = {
4446
const commandBarButtonStyle: Partial<IStackStyles> = { root: { height: '50px' } }
4547

4648
export function ChatHistoryPanel(_props: ChatHistoryPanelProps) {
49+
const { isLoading} = _props
4750
const appStateContext = useContext(AppStateContext)
4851
const [showContextualMenu, setShowContextualMenu] = React.useState(false)
4952
const [hideClearAllDialog, { toggle: toggleClearAllDialog }] = useBoolean(true)
@@ -67,7 +70,7 @@ export function ChatHistoryPanel(_props: ChatHistoryPanelProps) {
6770
}
6871

6972
const menuItems: IContextualMenuItem[] = [
70-
{ key: 'clearAll', text: 'Clear all chat history',disabled: !hasChatHistory, iconProps: { iconName: 'Delete' }}
73+
{ key: 'clearAll', text: 'Clear all chat history',disabled: (!hasChatHistory || isLoading), iconProps: { iconName: 'Delete' }}
7174
]
7275

7376
const handleHistoryClick = () => {

ClientAdvisor/App/frontend/src/pages/chat/Chat.module.css

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,58 @@ a {
377377
max-width: 100%;
378378
}
379379
}
380+
381+
382+
/* popup css*/
383+
.popupContainer {
384+
display: flex;
385+
align-items: center;
386+
justify-content: space-between;
387+
background: #fff;
388+
border: 1px solid #ccc;
389+
padding: 10px;
390+
border-radius: 5px;
391+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
392+
z-index: 1;
393+
position: fixed;
394+
right: 1rem;
395+
top: 6rem;
396+
}
397+
398+
399+
.popupContent {
400+
display: flex;
401+
align-items: center;
402+
}
403+
404+
.checkmark {
405+
color: white;
406+
font-size: 13px;
407+
vertical-align: middle;
408+
padding-right: 0.4rem;
409+
}
410+
411+
.popupText {
412+
margin-left: 10px;
413+
}
414+
415+
.headerText{
416+
font-weight: 600;
417+
color: #242424;
418+
}
419+
.popupSubtext {
420+
font-size: smaller;
421+
color: #242424;
422+
padding-left: 1.4rem;
423+
width: 75%;
424+
425+
}
426+
427+
.closeButton {
428+
background: none;
429+
border: none;
430+
font-size: 13px;
431+
cursor: pointer;
432+
position: absolute;
433+
right: 0.8rem;
434+
}

ClientAdvisor/App/frontend/src/pages/chat/Chat.tsx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import DOMPurify from 'dompurify'
1111

1212
import styles from './Chat.module.css'
1313
import TeamAvatar from '../../assets/TeamAvatar.svg'
14+
import TickIcon from '../../assets/TickIcon.svg'
15+
import DismissIcon from '../../assets/Dismiss.svg'
1416
import { XSSAllowTags } from '../../constants/xssAllowTags'
1517

1618
import {
@@ -57,6 +59,7 @@ const Chat = () => {
5759
const [clearingChat, setClearingChat] = useState<boolean>(false)
5860
const [hideErrorDialog, { toggle: toggleErrorDialog }] = useBoolean(true)
5961
const [errorMsg, setErrorMsg] = useState<ErrorMessage | null>()
62+
const [isVisible, setIsVisible] = useState(false);
6063

6164
const errorDialogContentProps = {
6265
type: DialogType.close,
@@ -97,6 +100,19 @@ const Chat = () => {
97100
setErrorMsg(null)
98101
}, 500)
99102
}
103+
const closePopup = () => {
104+
setIsVisible(!isVisible);
105+
};
106+
107+
useEffect(() => {
108+
if (isVisible) {
109+
const timer = setTimeout(() => {
110+
setIsVisible(false);
111+
}, 4000); // Popup will disappear after 3 seconds
112+
113+
return () => clearTimeout(timer); // Cleanup the timer on component unmount
114+
}
115+
}, [isVisible]);
100116

101117
useEffect(() => {
102118
setIsLoading(appStateContext?.state.chatHistoryLoadingState === ChatHistoryLoadingState.Loading)
@@ -584,6 +600,7 @@ const Chat = () => {
584600
}
585601

586602
const newChat = () => {
603+
setIsVisible(true);
587604
setProcessMessages(messageStatus.Processing)
588605
setMessages([])
589606
setIsCitationPanelOpen(false)
@@ -716,6 +733,20 @@ const Chat = () => {
716733

717734
return (
718735
<div className={styles.container} role="main">
736+
{isVisible && (
737+
<div className={styles.popupContainer}>
738+
<div className={styles.popupContent}>
739+
<div className={styles.popupText}>
740+
<div className={styles.headerText}><span className={styles.checkmark}>
741+
<img alt="check mark" src={TickIcon} /></span>Chat saved
742+
<img alt="close icon" src={DismissIcon} className={styles.closeButton} onClick={closePopup}/>
743+
</div>
744+
<div className={styles.popupSubtext}><span className={styles.popupMsg}>Your chat history has been saved successfully!</span></div>
745+
</div>
746+
747+
</div>
748+
</div>
749+
)}
719750
{showAuthMessage ? (
720751
<Stack className={styles.chatEmptyState}>
721752
<ShieldLockRegular
@@ -938,7 +969,7 @@ const Chat = () => {
938969
</Stack.Item>
939970
)}
940971
{appStateContext?.state.isChatHistoryOpen &&
941-
appStateContext?.state.isCosmosDBAvailable?.status !== CosmosDBStatus.NotConfigured && <ChatHistoryPanel />}
972+
appStateContext?.state.isCosmosDBAvailable?.status !== CosmosDBStatus.NotConfigured && <ChatHistoryPanel isLoading={isLoading} />}
942973
</Stack>
943974
)}
944975
</div>

0 commit comments

Comments
 (0)