-
Notifications
You must be signed in to change notification settings - Fork 344
feat(content-sidebar): focused state for threaded-replies in activity-feed-v2 #4650
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
| // into Blueprint and @box/threaded-annotations components, breaking their | ||
| // styling. This file resets those rules within the v2 adapter boundary. | ||
|
|
||
| @import '../../common/variables'; | ||
|
|
||
| .bcs-NewActivityFeed { | ||
| display: flex; | ||
| flex-direction: column; | ||
|
|
@@ -52,6 +54,20 @@ | |
| &-mentionEmpty { | ||
| padding: var(--bp-space-030) var(--bp-space-040); | ||
| } | ||
|
|
||
| // Wrapper is transparent to layout; serves only as a DOM hook for the | ||
| // focused descendant selector below. The visible focus chrome (border, | ||
| // background) is painted directly onto the vendor's threaded-annotation | ||
| // card so its own border-radius, padding, and position are reused. | ||
| // Class name is CSS-modules-hashed; substring match survives bumps. | ||
| &-threadRow { | ||
| display: contents; | ||
|
|
||
| &.is-focused [class*='threadedAnnotations'] { | ||
| border-color: $bdl-box-blue-80; | ||
| background-color: rgba($bdl-box-blue, 0.04); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should use blueprint tokens |
||
| } | ||
| } | ||
| } | ||
|
|
||
| // Lets inner ellipsis truncation resolve against the sidebar width. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| */ | ||
|
|
||
| import * as React from 'react'; | ||
| import classNames from 'classnames'; | ||
| import noop from 'lodash/noop'; | ||
|
|
||
| import { ActivityFeed } from '@box/activity-feed'; | ||
|
|
@@ -30,6 +31,7 @@ import { | |
| } from '../../../constants'; | ||
|
|
||
| type FeedItemRowProps = { | ||
| activeFeedEntryId?: string; | ||
| currentUserId?: string; | ||
| fps: number; | ||
| isDisabled: boolean; | ||
|
|
@@ -81,6 +83,7 @@ const buildReplyPost = | |
| }; | ||
|
|
||
| const FeedItemRow = ({ | ||
| activeFeedEntryId, | ||
| currentUserId, | ||
| fps, | ||
| isDisabled, | ||
|
|
@@ -104,6 +107,10 @@ const FeedItemRow = ({ | |
| timeFormat, | ||
| userSelectorProps, | ||
| }: FeedItemRowProps) => { | ||
| const threadRowClassName = classNames('bcs-NewActivityFeed-threadRow', { | ||
| 'is-focused': item.id === activeFeedEntryId, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would this be always active? when would the focus turn off? is the logic inside the consumer of buie then? |
||
| }); | ||
|
|
||
| switch (item.type) { | ||
| case 'comment': { | ||
| const { permissions } = item; | ||
|
|
@@ -145,27 +152,28 @@ const FeedItemRow = ({ | |
| ? { ...item.annotationTarget, timestamp: formatByTimeFormat(timestampMs, timeFormat, fps) } | ||
| : item.annotationTarget; | ||
| return ( | ||
| <ActivityFeed.List.ThreadedAnnotation | ||
| key={item.id} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't affect rendering in any way downstream? |
||
| annotationTarget={commentAnnotationTarget} | ||
| isAnnotations={false} | ||
| isEditDisabled={isDisabled || item.isResolved} | ||
| isResolved={item.isResolved} | ||
| messages={item.messages} | ||
| onAnnotationBadgeClick={handleBadgeClick} | ||
| onAvatarClick={noop} | ||
| onCopyLink={onCommentCopyLink ? (id: string) => onCommentCopyLink({ id }) : undefined} | ||
| onDelete={handleDelete} | ||
| onEdit={handleEdit} | ||
| onEditError={logEditError} | ||
| onPost={buildReplyPost(item.id, FEED_ITEM_TYPE_COMMENT, isDisabled, onReplyCreate)} | ||
| onResolve={handleStatusChange('resolved')} | ||
| onThreadDelete={() => handleDelete(item.id)} | ||
| onUnresolve={handleStatusChange('open')} | ||
| resolvedAt={item.resolvedAt} | ||
| resolvedBy={item.resolvedBy} | ||
| userSelectorProps={userSelectorProps} | ||
| /> | ||
| <div key={item.id} className={threadRowClassName}> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have need any tests for these changes to make sure nothing breaks adding a non-semantic div around the activity item? |
||
| <ActivityFeed.List.ThreadedAnnotation | ||
| annotationTarget={commentAnnotationTarget} | ||
| isAnnotations={false} | ||
| isEditDisabled={isDisabled || item.isResolved} | ||
| isResolved={item.isResolved} | ||
| messages={item.messages} | ||
| onAnnotationBadgeClick={handleBadgeClick} | ||
| onAvatarClick={noop} | ||
| onCopyLink={onCommentCopyLink ? (id: string) => onCommentCopyLink({ id }) : undefined} | ||
| onDelete={handleDelete} | ||
| onEdit={handleEdit} | ||
| onEditError={logEditError} | ||
| onPost={buildReplyPost(item.id, FEED_ITEM_TYPE_COMMENT, isDisabled, onReplyCreate)} | ||
| onResolve={handleStatusChange('resolved')} | ||
| onThreadDelete={() => handleDelete(item.id)} | ||
| onUnresolve={handleStatusChange('open')} | ||
| resolvedAt={item.resolvedAt} | ||
| resolvedBy={item.resolvedBy} | ||
| userSelectorProps={userSelectorProps} | ||
| /> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -209,31 +217,32 @@ const FeedItemRow = ({ | |
| } | ||
| : badgeTarget; | ||
| return ( | ||
| <ActivityFeed.List.ThreadedAnnotation | ||
| key={item.id} | ||
| annotationTarget={annotationBadgeTarget} | ||
| isAnnotations={false} | ||
| isEditDisabled={isDisabled || item.isResolved} | ||
| isResolved={item.isResolved} | ||
| messages={item.messages} | ||
| onAnnotationBadgeClick={() => onAnnotationSelect?.(item.annotation)} | ||
| onAvatarClick={noop} | ||
| onCopyLink={ | ||
| onAnnotationCopyLink && fileVersionId | ||
| ? () => onAnnotationCopyLink({ annotationId: item.id, fileVersionId }) | ||
| : undefined | ||
| } | ||
| onDelete={handleDelete} | ||
| onEdit={handleEdit} | ||
| onEditError={logEditError} | ||
| onPost={buildReplyPost(item.id, FEED_ITEM_TYPE_ANNOTATION, isDisabled, onReplyCreate)} | ||
| onResolve={handleStatusChange('resolved')} | ||
| onThreadDelete={() => handleDelete(item.id)} | ||
| onUnresolve={handleStatusChange('open')} | ||
| resolvedAt={item.resolvedAt} | ||
| resolvedBy={item.resolvedBy} | ||
| userSelectorProps={userSelectorProps} | ||
| /> | ||
| <div key={item.id} className={threadRowClassName}> | ||
| <ActivityFeed.List.ThreadedAnnotation | ||
| annotationTarget={annotationBadgeTarget} | ||
| isAnnotations={false} | ||
| isEditDisabled={isDisabled || item.isResolved} | ||
| isResolved={item.isResolved} | ||
| messages={item.messages} | ||
| onAnnotationBadgeClick={() => onAnnotationSelect?.(item.annotation)} | ||
| onAvatarClick={noop} | ||
| onCopyLink={ | ||
| onAnnotationCopyLink && fileVersionId | ||
| ? () => onAnnotationCopyLink({ annotationId: item.id, fileVersionId }) | ||
| : undefined | ||
| } | ||
| onDelete={handleDelete} | ||
| onEdit={handleEdit} | ||
| onEditError={logEditError} | ||
| onPost={buildReplyPost(item.id, FEED_ITEM_TYPE_ANNOTATION, isDisabled, onReplyCreate)} | ||
| onResolve={handleStatusChange('resolved')} | ||
| onThreadDelete={() => handleDelete(item.id)} | ||
| onUnresolve={handleStatusChange('open')} | ||
| resolvedAt={item.resolvedAt} | ||
| resolvedBy={item.resolvedBy} | ||
| userSelectorProps={userSelectorProps} | ||
| /> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
|
|
||
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.
we should use bp tokens. for $bdl-box-blue-80, it should be "--bp-box-blue-80"