Download wp-calypso/client/reader/stream/post-unavailable.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/reader/stream/post-unavailable.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/reader/stream/post-unavailable.jsx
-
curl -L -o post-unavailable.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/reader/stream/post-unavailable.jsx
1.34 kB
| import config from '@automattic/calypso-config'; | |
| import { Card } from '@automattic/components'; | |
| import { localize } from 'i18n-calypso'; | |
| import { PureComponent } from 'react'; | |
| class PostUnavailable extends PureComponent { | |
| render() { | |
| const error = this.props.post.error; | |
| if ( ! error ) { | |
| return null; | |
| } | |
| if ( error.status === 404 || error.error === 404 ) { | |
| // don't render a card for 404s. These are posts that we once had but were deleted. | |
| return null; | |
| } | |
| const message = error.message || this.props.translate( 'An error occurred loading this post.' ); | |
| /* eslint-disable wpcalypso/jsx-classname-namespace */ | |
| return ( | |
| <Card tagName="article" className="reader__card is-error"> | |
| <div className="reader__post-header"> | |
| <h1 className="reader__post-title"> | |
| <div className="reader__post-title-link"> | |
| <span className="reader__placeholder-text">Oops!</span> | |
| </div> | |
| </h1> | |
| </div> | |
| <div className="reader__post-excerpt"> | |
| <p> | |
| { error.status ? `${ error.status }: ` : null } | |
| { message } | |
| </p> | |
| { config.isEnabled( 'reader/full-errors' ) ? ( | |
| <pre>{ JSON.stringify( this.props.post, null, ' ' ) }</pre> | |
| ) : null } | |
| </div> | |
| </Card> | |
| ); | |
| /* eslint-enable wpcalypso/jsx-classname-namespace */ | |
| } | |
| } | |
| export default localize( PostUnavailable ); | |