+
+
+
diff --git a/samples/apps/copilot-chat-app/webapp/src/components/chat/ChatWindow.tsx b/samples/apps/copilot-chat-app/webapp/src/components/chat/ChatWindow.tsx
index bbe50cb0a2ab..066a7a4a7465 100644
--- a/samples/apps/copilot-chat-app/webapp/src/components/chat/ChatWindow.tsx
+++ b/samples/apps/copilot-chat-app/webapp/src/components/chat/ChatWindow.tsx
@@ -26,59 +26,34 @@ import { ShareBotMenu } from './ShareBotMenu';
const useClasses = makeStyles({
root: {
- height: '100%',
- display: 'grid',
- gridTemplateColumns: '1fr',
- gridTemplateRows: 'auto 1fr',
- gridTemplateAreas: "'header' 'content'",
+ display: 'flex',
+ flexDirection: 'column',
width: '-webkit-fill-available',
backgroundColor: '#F5F5F5',
boxShadow: 'rgb(0 0 0 / 25%) 0 0.2rem 0.4rem -0.075rem',
},
header: {
- ...shorthands.gridArea('header'),
+ ...shorthands.borderBottom('1px', 'solid', 'rgb(0 0 0 / 10%)'),
+ ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalM),
backgroundColor: tokens.colorNeutralBackground4,
display: 'flex',
flexDirection: 'row',
- justifyContent: 'center',
- ...shorthands.borderBottom('1px', 'solid', 'rgb(0 0 0 / 10%)'),
- },
- headerContent: {
- ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalM),
- display: 'grid',
- gridTemplateColumns: '1fr auto',
- gridTemplateRows: '1fr',
- gridTemplateAreas: "'title controls'",
boxSizing: 'border-box',
width: '100%',
+ justifyContent: 'space-between',
},
title: {
- ...shorthands.gridArea('title'),
...shorthands.gap(tokens.spacingHorizontalM),
alignItems: 'center',
display: 'flex',
flexDirection: 'row',
},
controls: {
- ...shorthands.gridArea('controls'),
...shorthands.gap(tokens.spacingHorizontalM),
alignItems: 'right',
display: 'flex',
flexDirection: 'row',
},
- content: {
- ...shorthands.gridArea('content'),
- overflowY: 'auto',
- },
- contentOuter: {
- height: '100%',
- display: 'flex',
- flexDirection: 'row',
- justifyContent: 'center',
- },
- contentInner: {
- width: '100%',
- },
});
export const ChatWindow: React.FC = () => {
@@ -125,42 +100,37 @@ export const ChatWindow: React.FC = () => {
return (
-
);
};
diff --git a/samples/apps/copilot-chat-app/webapp/src/components/chat/chat-list/ChatList.tsx b/samples/apps/copilot-chat-app/webapp/src/components/chat/chat-list/ChatList.tsx
index d4209eea990c..070f298b818b 100644
--- a/samples/apps/copilot-chat-app/webapp/src/components/chat/chat-list/ChatList.tsx
+++ b/samples/apps/copilot-chat-app/webapp/src/components/chat/chat-list/ChatList.tsx
@@ -11,14 +11,21 @@ import { NewBotMenu } from './NewBotMenu';
const useClasses = makeStyles({
root: {
+ ...shorthands.overflow('hidden'),
+ display: 'flex',
width: '25%',
- minHeight: '100%',
- overflowX: 'hidden',
- overflowY: 'auto',
scrollbarWidth: 'thin',
backgroundColor: '#F0F0F0',
+ flexDirection: 'column',
+ '@media (max-width: 25%)': {
+ display: 'none',
+ },
+ },
+ list: {
+ overflowY: 'auto',
},
header: {
+ ...shorthands.padding(tokens.spacingVerticalXXS, tokens.spacingHorizontalXS),
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
@@ -26,13 +33,6 @@ const useClasses = makeStyles({
marginLeft: '1em',
alignItems: 'center',
height: '4.8em',
- '& controls': {
- ...shorthands.gap('10px'),
- display: 'flex',
- },
- },
- label: {
- marginLeft: '1em',
},
});
@@ -41,50 +41,44 @@ export const ChatList: FC = () => {
const { conversations, selectedId } = useAppSelector((state: RootState) => state.conversations);
return (
- <>
-
-
-
- Conversations
-
-
-
-
- {Object.keys(conversations).map((id) => {
- const convo = conversations[id];
- const messages = convo.messages;
- const lastMessage = convo.messages.length - 1;
- return (
-
- 0
- ? isPlan(messages[lastMessage].content)
- ? 'Click to view proposed plan'
- : (messages[lastMessage].content as string)
- : 'Click to start the chat'
- }
- botProfilePicture={convo.botProfilePicture}
- />
-
- );
- })}
-
+
+
+
+ Conversations
+
+
- >
+
+ {Object.keys(conversations).map((id) => {
+ const convo = conversations[id];
+ const messages = convo.messages;
+ const lastMessage = convo.messages.length - 1;
+ return (
+
+ 0
+ ? isPlan(messages[lastMessage].content)
+ ? 'Click to view proposed plan'
+ : (messages[lastMessage].content as string)
+ : 'Click to start the chat'
+ }
+ botProfilePicture={convo.botProfilePicture}
+ />
+
+ );
+ })}
+
+
);
};
diff --git a/samples/apps/copilot-chat-app/webapp/src/components/views/ChatView.tsx b/samples/apps/copilot-chat-app/webapp/src/components/views/ChatView.tsx
index dbca02777329..4b090a84987f 100644
--- a/samples/apps/copilot-chat-app/webapp/src/components/views/ChatView.tsx
+++ b/samples/apps/copilot-chat-app/webapp/src/components/views/ChatView.tsx
@@ -1,18 +1,15 @@
-import { makeStyles } from '@fluentui/react-components';
+import { makeStyles, shorthands } from '@fluentui/react-components';
import { FC } from 'react';
import { ChatWindow } from '../chat/ChatWindow';
import { ChatList } from '../chat/chat-list/ChatList';
const useClasses = makeStyles({
container: {
+ ...shorthands.overflow('hidden'),
display: 'flex',
flexDirection: 'row',
alignContent: 'start',
- justifyContent: 'space-between',
- width: '100%',
height: '100%',
- maxHeight: '100%',
- position: 'fixed',
},
});
diff --git a/samples/apps/copilot-chat-app/webapp/src/components/views/MissingEnvVariablesError.tsx b/samples/apps/copilot-chat-app/webapp/src/components/views/MissingEnvVariablesError.tsx
new file mode 100644
index 000000000000..da518ccb6220
--- /dev/null
+++ b/samples/apps/copilot-chat-app/webapp/src/components/views/MissingEnvVariablesError.tsx
@@ -0,0 +1,30 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+import { Body1, Subtitle1, Title3 } from '@fluentui/react-components';
+import { FC } from 'react';
+import { useClasses } from '../../App';
+
+interface IData {
+ missingVariables: string[];
+}
+
+const MissingEnvVariablesError: FC
= ({ missingVariables }) => {
+ const classes = useClasses();
+
+ return (
+
+
+ Copilot Chat
+
+
+
+ Please ensure your .env file is set up correctly with all environment variables defined in
+ env.example then restart the app.
+
+ You are missing the following variables: {missingVariables.join(', ')}
+
+
+ );
+};
+
+export default MissingEnvVariablesError;
diff --git a/samples/apps/copilot-chat-app/webapp/src/index.tsx b/samples/apps/copilot-chat-app/webapp/src/index.tsx
index e1c5faa388aa..119376ff833f 100644
--- a/samples/apps/copilot-chat-app/webapp/src/index.tsx
+++ b/samples/apps/copilot-chat-app/webapp/src/index.tsx
@@ -1,39 +1,52 @@
-import { PublicClientApplication } from '@azure/msal-browser';
+import { IPublicClientApplication, PublicClientApplication } from '@azure/msal-browser';
import { MsalProvider } from '@azure/msal-react';
import { FluentProvider, webLightTheme } from '@fluentui/react-components';
import ReactDOM from 'react-dom/client';
import { Provider as ReduxProvider } from 'react-redux';
import App from './App';
import { Constants } from './Constants';
+import MissingEnvVariablesError from './components/views/MissingEnvVariablesError';
import './index.css';
import { AuthHelper } from './libs/auth/AuthHelper';
import { store } from './redux/app/store';
import React from 'react';
+import { getMissingEnvVariables } from './checkEnv';
if (!localStorage.getItem('debug')) {
localStorage.setItem('debug', `${Constants.debug.root}:*`);
}
-const msalInstance = new PublicClientApplication(AuthHelper.msalConfig);
-
let container: HTMLElement | null = null;
-document.addEventListener('DOMContentLoaded', () => {
+
+document.addEventListener('DOMContentLoaded', async () => {
if (!container) {
container = document.getElementById('root');
if (!container) {
throw new Error('Could not find root element');
}
const root = ReactDOM.createRoot(container);
+
+ const missingEnvVariables = getMissingEnvVariables();
+ const validEnvFile = missingEnvVariables.length === 0;
+
+ var msalInstance: IPublicClientApplication | null = null;
+ if (validEnvFile) {
+ msalInstance = new PublicClientApplication(AuthHelper.msalConfig);
+ }
+
root.render(
-
-
-
-
-
-
-
+ {!validEnvFile && }
+ {validEnvFile && (
+
+
+
+
+
+
+
+ )}
,
);
}