Skip to content

Commit

Permalink
Merge branch 'master' into links/shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
wassgha committed Jun 30, 2020
2 parents ec36bba + 7a4e144 commit b989371
Show file tree
Hide file tree
Showing 214 changed files with 18,773 additions and 16,029 deletions.
4 changes: 2 additions & 2 deletions .distignore
Expand Up @@ -2,7 +2,6 @@
.github
.idea
.storybook
__cdn__
__mocks__
__static__
assets/src
Expand Down Expand Up @@ -40,7 +39,8 @@ composer.json
composer.lock
CONTRIBUTING.md
jest-puppeteer.config.cjs
karma.config.cjs
karma-edit-story.config.cjs
karma-dashboard.config.cjs
package.json
package-lock.json
percy.config.yml
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc
Expand Up @@ -300,7 +300,7 @@
"bin/**/*.js",
"babel.config.cjs",
"jest-puppeteer.config.cjs",
"karma.config.cjs",
"karma-*.config.cjs",
"webpack.*.cjs",
".storybook/*.cjs",
".storybook/*.js",
Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/continuous-integration-gh-pages.yml
@@ -0,0 +1,106 @@
name: Deploy to GH Pages

on:
push:
branches:
- master

jobs:
build-storybook:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'

- name: Setup npm cache
uses: pat-s/always-upload-cache@v1.1.4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ env.cache-name }}-
${{ runner.os }}-npm-
${{ runner.os }}-
- name: Install dependencies
run: npm ci
env:
CI: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

- name: Build storyook
run: npm run storybook:build

- name: Upload storybook
uses: actions/upload-artifact@v2
with:
name: storybook-files
path: build/storybook

upload-static-assets:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Upload static assets
uses: actions/upload-artifact@v2
with:
name: template-images
path: assets/images/templates

deploy-gh-pages:
runs-on: ubuntu-latest
needs: [build-storybook, upload-static-assets]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: gh-pages

- name: Download storybook files
uses: actions/download-artifact@v2
with:
name: storybook-files
path: storybook-files

