<commit_before>/**
 * WordPress dependencies
 */
import { __ } from '@wordpress/i18n';
import { IconButton, Button } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { withDispatch, withSelect } from '@wordpress/data';
import { compose } from '@wordpress/compose';

/**
 * @todo Use Inserter component from @wordpress/editor or similar for the "Add New Page" functionality.
 *
 * @return {Object} Story controls component.
 */
function StoryControls( { isReordering, startReordering, saveOrder, resetOrder } ) {
	if ( isReordering ) {
		return (
			<Fragment>
				<IconButton
					className="amp-story-controls-reorder-cancel"
					onClick={ resetOrder }
					icon="no-alt"
				>
					{ __( 'Cancel', 'amp' ) }
				</IconButton>
				<Button
					className="amp-story-controls-reorder-save"
					onClick={ saveOrder }
					isLarge
					isPrimary
				>
					{ __( 'Save Changes', 'amp' ) }
				</Button>
			</Fragment>
		);
	}

	return (
		<Fragment>
			<IconButton
				className="amp-story-controls-add"
				icon="insert"
				label={ __( 'Add New Page', 'amp' ) }
				onClick={ ( e ) => {
					e.preventDefault();
					// Todo: Implement.
				} }
			/>
			<IconButton
				className="amp-story-controls-reorder"
				icon="sort"
				label={ __( 'Reorder Pages', 'amp' ) }
				onClick={ startReordering }
			/>
		</Fragment>
	);
}

// Todo: Move pages and moveBlockToPosition to separate reorder component.
export default compose(
	withSelect( ( select ) => {
		const {	getBlocksByClientId	} = select( 'core/editor' );
		const { getBlockOrder, isReordering } = select( 'amp/story' );

		const pages = getBlocksByClientId( getBlockOrder() );

		return {
			pages,
			isReordering: isReordering(),
		};
	} ),
	withDispatch( ( dispatch ) => {
		const { startReordering, saveOrder, resetOrder } = dispatch( 'amp/story' );

		return {
			startReordering,
			saveOrder,
			resetOrder,
		};
	} )
)( StoryControls );<commit_msg>Remove unused prop<commit_after>/**
 * WordPress dependencies
 */
import { __ } from '@wordpress/i18n';
import { IconButton, Button } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { withDispatch, withSelect } from '@wordpress/data';
import { compose } from '@wordpress/compose';

/**
 * @todo Use Inserter component from @wordpress/editor or similar for the "Add New Page" functionality.
 *
 * @return {Object} Story controls component.
 */
function StoryControls( { isReordering, startReordering, saveOrder, resetOrder } ) {
	if ( isReordering ) {
		return (
			<Fragment>
				<IconButton
					className="amp-story-controls-reorder-cancel"
					onClick={ resetOrder }
					icon="no-alt"
				>
					{ __( 'Cancel', 'amp' ) }
				</IconButton>
				<Button
					className="amp-story-controls-reorder-save"
					onClick={ saveOrder }
					isLarge
					isPrimary
				>
					{ __( 'Save Changes', 'amp' ) }
				</Button>
			</Fragment>
		);
	}

	return (
		<Fragment>
			<IconButton
				className="amp-story-controls-add"
				icon="insert"
				label={ __( 'Add New Page', 'amp' ) }
				onClick={ ( e ) => {
					e.preventDefault();
					// Todo: Implement.
				} }
			/>
			<IconButton
				className="amp-story-controls-reorder"
				icon="sort"
				label={ __( 'Reorder Pages', 'amp' ) }
				onClick={ startReordering }
			/>
		</Fragment>
	);
}

export default compose(
	withSelect( ( select ) => {
		const { isReordering } = select( 'amp/story' );

		return {
			isReordering: isReordering(),
		};
	} ),
	withDispatch( ( dispatch ) => {
		const { startReordering, saveOrder, resetOrder } = dispatch( 'amp/story' );

		return {
			startReordering,
			saveOrder,
			resetOrder,
		};
	} )
)( StoryControls );
{'fraction_non_alphanumeric': 0.1487401788133297, 'fraction_numerical': 0.001083717149823896, 'mean_word_length': 3.1067853170189097, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3385222', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1169, 'n_words': 265}