Change share action from being in action bar to being in dropdown in web UI (#25105)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
		
							parent
							
								
									f7d93f95e1
								
							
						
					
					
						commit
						1caa5ff39e
					
				@ -114,7 +114,6 @@ class StatusActionBar extends ImmutablePureComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  handleShareClick = () => {
 | 
					  handleShareClick = () => {
 | 
				
			||||||
    navigator.share({
 | 
					    navigator.share({
 | 
				
			||||||
      text: this.props.status.get('search_index'),
 | 
					 | 
				
			||||||
      url: this.props.status.get('url'),
 | 
					      url: this.props.status.get('url'),
 | 
				
			||||||
    }).catch((e) => {
 | 
					    }).catch((e) => {
 | 
				
			||||||
      if (e.name !== 'AbortError') console.error(e);
 | 
					      if (e.name !== 'AbortError') console.error(e);
 | 
				
			||||||
@ -256,6 +255,10 @@ class StatusActionBar extends ImmutablePureComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
 | 
					    menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (publicStatus && 'share' in navigator) {
 | 
				
			||||||
 | 
					      menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (publicStatus) {
 | 
					    if (publicStatus) {
 | 
				
			||||||
      menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
 | 
					      menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -352,10 +355,6 @@ class StatusActionBar extends ImmutablePureComponent {
 | 
				
			|||||||
      reblogTitle = intl.formatMessage(messages.cannot_reblog);
 | 
					      reblogTitle = intl.formatMessage(messages.cannot_reblog);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const shareButton = ('share' in navigator) && publicStatus && (
 | 
					 | 
				
			||||||
      <IconButton className='status__action-bar__button' title={intl.formatMessage(messages.share)} icon='share-alt' onClick={this.handleShareClick} />
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const filterButton = this.props.onFilter && (
 | 
					    const filterButton = this.props.onFilter && (
 | 
				
			||||||
      <IconButton className='status__action-bar__button' title={intl.formatMessage(messages.hide)} icon='eye' onClick={this.handleHideClick} />
 | 
					      <IconButton className='status__action-bar__button' title={intl.formatMessage(messages.hide)} icon='eye' onClick={this.handleHideClick} />
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
@ -367,8 +366,6 @@ class StatusActionBar extends ImmutablePureComponent {
 | 
				
			|||||||
        <IconButton className='status__action-bar__button star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} counter={withCounters ? status.get('favourites_count') : undefined} />
 | 
					        <IconButton className='status__action-bar__button star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} counter={withCounters ? status.get('favourites_count') : undefined} />
 | 
				
			||||||
        <IconButton className='status__action-bar__button bookmark-icon' disabled={!signedIn} active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} />
 | 
					        <IconButton className='status__action-bar__button bookmark-icon' disabled={!signedIn} active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        {shareButton}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        {filterButton}
 | 
					        {filterButton}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div className='status__action-bar__dropdown'>
 | 
					        <div className='status__action-bar__dropdown'>
 | 
				
			||||||
 | 
				
			|||||||
@ -165,7 +165,6 @@ class Header extends ImmutablePureComponent {
 | 
				
			|||||||
    const { account } = this.props;
 | 
					    const { account } = this.props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    navigator.share({
 | 
					    navigator.share({
 | 
				
			||||||
      text: `${titleFromAccount(account)}\n${account.get('note_plain')}`,
 | 
					 | 
				
			||||||
      url: account.get('url'),
 | 
					      url: account.get('url'),
 | 
				
			||||||
    }).catch((e) => {
 | 
					    }).catch((e) => {
 | 
				
			||||||
      if (e.name !== 'AbortError') console.error(e);
 | 
					      if (e.name !== 'AbortError') console.error(e);
 | 
				
			||||||
 | 
				
			|||||||
@ -169,7 +169,6 @@ class ActionBar extends PureComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  handleShare = () => {
 | 
					  handleShare = () => {
 | 
				
			||||||
    navigator.share({
 | 
					    navigator.share({
 | 
				
			||||||
      text: this.props.status.get('search_index'),
 | 
					 | 
				
			||||||
      url: this.props.status.get('url'),
 | 
					      url: this.props.status.get('url'),
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
@ -202,6 +201,11 @@ class ActionBar extends PureComponent {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
 | 
					      menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if ('share' in navigator) {
 | 
				
			||||||
 | 
					        menu.push({ text: intl.formatMessage(messages.share), action: this.handleShare });
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
 | 
					      menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
 | 
				
			||||||
      menu.push(null);
 | 
					      menu.push(null);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -260,10 +264,6 @@ class ActionBar extends PureComponent {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const shareButton = ('share' in navigator) && publicStatus && (
 | 
					 | 
				
			||||||
      <div className='detailed-status__button'><IconButton title={intl.formatMessage(messages.share)} icon='share-alt' onClick={this.handleShare} /></div>
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    let replyIcon;
 | 
					    let replyIcon;
 | 
				
			||||||
    if (status.get('in_reply_to_id', null) === null) {
 | 
					    if (status.get('in_reply_to_id', null) === null) {
 | 
				
			||||||
      replyIcon = 'reply';
 | 
					      replyIcon = 'reply';
 | 
				
			||||||
@ -287,12 +287,10 @@ class ActionBar extends PureComponent {
 | 
				
			|||||||
    return (
 | 
					    return (
 | 
				
			||||||
      <div className='detailed-status__action-bar'>
 | 
					      <div className='detailed-status__action-bar'>
 | 
				
			||||||
        <div className='detailed-status__button'><IconButton title={intl.formatMessage(messages.reply)} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} /></div>
 | 
					        <div className='detailed-status__button'><IconButton title={intl.formatMessage(messages.reply)} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} /></div>
 | 
				
			||||||
        <div className='detailed-status__button' ><IconButton className={classNames({ reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} title={reblogTitle} icon='retweet' onClick={this.handleReblogClick} /></div>
 | 
					        <div className='detailed-status__button'><IconButton className={classNames({ reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} title={reblogTitle} icon='retweet' onClick={this.handleReblogClick} /></div>
 | 
				
			||||||
        <div className='detailed-status__button'><IconButton className='star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} /></div>
 | 
					        <div className='detailed-status__button'><IconButton className='star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} /></div>
 | 
				
			||||||
        <div className='detailed-status__button'><IconButton className='bookmark-icon' disabled={!signedIn} active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} /></div>
 | 
					        <div className='detailed-status__button'><IconButton className='bookmark-icon' disabled={!signedIn} active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} /></div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        {shareButton}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        <div className='detailed-status__action-bar-dropdown'>
 | 
					        <div className='detailed-status__action-bar-dropdown'>
 | 
				
			||||||
          <DropdownMenuContainer size={18} icon='ellipsis-h' disabled={!signedIn} status={status} items={menu} direction='left' title={intl.formatMessage(messages.more)} />
 | 
					          <DropdownMenuContainer size={18} icon='ellipsis-h' disabled={!signedIn} status={status} items={menu} direction='left' title={intl.formatMessage(messages.more)} />
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user