- name: Move storybook assets
run: |
mkdir -p storybook
rm -rf storybook/*
mv storybook-files/* storybook/
- name: Download static assets
uses: actions/download-artifact@v2
with:
name: template-images
path: template-images

- name: Move static assets
run: |
mkdir -p plugin-assets/images/templates
rm -rf plugin-assets/images/templates/*
mv template-images/* plugin-assets/images/templates/
- name: Commit updates
run: |
git add .
git status
git diff --staged --quiet && echo 'No changes to commit; exiting!' && exit 0
git commit -m "Deploy storybook and assets for ${{ github.sha }}"
git pull --no-edit --quiet
git push origin gh-pages
env:
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_AUTHOR_NAME: ${{ github.actor }}
GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_COMMITTER_NAME: ${{ github.actor }}
48 changes: 48 additions & 0 deletions .github/workflows/continuous-integration-karma-dashboard.yml
@@ -0,0 +1,48 @@
name: Dashboard Integration Tests

on:
push:
branches:
- master
- release/*
pull_request:

jobs:
karma:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}

- name: Setup npm cache
uses: pat-s/always-upload-cache@v1.1.4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ env.cache-name }}-
${{ runner.os }}-npm-
${{ runner.os }}-
- name: Install dependencies
run: npm ci
env:
CI: true

- name: Run dashboard integration tests
run: npm run test:karma:dashboard -- --headless --viewport=1600:1000 --coverage

- name: Upload code coverage report
uses: codecov/codecov-action@v1
with:
file: build/logs/karma-coverage/dashboard/lcov.info
flags: karmatests
@@ -1,4 +1,4 @@
name: Integration Tests
name: Edit Story Integration Tests

on:
push:
Expand Down Expand Up @@ -39,11 +39,17 @@ jobs:
CI: true

- name: Run integration tests
run: npm run test:karma -- --headless --snapshots --viewport=1600:1000
run: npm run test:karma:edit-story -- --headless --snapshots --viewport=1600:1000 --coverage

- name: Add files for snapshotting
run: cp -r __static__ .test_artifacts/karma_snapshots/

- name: Upload code coverage report
uses: codecov/codecov-action@v1
with:
file: build/logs/karma-coverage/edit-story/lcov.info
flags: karmatests

- name: Upload Percy snapshots
uses: percy/snapshot-action@v0.1.1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-unit-js.yml
Expand Up @@ -55,7 +55,7 @@ jobs:
path: assets/src/**/__image_snapshots__/__diff_output__/*
if: failure()

- name: Uplaod code coverage report
- name: Upload code coverage report
uses: codecov/codecov-action@v1
with:
file: build/logs/lcov.info
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration-unit-php.yml
Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Run tests
run: |
npm run test:php
npm run test:php -- -c phpunit-multisite.xml.dist
npm run test:php:multisite
if: ${{ ! matrix.coverage }}

- name: Run tests with coverage
Expand All @@ -92,7 +92,7 @@ jobs:
npm run test:php -- --coverage-clover build/logs/php-coverage-multisite.xml -c phpunit-multisite.xml.dist
if: ${{ matrix.coverage }}

- name: Uplaod code coverage report
- name: Upload code coverage report
uses: codecov/codecov-action@v1
with:
file: build/logs/*.xml
Expand Down
14 changes: 1 addition & 13 deletions .travis.yml
Expand Up @@ -45,21 +45,9 @@ install:
- composer install --no-interaction

script:
- npm run build:js

before_deploy:
- npm run storybook:build
- npm run workflow:copy-template-assets
- npm run workflow:copy-cdn-files
- echo "Doing nothing, waiting for deploy..."

deploy:
- provider: pages
edge: true
github_token: $GITHUB_TOKEN
keep_history: true
local_dir: build/storybook
on:
branch: master
- provider: script
edge: true
script: bin/deploy-to-test-environment.sh
Expand Down
17 changes: 0 additions & 17 deletions __cdn__/service/plugin-updates.json

This file was deleted.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/beauty/beauty_page9_story2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/cooking/cooking_icon_logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/templates/diy/diy_page10_image2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/diy/diy_page7_bg.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/entertainment/ent_icon_musicnote.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/entertainment/ent_icon_wraparound.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/entertainment/ent_page5_image1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page1_hero.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page1_logotype.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page2_arrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page2_pinwheel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page2_pinwheel_full.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page3_arrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page3_bg.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page5_arrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page5_figure.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/templates/fashion/fashion_page5_handbag.png
Binary file modified assets/images/templates/fashion/fashion_page6_pinwheel-outline.png
Binary file modified assets/images/templates/fashion/fashion_page7_arrow.png
Binary file modified assets/images/templates/fashion/fashion_page7_hero.jpg
Binary file modified assets/images/templates/fashion/fashion_page7_pinwheel.png
Binary file modified assets/images/templates/fashion/fashion_page8_arrow.png
Binary file modified assets/images/templates/fashion/fashion_page8_bg.jpg
Binary file modified assets/images/templates/fashion/fashion_page9_facebook.png
Binary file modified assets/images/templates/fashion/fashion_page9_instagram.png
Binary file modified assets/images/templates/fashion/fashion_page9_item1-cropped.png
Binary file modified assets/images/templates/fashion/fashion_page9_item1.jpg
Binary file modified assets/images/templates/fashion/fashion_page9_item2.jpg
Binary file modified assets/images/templates/fashion/fashion_page9_item3.jpg
Binary file modified assets/images/templates/fashion/fashion_page9_twitter.png
Binary file modified assets/images/templates/fashion/fashion_page9_youtube.png
Binary file added assets/images/templates/travel/travel_icon_logo.png
5 changes: 2 additions & 3 deletions assets/src/dashboard/app/api/useStoryApi.js
Expand Up @@ -30,12 +30,11 @@ import { useFeatures } from 'flagged';
/**
* Internal dependencies
*/

