Skip to content

Commit

Permalink
Imports: Add the UI for the Squarespace importer (#26609)
Browse files Browse the repository at this point in the history
* Imports: Add the UI for the Squarespace importer

Although the Squarespace export is in WXR format so can be imported
using the WordPress importer, this sets up the UI so the import can be
identified as from Squarespace, and sets the stage for us to do further
preprocessing on the file.

* Rebase after importer header refactor

The `importer-header` component had a much needed refactor. This meant
that the Squarespace logo needed to be added to the options for importer
icons.
  • Loading branch information
pablinos authored Aug 21, 2018
1 parent 06c8618 commit a20f92f
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/my-sites/importer/importer-logo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import SocialLogo from 'social-logos';
import SiteImporterLogo from './site-importer/logo';

const ImporterLogo = ( { icon } ) => {
if ( includes( [ 'wordpress', 'medium', 'blogger-alt' ], icon ) ) {
if ( includes( [ 'wordpress', 'medium', 'blogger-alt', 'squarespace' ], icon ) ) {
return <SocialLogo className="importer__service-icon" icon={ icon } size={ 48 } />;
}

Expand Down
84 changes: 84 additions & 0 deletions client/my-sites/importer/importer-squarespace.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/** @format */

/**
* External dependencies
*/

import PropTypes from 'prop-types';
import React from 'react';
import { localize } from 'i18n-calypso';

/**
* Internal dependencies
*/
import FileImporter from './file-importer';
import InlineSupportLink from 'components/inline-support-link';

const importerName = 'Squarespace';

class ImporterSquarespace extends React.PureComponent {
static displayName = 'ImporterSquarespace';

static propTypes = {
site: PropTypes.shape( {
title: PropTypes.string.isRequired,
} ).isRequired,
importerStatus: PropTypes.shape( {
filename: PropTypes.string,
importerState: PropTypes.string.isRequired,
errorData: PropTypes.shape( {
type: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
} ),
percentComplete: PropTypes.number,
siteTitle: PropTypes.string.isRequired,
statusMessage: PropTypes.string,
} ),
};

render() {
const importerData = {
title: importerName,
icon: 'squarespace',
description: this.props.translate(
'Import posts, pages, comments, tags, and images from a %(importerName)s export file.',
{
args: {
importerName,
},
}
),
uploadDescription: this.props.translate(
'To import content from a %(importerName)s site to ' +
'{{b}}%(siteTitle)s{{/b}}, upload your ' +
'{{b}}%(importerName)s export file{{/b}} here. ' +
"Don't have one, or don't know where to find one? " +
'Get step by step instructions in our {{inlineSupportLink/}}.',
{
args: {
importerName,
siteTitle: this.props.site.title,
},
components: {
b: <strong />,
inlineSupportLink: (
<InlineSupportLink
supportPostId={ 87696 }
supportLink={ 'https://en.support.wordpress.com/import/import-from-squarespace' }
text={ this.props.translate( '%(importerName)s import guide', {
args: {
importerName,
},
} ) }
showIcon={ false }
/>
),
},
}
),
};
return <FileImporter importerData={ importerData } { ...this.props } />;
}
}

export default localize( ImporterSquarespace );
3 changes: 3 additions & 0 deletions client/my-sites/importer/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
&.site-importer {
background-color: #faad4d;
}
&.squarespace {
background-color: #222;
}

@include breakpoint( '>960px' ) {
width: 56px;
Expand Down
15 changes: 14 additions & 1 deletion client/my-sites/site-settings/section-import.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@ import WordPressImporter from 'my-sites/importer/importer-wordpress';
import MediumImporter from 'my-sites/importer/importer-medium';
import BloggerImporter from 'my-sites/importer/importer-blogger';
import SiteImporter from 'my-sites/importer/importer-site-importer';
import SquarespaceImporter from 'my-sites/importer/importer-squarespace';
import { fetchState } from 'lib/importer/actions';
import { appStates, WORDPRESS, MEDIUM, BLOGGER, SITE_IMPORTER } from 'state/imports/constants';
import {
appStates,
WORDPRESS,
MEDIUM,
BLOGGER,
SITE_IMPORTER,
SQUARESPACE,
} from 'state/imports/constants';
import EmailVerificationGate from 'components/email-verification/email-verification-gate';
import { getSelectedSite, getSelectedSiteSlug } from 'state/ui/selectors';
import Main from 'components/main';
Expand Down Expand Up @@ -58,6 +66,11 @@ const importers = [
isImporterEnabled: isEnabled( 'manage/import/site-importer' ),
component: SiteImporter,
},
{
type: SQUARESPACE,
isImporterEnabled: isEnabled( 'manage/import/squarespace' ),
component: SquarespaceImporter,
},
];

const filterImportsForSite = ( siteID, imports ) => {
Expand Down
1 change: 1 addition & 0 deletions client/state/imports/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export const WORDPRESS = 'importer-type-wordpress';
export const MEDIUM = 'importer-type-medium';
export const BLOGGER = 'importer-type-blogger';
export const SITE_IMPORTER = 'importer-type-site-importer';
export const SQUARESPACE = 'importer-type-squarespace';
1 change: 1 addition & 0 deletions config/desktop-development.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"manage/custom-post-types": true,
"manage/edit-user": true,
"manage/export/guided-transfer": true,
"manage/import/squarespace": false,
"manage/import/medium": true,
"manage/import/site-importer": true,
"manage/media": true,
Expand Down
1 change: 1 addition & 0 deletions config/desktop.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"manage/customize": true,
"manage/edit-user": true,
"manage/import-in-sidebar": true,
"manage/import/squarespace": false,
"manage/import/medium": true,
"manage/import/site-importer": true,
"manage/media": true,
Expand Down
1 change: 1 addition & 0 deletions config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"manage/custom-post-types": true,
"manage/edit-user": true,
"manage/export/guided-transfer": true,
"manage/import/squarespace": true,
"manage/import/medium": true,
"manage/import/site-importer": true,
"manage/import-in-sidebar": true,
Expand Down
1 change: 1 addition & 0 deletions config/horizon.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"manage/edit-user": true,
"manage/export/guided-transfer": true,
"manage/import-in-sidebar": true,
"manage/import/squarespace": false,
"manage/import/medium": true,
"manage/import/site-importer": true,
"manage/media": true,
Expand Down
1 change: 1 addition & 0 deletions config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"manage/customize": true,
"manage/edit-user": true,
"manage/import-in-sidebar": true,
"manage/import/squarespace": false,
"manage/import/medium": true,
"manage/import/site-importer": true,
"manage/media": true,
Expand Down
1 change: 1 addition & 0 deletions config/stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"manage/customize": true,
"manage/edit-user": true,
"manage/import-in-sidebar": true,
"manage/import/squarespace": false,
"manage/import/medium": true,
"manage/import/site-importer": true,
"manage/media": true,
Expand Down
1 change: 1 addition & 0 deletions config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"keyboard-shortcuts": true,
"manage/customize": true,
"manage/edit-user": true,
"manage/import/squarespace": false,
"manage/import/medium": true,
"manage/import/site-importer": true,
"manage/media": true,
Expand Down
1 change: 1 addition & 0 deletions config/wpcalypso.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"manage/edit-user": true,
"manage/export/guided-transfer": true,
"manage/import-in-sidebar": true,
"manage/import/squarespace": false,
"manage/import/medium": true,
"manage/import/site-importer": true,
"manage/media": true,
Expand Down

0 comments on commit a20f92f

Please sign in to comment.