| 
									
										
										
										
											2018-02-09 22:55:11 -08:00
										 |  |  | <div class="status-toolbar {{isStatusInOwnThread ? 'status-in-own-thread' : ''}}"> | 
					
						
							| 
									
										
										
										
											2018-01-28 12:51:48 -08:00
										 |  |  |   <IconButton | 
					
						
							|  |  |  |     label="Reply" | 
					
						
							|  |  |  |     href="#fa-reply" | 
					
						
							|  |  |  |     /> | 
					
						
							|  |  |  |   <IconButton | 
					
						
							| 
									
										
										
										
											2018-02-19 10:34:36 -08:00
										 |  |  |     label="{{boostLabel}}" | 
					
						
							|  |  |  |     pressable="{{!boostDisabled}}" | 
					
						
							| 
									
										
										
										
											2018-01-28 12:51:48 -08:00
										 |  |  |     pressed="{{status.reblogged}}" | 
					
						
							| 
									
										
										
										
											2018-02-19 10:34:36 -08:00
										 |  |  |     disabled="{{boostDisabled}}" | 
					
						
							|  |  |  |     href="{{boostIcon}}" | 
					
						
							| 
									
										
										
										
											2018-01-28 12:51:48 -08:00
										 |  |  |   /> | 
					
						
							|  |  |  |   <IconButton | 
					
						
							|  |  |  |     label="Favorite" | 
					
						
							|  |  |  |     pressable="true" | 
					
						
							| 
									
										
										
										
											2018-02-23 18:23:36 -08:00
										 |  |  |     pressed="{{favorited}}" | 
					
						
							| 
									
										
										
										
											2018-01-28 12:51:48 -08:00
										 |  |  |     href="#fa-star" | 
					
						
							| 
									
										
										
										
											2018-02-24 14:49:28 -08:00
										 |  |  |     delegateKey="{{favoriteKey}}" | 
					
						
							|  |  |  |     ref:favoriteNode | 
					
						
							| 
									
										
										
										
											2018-01-28 12:51:48 -08:00
										 |  |  |     /> | 
					
						
							|  |  |  |   <IconButton | 
					
						
							|  |  |  |     label="Show more actions" | 
					
						
							|  |  |  |     href="#fa-ellipsis-h" | 
					
						
							|  |  |  |   /> | 
					
						
							| 
									
										
										
										
											2018-01-20 21:42:46 -08:00
										 |  |  | </div> | 
					
						
							|  |  |  | <style> | 
					
						
							|  |  |  |   .status-toolbar { | 
					
						
							| 
									
										
										
										
											2018-02-09 20:07:48 -08:00
										 |  |  |     grid-area: toolbar; | 
					
						
							| 
									
										
										
										
											2018-01-20 21:42:46 -08:00
										 |  |  |     display: flex; | 
					
						
							|  |  |  |     justify-content: space-between; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-02-09 22:55:11 -08:00
										 |  |  |   .status-toolbar.status-in-own-thread { | 
					
						
							|  |  |  |     margin-left: 58px; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-01-20 21:42:46 -08:00
										 |  |  | </style> | 
					
						
							|  |  |  | <script> | 
					
						
							| 
									
										
										
										
											2018-01-28 12:51:48 -08:00
										 |  |  |   import IconButton from '../IconButton.html' | 
					
						
							| 
									
										
										
										
											2018-02-23 18:23:36 -08:00
										 |  |  |   import { store } from '../../_store/store' | 
					
						
							| 
									
										
										
										
											2018-02-24 14:49:28 -08:00
										 |  |  |   import { registerDelegate, unregisterDelegate } from '../../_utils/delegate' | 
					
						
							|  |  |  |   import { setFavorited } from '../../_actions/favorite' | 
					
						
							| 
									
										
										
										
											2018-01-28 12:51:48 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-20 21:42:46 -08:00
										 |  |  |   export default { | 
					
						
							| 
									
										
										
										
											2018-02-24 14:49:28 -08:00
										 |  |  |     oncreate() { | 
					
						
							|  |  |  |       this.onFavoriteClick = this.onFavoriteClick.bind(this) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       let favoriteKey = this.get('favoriteKey') | 
					
						
							|  |  |  |       registerDelegate('click', favoriteKey, this.onFavoriteClick) | 
					
						
							|  |  |  |       registerDelegate('keydown', favoriteKey, this.onFavoriteClick) | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     ondestroy() { | 
					
						
							|  |  |  |       let favoriteKey = this.get('favoriteKey') | 
					
						
							|  |  |  |       unregisterDelegate('click', favoriteKey, this.onFavoriteClick) | 
					
						
							|  |  |  |       unregisterDelegate('keydown', favoriteKey, this.onFavoriteClick) | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-01-28 12:51:48 -08:00
										 |  |  |     components: { | 
					
						
							|  |  |  |       IconButton | 
					
						
							| 
									
										
										
										
											2018-02-19 10:34:36 -08:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-02-23 18:23:36 -08:00
										 |  |  |     store: () => store, | 
					
						
							| 
									
										
										
										
											2018-02-24 14:49:28 -08:00
										 |  |  |     methods: { | 
					
						
							|  |  |  |       onFavoriteClick() { | 
					
						
							|  |  |  |         let statusId = this.get('statusId') | 
					
						
							|  |  |  |         let favorited = this.get('favorited') | 
					
						
							|  |  |  |         /* no await */ setFavorited(statusId, !favorited) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-02-19 10:34:36 -08:00
										 |  |  |     computed: { | 
					
						
							|  |  |  |       visibility: (status) => status.visibility, | 
					
						
							|  |  |  |       boostLabel: (visibility) => { | 
					
						
							|  |  |  |         switch (visibility) { | 
					
						
							|  |  |  |           case 'private': | 
					
						
							|  |  |  |             return 'Cannot be boosted because this is followers-only' | 
					
						
							|  |  |  |           case 'direct': | 
					
						
							|  |  |  |             return 'Cannot be boosted because this is a direct message' | 
					
						
							|  |  |  |           default: | 
					
						
							|  |  |  |             return 'Boost' | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       boostIcon: (visibility) => { | 
					
						
							|  |  |  |         switch (visibility) { | 
					
						
							|  |  |  |           case 'private': | 
					
						
							|  |  |  |             return '#fa-lock' | 
					
						
							|  |  |  |           case 'direct': | 
					
						
							|  |  |  |             return '#fa-envelope' | 
					
						
							|  |  |  |           default: | 
					
						
							|  |  |  |             return '#fa-retweet' | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       boostDisabled: (visibility) => { | 
					
						
							|  |  |  |         return visibility === 'private' || visibility === 'direct' | 
					
						
							| 
									
										
										
										
											2018-02-23 18:23:36 -08:00
										 |  |  |       }, | 
					
						
							|  |  |  |       favorited: (status, $currentStatusModifications) => { | 
					
						
							|  |  |  |         if ($currentStatusModifications && status.id in $currentStatusModifications.favorites) { | 
					
						
							|  |  |  |           return $currentStatusModifications.favorites[status.id] | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         return status.favourited | 
					
						
							| 
									
										
										
										
											2018-02-24 14:49:28 -08:00
										 |  |  |       }, | 
					
						
							|  |  |  |       statusId: (status) => status.id, | 
					
						
							|  |  |  |       favoriteKey: (statusId, timelineType, timelineValue) => `fav-${timelineType}-${timelineValue}-${statusId}` | 
					
						
							| 
									
										
										
										
											2018-01-28 12:51:48 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-01-20 21:42:46 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | </script> |