Add trends to public pages sidebar (#11594)
This commit is contained in:
		
							parent
							
								
									96702e7f67
								
							
						
					
					
						commit
						c6b4b923e6
					
				@ -7,6 +7,7 @@ import MediaGallery from '../components/media_gallery';
 | 
				
			|||||||
import Video from '../features/video';
 | 
					import Video from '../features/video';
 | 
				
			||||||
import Card from '../features/status/components/card';
 | 
					import Card from '../features/status/components/card';
 | 
				
			||||||
import Poll from 'mastodon/components/poll';
 | 
					import Poll from 'mastodon/components/poll';
 | 
				
			||||||
 | 
					import Hashtag from 'mastodon/components/hashtag';
 | 
				
			||||||
import ModalRoot from '../components/modal_root';
 | 
					import ModalRoot from '../components/modal_root';
 | 
				
			||||||
import { getScrollbarWidth } from '../features/ui/components/modal_root';
 | 
					import { getScrollbarWidth } from '../features/ui/components/modal_root';
 | 
				
			||||||
import MediaModal from '../features/ui/components/media_modal';
 | 
					import MediaModal from '../features/ui/components/media_modal';
 | 
				
			||||||
@ -15,7 +16,7 @@ import { List as ImmutableList, fromJS } from 'immutable';
 | 
				
			|||||||
const { localeData, messages } = getLocale();
 | 
					const { localeData, messages } = getLocale();
 | 
				
			||||||
addLocaleData(localeData);
 | 
					addLocaleData(localeData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const MEDIA_COMPONENTS = { MediaGallery, Video, Card, Poll };
 | 
					const MEDIA_COMPONENTS = { MediaGallery, Video, Card, Poll, Hashtag };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class MediaContainer extends PureComponent {
 | 
					export default class MediaContainer extends PureComponent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -62,12 +63,13 @@ export default class MediaContainer extends PureComponent {
 | 
				
			|||||||
          {[].map.call(components, (component, i) => {
 | 
					          {[].map.call(components, (component, i) => {
 | 
				
			||||||
            const componentName = component.getAttribute('data-component');
 | 
					            const componentName = component.getAttribute('data-component');
 | 
				
			||||||
            const Component = MEDIA_COMPONENTS[componentName];
 | 
					            const Component = MEDIA_COMPONENTS[componentName];
 | 
				
			||||||
            const { media, card, poll, ...props } = JSON.parse(component.getAttribute('data-props'));
 | 
					            const { media, card, poll, hashtag, ...props } = JSON.parse(component.getAttribute('data-props'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Object.assign(props, {
 | 
					            Object.assign(props, {
 | 
				
			||||||
              ...(media   ? { media:   fromJS(media)   } : {}),
 | 
					              ...(media   ? { media:   fromJS(media)   } : {}),
 | 
				
			||||||
              ...(card    ? { card:    fromJS(card)    } : {}),
 | 
					              ...(card    ? { card:    fromJS(card)    } : {}),
 | 
				
			||||||
              ...(poll    ? { poll:    fromJS(poll)    } : {}),
 | 
					              ...(poll    ? { poll:    fromJS(poll)    } : {}),
 | 
				
			||||||
 | 
					              ...(hashtag ? { hashtag: fromJS(hashtag) } : {}),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              ...(componentName === 'Video' ? {
 | 
					              ...(componentName === 'Video' ? {
 | 
				
			||||||
                onOpenVideo: this.handleOpenVideo,
 | 
					                onOpenVideo: this.handleOpenVideo,
 | 
				
			||||||
@ -81,6 +83,7 @@ export default class MediaContainer extends PureComponent {
 | 
				
			|||||||
              component,
 | 
					              component,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
          })}
 | 
					          })}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          <ModalRoot onClose={this.handleCloseMedia}>
 | 
					          <ModalRoot onClose={this.handleCloseMedia}>
 | 
				
			||||||
            {this.state.media && (
 | 
					            {this.state.media && (
 | 
				
			||||||
              <MediaModal
 | 
					              <MediaModal
 | 
				
			||||||
 | 
				
			|||||||
@ -100,6 +100,16 @@
 | 
				
			|||||||
      background-size: 44px 44px;
 | 
					      background-size: 44px 44px;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .trends__item {
 | 
				
			||||||
 | 
					    padding: 10px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.trends-widget {
 | 
				
			||||||
 | 
					  h4 {
 | 
				
			||||||
 | 
					    color: $darker-text-color;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.box-widget {
 | 
					.box-widget {
 | 
				
			||||||
 | 
				
			|||||||
@ -4,3 +4,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  .hero-widget__text
 | 
					  .hero-widget__text
 | 
				
			||||||
    %p= @instance_presenter.site_short_description.html_safe.presence || @instance_presenter.site_description.html_safe.presence || t('about.generic_description', domain: site_hostname)
 | 
					    %p= @instance_presenter.site_short_description.html_safe.presence || @instance_presenter.site_description.html_safe.presence || t('about.generic_description', domain: site_hostname)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- if Setting.trends
 | 
				
			||||||
 | 
					  - trends = TrendingTags.get(3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - unless trends.empty?
 | 
				
			||||||
 | 
					    .endorsements-widget.trends-widget
 | 
				
			||||||
 | 
					      %h4.emojify= t('footer.trending_now')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - trends.each do |tag|
 | 
				
			||||||
 | 
					        = react_component :hashtag, hashtag: ActiveModelSerializers::SerializableResource.new(tag, serializer: REST::TagSerializer).as_json
 | 
				
			||||||
 | 
				
			|||||||
@ -687,6 +687,7 @@ en:
 | 
				
			|||||||
    developers: Developers
 | 
					    developers: Developers
 | 
				
			||||||
    more: More…
 | 
					    more: More…
 | 
				
			||||||
    resources: Resources
 | 
					    resources: Resources
 | 
				
			||||||
 | 
					    trending_now: Trending now
 | 
				
			||||||
  generic:
 | 
					  generic:
 | 
				
			||||||
    all: All
 | 
					    all: All
 | 
				
			||||||
    changes_saved_msg: Changes successfully saved!
 | 
					    changes_saved_msg: Changes successfully saved!
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user