Skip to content

Commit cfde709

Browse files
committed
fixes
1 parent 4c581d1 commit cfde709

5 files changed

Lines changed: 28 additions & 25 deletions

File tree

packages/component/src/Activity/ActivityFeedback.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,16 @@ function ActivityFeedback({ activity }: ActivityFeedbackProps) {
6060

6161
const feedbackActions = useMemo<ReadonlySet<OrgSchemaAction>>(() => {
6262
try {
63-
const reactActions = (messageThing?.potentialAction || []).filter(
64-
({ '@type': type }) => type === 'LikeAction' || type === 'DislikeAction'
65-
);
63+
const reactActions = (messageThing?.potentialAction || [])
64+
.filter(({ '@type': type }) => type === 'LikeAction' || type === 'DislikeAction')
65+
.map(action =>
66+
Object.assign({}, action, {
67+
actionStatus:
68+
action['@type'] === selectedAction?.['@type'] && feedbackSubmitted
69+
? 'CompletedActionStatus'
70+
: action.actionStatus
71+
})
72+
);
6673

6774
if (reactActions.length) {
6875
return Object.freeze(new Set(reactActions));
@@ -77,7 +84,7 @@ function ActivityFeedback({ activity }: ActivityFeedbackProps) {
7784
// Intentionally left blank.
7885
}
7986
return Object.freeze(new Set([] as OrgSchemaAction[]));
80-
}, [graph, messageThing?.potentialAction]);
87+
}, [feedbackSubmitted, graph, messageThing?.potentialAction, selectedAction]);
8188

8289
const handleFeedbackActionClick = useCallback(
8390
(action: OrgSchemaAction) => setSelectedAction(action === selectedAction ? undefined : action),
@@ -90,13 +97,8 @@ function ActivityFeedback({ activity }: ActivityFeedbackProps) {
9097
setSelectedAction(undefined);
9198
}
9299
setFeedbackSubmitted(wasFeedbackSubmitted);
93-
setSelectedAction(
94-
Object.assign({}, selectedAction, {
95-
actionStatus: 'CompletedActionStatus'
96-
})
97-
);
98100
},
99-
[selectedAction, setFeedbackSubmitted, setSelectedAction]
101+
[setFeedbackSubmitted, setSelectedAction]
100102
);
101103

102104
const FeedbackComponent = useMemo(

packages/component/src/Activity/private/Feedback.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { hooks } from 'botframework-webchat-api';
2-
import classNames from 'classnames';
32
import { type OrgSchemaAction } from 'botframework-webchat-core';
43
import React, { Fragment, memo, useEffect, useMemo, type PropsWithChildren } from 'react';
54
import { useRefFrom } from 'use-ref-from';
@@ -48,23 +47,22 @@ const Feedback = memo(({ actions, className, isFeedbackFormSupported, onActionCl
4847

4948
const actionProps = useMemo(
5049
() =>
51-
[...actions].some(action => action.actionStatus === 'CompletedActionStatus')
50+
[...actions].some(action => action.actionStatus === 'CompletedActionStatus') ||
51+
selectedAction?.actionStatus === 'CompletedActionStatus'
5252
? {
5353
disabled: true,
5454
title: localize('VOTE_COMPLETE_ALT')
5555
}
5656
: undefined,
57-
[actions, localize]
57+
[actions, localize, selectedAction]
5858
);
5959

6060
return (
6161
<Fragment>
6262
{[...actions].map((action, index) => (
6363
<FeedbackVoteButton
6464
action={action}
65-
className={classNames(className, {
66-
'webchat__thumb-button--is-submitted': action['@type'] === 'CompletedActionStatus'
67-
})}
65+
className={className}
6866
key={action['@id'] || index}
6967
onClick={onActionClick}
7068
pressed={

packages/component/src/Styles/StyleSet/ThumbButton.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ export default function () {
2929
height: '1em',
3030
width: '1em'
3131
},
32-
'&:hover, &:active, &.webchat__thumb-button--is-pressed, .webchat__thumb-button--is-submitted': {
32+
'&:hover, &:active, &.webchat__thumb-button--is-pressed': {
3333
background: 'transparent',
34-
color: CSSTokens.ColorAccent
34+
color: CSSTokens.ColorAccent,
35+
'&:is(:hover, :focus-visible, :active) > .webchat__tooltip': {
36+
visibility: 'visible'
37+
}
3538
},
36-
37-
':not(.webchat__thumb-button--is-submitted)[aria-disabled="true"]': {
38-
color: CSSTokens.ColorSubtle
39-
}
39+
':not(.webchat__thumb-button--is-pressed)[aria-disabled="true"]:is(:hover, :focus-visible, :active) > .webchat__tooltip':
40+
{
41+
visibility: 'hidden'
42+
}
4043
},
4144

4245
'&:active': {

packages/component/src/Styles/StyleSet/Tooltip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ export default () => ({
4545
'&.webchat__tooltip--block-start': {
4646
insetBlockEnd: 'calc(100% + 7px)',
4747
insetInlineStart: '50%',
48-
transform: 'translate(-50%, 0)',
48+
transform: 'translate(-20%, 0)',
4949

5050
'&::after': {
5151
border: '1px solid var(--webchat__tooltip-background)',
5252
borderBottomLeftRadius: '2px',
5353
clipPath: 'polygon(0% 0%, 100% 100%, 0% 100%)',
5454
height: 'var(--webchat__tooltip-tip-size)',
5555
insetBlockStart: 'calc(100% - 6px)',
56-
insetInlineStart: 'calc(50% - var(--webchat__tooltip-tip-size) / 2)',
56+
insetInlineStart: 'calc(20% - var(--webchat__tooltip-tip-size) / 2)',
5757
transform: 'rotate(-45deg)',
5858
width: 'var(--webchat__tooltip-tip-size)'
5959
}

packages/fluent-theme/src/components/theme/Theme.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@
609609
outline: var(--webchat-strokeWidthThick) solid var(--webchat-colorStrokeFocus2);
610610
}
611611

612-
:not(.webchat__thumb-button--is-submitted)[aria-disabled='true'] {
612+
&[aria-disabled='true'] {
613613
color: var(--webchat-colorNeutralForegroundDisabled);
614614
}
615615
}

0 commit comments

Comments
 (0)