-
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
feat: activity actions decorator #5419
Conversation
3a2a57a
to
a705142
Compare
)} | ||
{/* TODO: [P2] Fold the ActivityActionsDecorator into the ActivityDecorator to unlock more flexibility */} | ||
<ActivityActionsDecorator activity={activity}> | ||
{activity.type === 'message' && isBasedOnSoftwareSourceCode(messageThing) && messageThing.isBasedOn.text ? ( |
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.
It feels like each of button in this 3 button set should be their own middleware.
Say...
() => next => request => {
if (activity.type === 'message' && isBasedOnSoftwareSourceCode(messageThing) && messageThing.isBasedOn.text) {
return <><ActivityViewCodeButton ... />{next(request)}</>;
}
return next(request);
}
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.
Except this is v2-style middleware, so it should return a component. We also don't want to expose activity on the request level, do we? Or, are you speaking about a dedicated middleware stack for activity actions?
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.
Dedicated middleware stack for activity actions.
I'll let future us decide which would be better. Apparently Web Chat doesn't need such functionality right now, so we'll revisit it when we have a use-case for such "decoration" mechanism. |
|
||
return { | ||
activity, | ||
livestreamingState: |
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 think we should let web devs to compute this value from activity
themselves.
Activity Actions Decorator
Changelog Entry
Added
ActivityActionsDecorator
for customizing activity actions layout, in PR #5419, by @OEvgenyActivityButton
component to be used in activity actions toolbar, in PR #5419, by @OEvgenyuseShowModal
hook for displaying custom modal dialogs, in PR #5419, by @OEvgenyDescription
This PR introduces a new decorator API that allows customizing the layout and behavior of activity actions (buttons like copy, view code, feedback etc.). The decorator provides a flexible way to modify how these actions are presented and interact with each other.
Key additions:
ActivityActionsDecorator
component for wrapping activity actionsActivityButton
component for consistent action button stylingDesign
For now activity actions decoration is handled separately from the activity decoration, but it is expected to change.
Activity is passed as a prop rather than part of the middleware request because:
Specific Changes
Added new public exports:
Created supporting middleware infrastructure:
ActivityActionsDecoratorMiddleware.ts
useActivityDecoratorRequest
hookcreateDecoratorComposer
Moved
ActivityButton
to public API for reuseAdded test covering:
Example Usage
CHANGELOG.md
Review Checklist
z-index
)package.json
andpackage-lock.json
reviewed