Change public accounts pages to mount the web UI (#19319)
* Change public accounts pages to mount the web UI * Fix handling of remote usernames in routes - When logged in, serve web app - When logged out, redirect to permalink - Fix `app-body` class not being set sometimes due to name conflict * Fix missing `multiColumn` prop * Fix failing test * Use `discoverable` attribute to control indexing directives * Fix `<ColumnLoading />` not using `multiColumn` * Add `noindex` to accounts in REST API * Change noindex directive to not be rendered by default before a route is mounted * Add loading indicator for detailed status in web UI * Fix missing indicator appearing while account is loading in web UI
This commit is contained in:
		
					parent
					
						
							
								b0e3f0312c
							
						
					
				
			
			
				commit
				
					
						839f893168
					
				
			
		
					 101 changed files with 393 additions and 2468 deletions
				
			
		|  | @ -1,11 +1,10 @@ | |||
| import React from 'react'; | ||||
| import PropTypes from 'prop-types'; | ||||
| import { defineMessages, injectIntl } from 'react-intl'; | ||||
| 
 | ||||
| import Column from './column'; | ||||
| import ColumnHeader from './column_header'; | ||||
| import ColumnBackButtonSlim from '../../../components/column_back_button_slim'; | ||||
| import IconButton from '../../../components/icon_button'; | ||||
| import Column from 'mastodon/components/column'; | ||||
| import ColumnHeader from 'mastodon/components/column_header'; | ||||
| import IconButton from 'mastodon/components/icon_button'; | ||||
| import { Helmet } from 'react-helmet'; | ||||
| 
 | ||||
| const messages = defineMessages({ | ||||
|   title: { id: 'bundle_column_error.title', defaultMessage: 'Network error' }, | ||||
|  | @ -18,6 +17,7 @@ class BundleColumnError extends React.PureComponent { | |||
|   static propTypes = { | ||||
|     onRetry: PropTypes.func.isRequired, | ||||
|     intl: PropTypes.object.isRequired, | ||||
|     multiColumn: PropTypes.bool, | ||||
|   } | ||||
| 
 | ||||
|   handleRetry = () => { | ||||
|  | @ -25,16 +25,25 @@ class BundleColumnError extends React.PureComponent { | |||
|   } | ||||
| 
 | ||||
|   render () { | ||||
|     const { intl: { formatMessage } } = this.props; | ||||
|     const { multiColumn, intl: { formatMessage } } = this.props; | ||||
| 
 | ||||
|     return ( | ||||
|       <Column> | ||||
|         <ColumnHeader icon='exclamation-circle' type={formatMessage(messages.title)} /> | ||||
|         <ColumnBackButtonSlim /> | ||||
|       <Column bindToDocument={!multiColumn} label={formatMessage(messages.title)}> | ||||
|         <ColumnHeader | ||||
|           icon='exclamation-circle' | ||||
|           title={formatMessage(messages.title)} | ||||
|           showBackButton | ||||
|           multiColumn={multiColumn} | ||||
|         /> | ||||
| 
 | ||||
|         <div className='error-column'> | ||||
|           <IconButton title={formatMessage(messages.retry)} icon='refresh' onClick={this.handleRetry} size={64} /> | ||||
|           {formatMessage(messages.body)} | ||||
|         </div> | ||||
| 
 | ||||
|         <Helmet> | ||||
|           <meta name='robots' content='noindex' /> | ||||
|         </Helmet> | ||||
|       </Column> | ||||
|     ); | ||||
|   } | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ export default class ColumnLoading extends ImmutablePureComponent { | |||
|   static propTypes = { | ||||
|     title: PropTypes.oneOfType([PropTypes.node, PropTypes.string]), | ||||
|     icon: PropTypes.string, | ||||
|     multiColumn: PropTypes.bool, | ||||
|   }; | ||||
| 
 | ||||
|   static defaultProps = { | ||||
|  | @ -18,10 +19,11 @@ export default class ColumnLoading extends ImmutablePureComponent { | |||
|   }; | ||||
| 
 | ||||
|   render() { | ||||
|     let { title, icon } = this.props; | ||||
|     let { title, icon, multiColumn } = this.props; | ||||
| 
 | ||||
|     return ( | ||||
|       <Column> | ||||
|         <ColumnHeader icon={icon} title={title} multiColumn={false} focusable={false} placeholder /> | ||||
|         <ColumnHeader icon={icon} title={title} multiColumn={multiColumn} focusable={false} placeholder /> | ||||
|         <div className='scrollable' /> | ||||
|       </Column> | ||||
|     ); | ||||
|  |  | |||
|  | @ -139,11 +139,11 @@ class ColumnsArea extends ImmutablePureComponent { | |||
|   } | ||||
| 
 | ||||
|   renderLoading = columnId => () => { | ||||
|     return columnId === 'COMPOSE' ? <DrawerLoading /> : <ColumnLoading />; | ||||
|     return columnId === 'COMPOSE' ? <DrawerLoading /> : <ColumnLoading multiColumn />; | ||||
|   } | ||||
| 
 | ||||
|   renderError = (props) => { | ||||
|     return <BundleColumnError {...props} />; | ||||
|     return <BundleColumnError multiColumn {...props} />; | ||||
|   } | ||||
| 
 | ||||
|   render () { | ||||
|  |  | |||
|  | @ -11,9 +11,7 @@ import VideoModal from './video_modal'; | |||
| import BoostModal from './boost_modal'; | ||||
| import AudioModal from './audio_modal'; | ||||
| import ConfirmationModal from './confirmation_modal'; | ||||
| import SubscribedLanguagesModal from 'mastodon/features/subscribed_languages_modal'; | ||||
| import FocalPointModal from './focal_point_modal'; | ||||
| import InteractionModal from 'mastodon/features/interaction_modal'; | ||||
| import { | ||||
|   MuteModal, | ||||
|   BlockModal, | ||||
|  | @ -23,7 +21,10 @@ import { | |||
|   ListAdder, | ||||
|   CompareHistoryModal, | ||||
|   FilterModal, | ||||
|   InteractionModal, | ||||
|   SubscribedLanguagesModal, | ||||
| } from 'mastodon/features/ui/util/async-components'; | ||||
| import { Helmet } from 'react-helmet'; | ||||
| 
 | ||||
| const MODAL_COMPONENTS = { | ||||
|   'MEDIA': () => Promise.resolve({ default: MediaModal }), | ||||
|  | @ -41,8 +42,8 @@ const MODAL_COMPONENTS = { | |||
|   'LIST_ADDER': ListAdder, | ||||
|   'COMPARE_HISTORY': CompareHistoryModal, | ||||
|   'FILTER': FilterModal, | ||||
|   'SUBSCRIBED_LANGUAGES': () => Promise.resolve({ default: SubscribedLanguagesModal }), | ||||
|   'INTERACTION': () => Promise.resolve({ default: InteractionModal }), | ||||
|   'SUBSCRIBED_LANGUAGES': SubscribedLanguagesModal, | ||||
|   'INTERACTION': InteractionModal, | ||||
| }; | ||||
| 
 | ||||
| export default class ModalRoot extends React.PureComponent { | ||||
|  | @ -111,9 +112,15 @@ export default class ModalRoot extends React.PureComponent { | |||
|     return ( | ||||
|       <Base backgroundColor={backgroundColor} onClose={this.handleClose} ignoreFocus={ignoreFocus}> | ||||
|         {visible && ( | ||||
|           <BundleContainer fetchComponent={MODAL_COMPONENTS[type]} loading={this.renderLoading(type)} error={this.renderError} renderDelay={200}> | ||||
|             {(SpecificComponent) => <SpecificComponent {...props} onChangeBackgroundColor={this.setBackgroundColor} onClose={this.handleClose} ref={this.setModalRef} />} | ||||
|           </BundleContainer> | ||||
|           <> | ||||
|             <BundleContainer fetchComponent={MODAL_COMPONENTS[type]} loading={this.renderLoading(type)} error={this.renderError} renderDelay={200}> | ||||
|               {(SpecificComponent) => <SpecificComponent {...props} onChangeBackgroundColor={this.setBackgroundColor} onClose={this.handleClose} ref={this.setModalRef} />} | ||||
|             </BundleContainer> | ||||
| 
 | ||||
|             <Helmet> | ||||
|               <meta name='robots' content='noindex' /> | ||||
|             </Helmet> | ||||
|           </> | ||||
|         )} | ||||
|       </Base> | ||||
|     ); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue