Skip to content

Commit

Permalink
Minor improvements / formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyanziano committed Dec 6, 2018
1 parent 63f5481 commit 2650d61
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
13 changes: 9 additions & 4 deletions packages/app/client/src/ui/editor/emulator/emulator.tsx
Expand Up @@ -57,6 +57,11 @@ import { ToolBar } from './toolbar/toolbar';

const { encode } = base64Url;

const RestartConversationOptions = {
NewUserId: 'Restart with new user ID',
SameUserId: 'Restart with same user ID'
};

export type EmulatorMode = 'transcript' | 'livechat';

interface EmulatorProps {
Expand Down Expand Up @@ -264,7 +269,7 @@ class EmulatorComponent extends React.Component<EmulatorProps, {}> {
<SplitButton
defaultLabel="Restart conversation"
buttonClass={ styles.restartIcon }
options={ ['Restart with new user ID', 'Restart with same user ID'] }
options={ [RestartConversationOptions.NewUserId, RestartConversationOptions.SameUserId] }
onClick={ this.handleStartOverClick }/>
<button
className={ `${ styles.saveTranscriptIcon } ${ styles.toolbarIcon || '' }` }
Expand Down Expand Up @@ -317,18 +322,18 @@ class EmulatorComponent extends React.Component<EmulatorProps, {}> {
this.props.enablePresentationMode(enabled);
}

private handleStartOverClick = async (option: string = 'Restart with new user ID'): Promise<void> => {
private handleStartOverClick = async (option: string = RestartConversationOptions.NewUserId): Promise<void> => {
this.props.clearLog(this.props.document.documentId);
this.props.setInspectorObjects(this.props.document.documentId, []);
switch (option) {
case 'Restart with new user ID':
case RestartConversationOptions.NewUserId:
const newUserId = uniqueIdv4();
// set new user as current on emulator facilities side
await CommandServiceImpl.remoteCall(SharedConstants.Commands.Emulator.SetCurrentUser, newUserId);
this.props.updateChat(this.props.documentId, { userId: newUserId });
break;

case 'Restart with same user ID':
case RestartConversationOptions.SameUserId:
this.startNewConversation();
break;

Expand Down
Expand Up @@ -36,7 +36,7 @@
display: flex;
flex-wrap: nowrap;
align-items: center;
height: 40px;
height: 29px;
padding-left: 12px;
background-color: var(--toolbar-bg);
border-top: var(--toolbar-border);
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/ui-react/src/media/ic_chevron_up.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -56,4 +56,4 @@
&:hover, &.selected {
background-color: var(--split-button-selected-item-bg-color);
}
}
}

0 comments on commit 2650d61

Please sign in to comment.