Grouped Notifications UI (#30440)
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com> Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
		
					parent
					
						
							
								7d090b2ab6
							
						
					
				
			
			
				commit
				
					
						f587ff643f
					
				
			
		
					 65 changed files with 3329 additions and 131 deletions
				
			
		|  | @ -9,18 +9,18 @@ const messages = defineMessages({ | |||
|   load_more: { id: 'status.load_more', defaultMessage: 'Load more' }, | ||||
| }); | ||||
| 
 | ||||
| interface Props { | ||||
| interface Props<T> { | ||||
|   disabled: boolean; | ||||
|   maxId: string; | ||||
|   onClick: (maxId: string) => void; | ||||
|   param: T; | ||||
|   onClick: (params: T) => void; | ||||
| } | ||||
| 
 | ||||
| export const LoadGap: React.FC<Props> = ({ disabled, maxId, onClick }) => { | ||||
| export const LoadGap = <T,>({ disabled, param, onClick }: Props<T>) => { | ||||
|   const intl = useIntl(); | ||||
| 
 | ||||
|   const handleClick = useCallback(() => { | ||||
|     onClick(maxId); | ||||
|   }, [maxId, onClick]); | ||||
|     onClick(param); | ||||
|   }, [param, onClick]); | ||||
| 
 | ||||
|   return ( | ||||
|     <button | ||||
|  |  | |||
|  | @ -116,6 +116,8 @@ class Status extends ImmutablePureComponent { | |||
|     cacheMediaWidth: PropTypes.func, | ||||
|     cachedMediaWidth: PropTypes.number, | ||||
|     scrollKey: PropTypes.string, | ||||
|     skipPrepend: PropTypes.bool, | ||||
|     avatarSize: PropTypes.number, | ||||
|     deployPictureInPicture: PropTypes.func, | ||||
|     pictureInPicture: ImmutablePropTypes.contains({ | ||||
|       inUse: PropTypes.bool, | ||||
|  | @ -353,7 +355,7 @@ class Status extends ImmutablePureComponent { | |||
|   }; | ||||
| 
 | ||||
|   render () { | ||||
|     const { intl, hidden, featured, unread, showThread, scrollKey, pictureInPicture, previousId, nextInReplyToId, rootId } = this.props; | ||||
|     const { intl, hidden, featured, unread, showThread, scrollKey, pictureInPicture, previousId, nextInReplyToId, rootId, skipPrepend, avatarSize = 46 } = this.props; | ||||
| 
 | ||||
|     let { status, account, ...other } = this.props; | ||||
| 
 | ||||
|  | @ -539,7 +541,7 @@ class Status extends ImmutablePureComponent { | |||
|     } | ||||
| 
 | ||||
|     if (account === undefined || account === null) { | ||||
|       statusAvatar = <Avatar account={status.get('account')} size={46} />; | ||||
|       statusAvatar = <Avatar account={status.get('account')} size={avatarSize} />; | ||||
|     } else { | ||||
|       statusAvatar = <AvatarOverlay account={status.get('account')} friend={account} />; | ||||
|     } | ||||
|  | @ -550,7 +552,7 @@ class Status extends ImmutablePureComponent { | |||
|     return ( | ||||
|       <HotKeys handlers={handlers}> | ||||
|         <div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), unread, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText)} ref={this.handleRef} data-nosnippet={status.getIn(['account', 'noindex'], true) || undefined}> | ||||
|           {prepend} | ||||
|           {!skipPrepend && prepend} | ||||
| 
 | ||||
|           <div className={classNames('status', `status-${status.get('visibility')}`, { 'status-reply': !!status.get('in_reply_to_id'), 'status--in-thread': !!rootId, 'status--first-in-thread': previousId && (!connectUp || connectToRoot), muted: this.props.muted })} data-id={status.get('id')}> | ||||
|             {(connectReply || connectUp || connectToRoot) && <div className={classNames('status__line', { 'status__line--full': connectReply, 'status__line--first': !status.get('in_reply_to_id') && !connectToRoot })} />} | ||||
|  |  | |||
|  | @ -107,7 +107,7 @@ export default class StatusList extends ImmutablePureComponent { | |||
|             <LoadGap | ||||
|               key={'gap:' + statusIds.get(index + 1)} | ||||
|               disabled={isLoading} | ||||
|               maxId={index > 0 ? statusIds.get(index - 1) : null} | ||||
|               param={index > 0 ? statusIds.get(index - 1) : null} | ||||
|               onClick={onLoadMore} | ||||
|             /> | ||||
|           ); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue