-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HIGH] New UIs for better bot response #4846
Conversation
* | ||
* @see https://schema.org/Thing | ||
*/ | ||
export type SchemaOrgThing<T extends string = string> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I prefer OrgThemeSchema
@@ -0,0 +1,7 @@ | |||
export type TypeOfArray<T extends unknown[] | Array<unknown> | ReadonlyArray<unknown>> = T extends (infer I)[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to check T extends (infer I)[]
and Array<infer I>
. They are the same thing
aria-label={!ariaLabelledBy ? ariaLabel : undefined} | ||
aria-labelledby={ariaLabelledBy} | ||
className={classNames('webchat__modal-dialog', className, modalDialogStyleSet + '')} | ||
onClose={handleClose} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don' think you need to wrap onDismissRef.current
in a callback.
onClose={handleClose} | |
onClose={onDismissRef.current} |
const ModalDialogComposer = memo(({ children }: Props) => { | ||
const [renderFunctionAndDialogInit, setRenderFunctionAndDialogInit] = useState< | ||
RenderFunctionAndDialogInit | undefined | ||
>(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>(undefined); | |
>(); |
}; | ||
} | ||
|
||
// .webchat__thumb-button { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the plan with this commented out css?
|
||
'& .webchat__thumb-button__image': { | ||
/* TODO: Remove "color" if we want a different hover color. */ | ||
color: 'var(--webchat__color--accent)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Having a tokens object similar to fluent would be nice.
color: 'var(--webchat__color--accent)', | |
color: tokens.colorForegroundAccent, |
width: 16, | ||
|
||
'&:active': { | ||
// background: 'var(--pva__palette__neutral-light)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the variable scoped to pva
? Should probably remove comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I forget to remove it. 🤣
|
||
const Feedback = memo(({ voteActions }: Props) => { | ||
const [{ clearTimeout, setTimeout }] = usePonyfill(); | ||
const [selectedVoteAction, setSelectedVoteAction] = useState<VoteAction | undefined>(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [selectedVoteAction, setSelectedVoteAction] = useState<VoteAction | undefined>(undefined); | |
const [selectedVoteAction, setSelectedVoteAction] = useState<VoteAction | undefined>(); |
const [selectedVoteAction, setSelectedVoteAction] = useState<VoteAction | undefined>(undefined); | ||
const postActivity = usePostActivity(); | ||
|
||
const handleChange = useCallback<(voteAction: VoteAction) => void>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use setSelectedVoteAction
directly.
Is this feedback reactions works with CDN Bundle for vue.js project |
@compulim I want to use VoteAction to capture user's feedback to a message response. I see that clicking upvote or downvote button sends an "event" back to the server. However, where does one find the actvityId that was liked or disliked? |
Changelog Entry
Added
Description
Adding 3 new UIs:
cite:
. The citation text should be stored inactivity.entities
as Claim thingactivity.entities
withactionOption
of"upvote"
and"downvote"
will appear as thumbs up/down button in activity statusentities
containing the chose VoteActionactivity.entities
withprovider
of Project will appear in the activity statusDesign
Based on Schema.org
To encourage integration across multiple chat services, this work is heavily based on Schema.org.
CSS variables
We are slowly copying some
styleOptions
into CSS variables. This will help when we implement dark/light theme as CSS variables can be on top of media query selector.In
<Component.Composer>
, we are inserting a top-level<div style="display: contents;">
which will include all CSS variables to use under this layer. We are usingdisplay: contents
to minimize impact on layout.Markdown-it "betterLink" plug-in
We converged a lot of our custom plug-in into a
betterLink
plug-in. The design is not fully flush. Thus, this component remains internal for now.When we work on customization story of Markdown, we may open this plug-in, or provide it in another way. So our web devs can enjoy customization without worrying breaking accessibility and citation dialog.
Link definitions (a.k.a. reference-style links)
Markdown:
Before:
After:
For readability, links without a name (
This is a link[1].
) or links with same name and ID (This is a link[1][1].
) will be rendered asThis is a link[1].
rather thanThis is a link1.
This is done through CSS::before
and::after
. Thus, in the future, it will be easy for us if we decided to style it as a superscripted badge.Citation in link definitions
When clicking on a link starts with
cite:
, it will show a modal dialog.Sample activity
Design
We are using
HTMLDialogElement.showModal()
instead of a non-native modal for these reasons:We added a new
<ModalDialogComposer>
withuseShowModal()
anduseClose()
hooks. We did not fully flush our design yet. Thus, this component remains internal for now.Feedback buttons
Feedback buttons allows end-user to send feedback to the bot and potentially improve further conversation.
Sample activity
We currently only works with
actionOption
of"upvote"
and"downvote"
Design
When clicked, Web Chat will send an event activity, excerpt:
Provenance
The provenance helps the bot to identify where the origin of specific response come from.
Sample activity
Currently, the
provider
thing is expected to beProject
withname
and optionalurl
field.What is missing
The customization story on Markdown and activity status is weakened after this pull request. We will visit this area again immediately after this pull request is merged.
renderMarkdown
function), it will lose citationWhat is breaking
There is a minor cosmetic issue with activity status. Previously, we did not add
margin-top
(orpadding-top
) correctly on activity status. Thus, web devs using ouruseCreateActivityStatusRenderer
will see padding being added correctly.We may move to
gap
in short future. Thus, the padding maybe removed again.Specific Changes
-
CHANGELOG.md
Review Checklist
Browser and platform compatibilities reviewedz-index
)Documents reviewed (docs, samples, live demo)package.json
andpackage-lock.json
reviewedSecurity reviewed (no data URIs, check for nonce leak)