import {
STORY_STATUSES,
STORY_SORT_OPTIONS,
ORDER_BY_SORT,
ITEMS_PER_PAGE,
STORIES_PER_REQUEST,
} from '../../constants';
import { migrate, DATA_VERSION } from '../../../edit-story/migration/migrate';
import storyReducer, {
Expand Down Expand Up @@ -95,7 +94,7 @@ const useStoryApi = (dataAdapter, { editStoryURL, storyApi }) => {
sortDirection,
searchTerm,
page = 1,
perPage = ITEMS_PER_PAGE,
perPage = STORIES_PER_REQUEST,
}) => {
dispatch({
type: STORY_ACTION_TYPES.LOADING_STORIES,
Expand Down
5 changes: 3 additions & 2 deletions assets/src/dashboard/app/api/useUserApi.js
Expand Up @@ -18,11 +18,12 @@
* External dependencies
*/
import { useCallback, useEffect, useMemo, useState } from 'react';
import queryString from 'query-string';

/**
* Internal dependencies
*/
import queryString from 'query-string';
import { USERS_PER_REQUEST } from '../../constants';
import groupBy from '../../utils/groupBy';
import fetchAllFromTotalPages from './fetchAllFromPages';

Expand All @@ -33,7 +34,7 @@ export default function useUserApi(dataAdapter, { userApi }) {
const response = await dataAdapter.get(
queryString.stringifyUrl({
url: userApi,
query: { per_page: 100 },
query: { per_page: USERS_PER_REQUEST },
}),
{
parse: false,
Expand Down
26 changes: 26 additions & 0 deletions assets/src/dashboard/app/views/myStories/content/index.js
Expand Up @@ -22,6 +22,7 @@ import { __ } from '@wordpress/i18n';
/**
* External dependencies
*/
import { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';

/**
Expand All @@ -33,6 +34,7 @@ import {
InfiniteScroller,
Layout,
StandardViewContentGutter,
useLayoutContext,
} from '../../../../components';
import {
UsersPropType,
Expand Down Expand Up @@ -60,7 +62,29 @@ function Content({
storyActions,
users,
view,
dateFormat,
}) {
const {
actions: { scrollToTop },
} = useLayoutContext();

const previousFilter = useRef(filter);
const previousViewStyle = useRef(view.style);

useEffect(() => {
/**
* Ensure we only scroll back to top when the filter or view style change.
*/
if (
previousFilter.current !== filter ||
previousViewStyle.current !== view.style
) {
previousFilter.current = filter;
previousViewStyle.current = view.style;
scrollToTop();
}
}, [filter, scrollToTop, view]);

return (
<Layout.Scrollable>
<FontProvider>
Expand All @@ -80,6 +104,7 @@ function Content({
stories={stories}
users={users}
view={view}
dateFormat={dateFormat}
/>
<InfiniteScroller
canLoadMore={!allPagesFetched}
Expand Down Expand Up @@ -108,6 +133,7 @@ Content.propTypes = {
storyActions: StoryActionsPropType,
users: UsersPropType,
view: ViewPropTypes,
dateFormat: PropTypes.string,
};

export default Content;
Expand Up @@ -167,6 +167,7 @@ export const _StoriesViewGrid = () => (
stories={formattedStoriesArray}
users={formattedUsersObject}
view={view}
dateFormat="F j, Y"
/>
</FlagsProvider>
);
Expand All @@ -180,6 +181,7 @@ export const _StoriesViewList = () => (
stories={formattedStoriesArray}
users={formattedUsersObject}
view={{ ...view, style: VIEW_STYLE.LIST }}
dateFormat="F j, Y"
/>
</FlagsProvider>
);
Expand Down

0 comments on commit b989371

Please sign in to comment.