Skip to content

Commit e92279e

Browse files
authored
Attachments background and fonts handled when WC will be bumped to 4.8 (#2088)
* Attachments background and fonts handled when WC will be bumped to Signed-off-by: Srinaath Ravichandran <[email protected]> * Changelogs updated
1 parent 6b8b532 commit e92279e

File tree

5 files changed

+27
-38
lines changed

5 files changed

+27
-38
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- [build] Changed one-click installer to assisted installer with new graphics. Also updated application icon in PR [2077](https://github.com/microsoft/BotFramework-Emulator/pull/2077)
2424
- [build] Locked `[email protected]` to avoid unecessary import linting changes in PR [2081](https://github.com/microsoft/BotFramework-Emulator/pull/2081)
2525
- [client] Thrown errors in client-side sagas will now be logged in their entirety to the dev tools console in PR [2087](https://github.com/microsoft/BotFramework-Emulator/pull/2087)
26+
- [client] Upload and download attachments bubble texts and background in webchat were hidden. The adjustments have been made to override FileContent class in PR [2088](https://github.com/microsoft/BotFramework-Emulator/pull/2088)
27+
2628

2729
## Removed
2830
- [client/main] Removed legacy payments code in PR [2058](https://github.com/microsoft/BotFramework-Emulator/pull/2058)

packages/app/client/src/ui/editor/emulator/parts/chat/chat.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
//
3333

3434
:export { bubbleContentColor: var(--bubble-text-color); }
35+
:export { bubbleBackground: var(--webchat-user-bubble-bg); }
3536

3637
.chat {
3738
background-color: white;

packages/app/client/src/ui/editor/emulator/parts/chat/chat.scss.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// This is a generated file. Changes are likely to result in being overwritten
22
export const bubbleContentColor: string;
3+
export const bubbleBackground: string;
34
export const chat: string;
45
export const disconnected: string;
56
export const chatActivity: string;

packages/app/client/src/ui/editor/emulator/parts/chat/chat.spec.tsx

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jest.mock('./chat.scss', () => ({
5959
get bubbleContentColor() {
6060
return '#fff';
6161
},
62+
get bubbleBackground() {
63+
return '#ff0000';
64+
},
6265
}));
6366

6467
jest.mock('electron', () => ({
@@ -156,24 +159,14 @@ describe('<ChatContainer />', () => {
156159
const webChat = wrapper.find(ReactWebChat);
157160
const styleSet = createStyleSet({ ...webChatStyleOptions });
158161

159-
styleSet.uploadButton = {
160-
...styleSet.uploadButton,
161-
padding: '1px',
162-
};
163-
164-
styleSet.uploadAttachment = {
165-
...styleSet.uploadAttachment,
166-
'& > .name, & > .size': {
167-
color: '#fff',
168-
},
169-
};
170-
171-
const mutatedDownloadAttachment = {
172-
...styleSet.downloadAttachment,
162+
styleSet.fileContent = {
163+
...styleSet.fileContent,
164+
background: '#ff0000',
165+
'& .webchat__fileContent__badge': { padding: '4px' },
166+
'& .webchat__fileContent__downloadIcon': { fill: '#fff' },
167+
'& .webchat__fileContent__fileName': { color: '#fff' },
168+
'& .webchat__fileContent__size': { color: '#fff' },
173169
};
174-
mutatedDownloadAttachment['& > a']['& > .details']['& > .name'].color = '#fff';
175-
mutatedDownloadAttachment['& > a']['& > .icon'].fill = '#fff';
176-
styleSet.downloadAttachment = mutatedDownloadAttachment;
177170

178171
expect(webChat.exists()).toBe(true);
179172
const wcProps = webChat.props();

packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,6 @@ interface ChatState {
6565
highlightedActivities?: Activity[];
6666
}
6767

68-
const updateDownloadAttachmentStyle = downloadAttachment => {
69-
try {
70-
const mutatedDownloadAttachment = {
71-
...downloadAttachment,
72-
};
73-
mutatedDownloadAttachment['& > a']['& > .details']['& > .name'].color = styles.bubbleContentColor;
74-
mutatedDownloadAttachment['& > a']['& > .icon'].fill = styles.bubbleContentColor;
75-
return mutatedDownloadAttachment;
76-
} catch {
77-
return downloadAttachment;
78-
}
79-
};
80-
8168
export class Chat extends PureComponent<ChatProps, ChatState> {
8269
public state = { waitForSpeechToken: false } as ChatState;
8370
private activityMap: { [activityId: string]: Activity } = {};
@@ -101,17 +88,22 @@ export class Chat extends PureComponent<ChatProps, ChatState> {
10188
const styleSet = createStyleSet({ ...webChatStyleOptions, hideSendBox: isDisabled });
10289

10390
// Overriding default styles of webchat as these properties are not exposed directly
104-
styleSet.uploadButton = {
105-
...styleSet.uploadButton,
106-
padding: '1px',
107-
};
108-
styleSet.uploadAttachment = {
109-
...styleSet.uploadAttachment,
110-
'& > .name, & > .size': {
91+
styleSet.fileContent = {
92+
...styleSet.fileContent,
93+
background: styles.bubbleBackground,
94+
'& .webchat__fileContent__fileName': {
11195
color: styles.bubbleContentColor,
11296
},
97+
'& .webchat__fileContent__size': {
98+
color: styles.bubbleContentColor,
99+
},
100+
'& .webchat__fileContent__downloadIcon': {
101+
fill: styles.bubbleContentColor,
102+
},
103+
'& .webchat__fileContent__badge': {
104+
padding: '4px',
105+
},
113106
};
114-
styleSet.downloadAttachment = updateDownloadAttachmentStyle(styleSet.downloadAttachment);
115107

116108
if (directLine) {
117109
const bot = {

0 commit comments

Comments
 (0)