diff --git a/parser_setup/.eslintrc.json b/parser_setup/.eslintrc.json
deleted file mode 100644
index f9b22b7..0000000
--- a/parser_setup/.eslintrc.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "root": true,
- "parser": "@typescript-eslint/parser",
- "parserOptions": {
- "ecmaVersion": 6,
- "sourceType": "module"
- },
- "plugins": [
- "@typescript-eslint"
- ],
- "rules": {
- "@typescript-eslint/naming-convention": "warn",
- "@typescript-eslint/semi": "warn",
- "curly": "warn",
- "eqeqeq": "warn",
- "no-throw-literal": "warn",
- "semi": "off"
- },
- "ignorePatterns": [
- "out",
- "dist",
- "**/*.d.ts"
- ]
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/client/app.js b/parser_setup/__tests__/itsquiz-wall/client/app.js
deleted file mode 100644
index a181c7f..0000000
--- a/parser_setup/__tests__/itsquiz-wall/client/app.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
-import { Provider } from 'react-redux';
-import { Router } from 'react-router';
-import fetch from 'isomorphic-fetch';
-import cookie from 'cookie';
-
-import configureStore from '../shared/store/configureStore';
-import routes from '../shared/routes.jsx';
-import history from '../shared/history.js';
-import i18n from '../shared/i18n';
-
-const DEFAULT_LOCALE = 'en';
-
-const initialState = window.__INITIAL_STATE__ || {};
-const store = configureStore(initialState);
-const locale = cookie.parse(document.cookie).locale || DEFAULT_LOCALE;
-
-function loadLocale(localeToLoad) {
- if (localeToLoad === 'en') {
- // No need to load as UI already in English
- return Promise.resolve({});
- }
-
-
- // "": { "domain": "messages", "lang": "" }
- return fetch(`/static/lang/${localeToLoad}.json`).then(res => {
- if (res.status >= 400) {
- throw new Error('Bad response from server');
- }
-
- return res.json();
- });
-}
-
-loadLocale(locale).then(localeData => {
- const i18nTools = new i18n.Tools({ localeData, locale });
-
- ReactDOM.render(
-
-
-
-
- ,
-
- document.getElementById('react-view')
- );
-}).catch(error => {
- console.error(error);
-});
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/actions/accounts.js b/parser_setup/__tests__/itsquiz-wall/shared/actions/accounts.js
deleted file mode 100644
index 6c5f244..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/actions/accounts.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import api from '../apiSingleton';
-import apiResponseFormatter from '../utils/apiResponseFormatter';
-
-export const LOAD_ACCOUNTS_SUCCESS = 'LOAD_ACCOUNTS_SUCCESS';
-
-export function loadAccounts() {
- return (dispatch) => {
- return api.accounts.list().then((response) => {
- // TODO Move formatting to a reducer
- const accounts = response.data.entities.map(apiResponseFormatter.formatAuthorProfileData);
-
- dispatch({
- type: LOAD_ACCOUNTS_SUCCESS,
- accounts
- });
- });
- };
-}
-
-export const LOAD_ACCOUNT_SUCCESS = 'LOAD_ACCOUNT_SUCCESS';
-export const LOAD_ACCOUNT_FAIL = 'LOAD_ACCOUNT_FAIL';
-export const LOAD_ACCOUNT_REQUEST = 'LOAD_ACCOUNT_REQUEST';
-export const SET_SESSION_TYPE = 'SET_SESSION_TYPE';
-
-export function loadAccount({ id }) {
- return (dispatch) => {
- return api.accounts.show(id).then((response) => {
- const account = apiResponseFormatter.formatAuthorProfileData(response.data);
-
- dispatch({
- type: LOAD_ACCOUNT_SUCCESS,
- account
- });
- }).catch(error => {
- dispatch({
- type: LOAD_ACCOUNT_FAIL,
- error
- });
- });
- };
-}
-
-export function loadAccountType({ query }) {
- return (dispatch) => {
- dispatch({
- type: SET_SESSION_TYPE,
- isOrganization: query.isOrganization === 'true'
- });
- };
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/actions/activations.js b/parser_setup/__tests__/itsquiz-wall/shared/actions/activations.js
deleted file mode 100644
index 1fc15ef..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/actions/activations.js
+++ /dev/null
@@ -1,151 +0,0 @@
-import api from '../apiSingleton';
-
-import { loadAssessmentSystem } from './assessmentSystems';
-
-export const LOAD_ACTIVATIONS_SUCCESS = 'LOAD_ACTIVATIONS_SUCCESS';
-export const LOAD_ACTIVATIONS_FAIL = 'LOAD_ACTIVATIONS_FAIL';
-export const LOAD_ACTIVATIONS_REQUEST = 'LOAD_ACTIVATIONS_REQUEST';
-
-const LIMIT_PER_QUERY = 24;
-
-export function loadActivations({ query = {}, offset = 0 }) {
- return (dispatch) => {
- dispatch({
- type : LOAD_ACTIVATIONS_REQUEST,
- category : query.category || 'ALL',
- sortType : query.sortType || 'new',
- search : query.search || ''
- });
-
- return api.activations.list({
- offset,
- include : 'accounts',
- limit : LIMIT_PER_QUERY,
- search : query.search || '',
- category : query.category !== 'SPECIAL' ? query.category : '',
- isSponsored : query.category === 'SPECIAL' ? true : '',
- sortBy : query.sortType || '',
- assigneeId : query.assigneeId || ''
-
- }).then(({ data, linked }) => {
- dispatch({
- offset,
- category : query.category || 'ALL',
- sortType : query.sortType || 'new',
- search : query.search || '',
- type : LOAD_ACTIVATIONS_SUCCESS,
- activations : data.entities,
- totalAmount : data.total,
- accounts : linked.accounts
- });
- });
- };
-}
-
-export const LOAD_ACTIVATION_REQUEST = 'LOAD_ACTIVATION_REQUEST';
-export const LOAD_ACTIVATION_SUCCESS = 'LOAD_ACTIVATION_SUCCESS';
-export const LOAD_ACTIVATION_FAIL = 'LOAD_ACTIVATION_FAIL';
-
-export function loadActivation({ params = {}, query = {}, locale }) {
- const assigneeId = params.accountId || query.assigneeId || '';
-
- return dispatch => {
- dispatch({ type : LOAD_ACTIVATION_REQUEST, activationId : params.id });
-
- return api.activations.show(params.id, {
- assigneeId,
- include: 'accounts',
- digest: query.digest,
- accountfromemail: query.accountId
- }).then(response => {
- const accountId = response.data.links.owner.id;
-
- const authorActivationsPromise = dispatch(loadAuthorActivations({
- accountId,
- assigneeId,
- openedActivationId: response.data.id,
- limit: 8
- }));
-
- const activationPromise = dispatch({
- type : LOAD_ACTIVATION_SUCCESS,
- activation : response.data,
- author : response.linked.accounts.find(account => account.id === accountId)
- });
-
- let assessmentSystemPromise;
-
- if (assigneeId) {
- assessmentSystemPromise = dispatch(loadAssessmentSystem(response.data, locale));
- }
-
- return Promise.all([assessmentSystemPromise, activationPromise, authorActivationsPromise]);
- }).catch(error => {
- dispatch({
- type: LOAD_ACTIVATION_FAIL,
- error
- });
- });
- };
-}
-
-export const LOAD_SIMILAR_ACTIVATIONS_REQUEST = 'LOAD_SIMILAR_ACTIVATIONS_REQUEST';
-export const LOAD_SIMILAR_ACTIVATIONS_SUCCESS = 'LOAD_SIMILAR_ACTIVATIONS_SUCCESS';
-export const LOAD_SIMILAR_ACTIVATIONS_FAIL = 'LOAD_SIMILAR_ACTIVATIONS_FAIL';
-
-export function loadSimilarActivations({ params = {}, query = {} }) {
- const assigneeId = query.assigneeId || params.accountId || '';
- const similarTo = params.id;
-
- return dispatch => {
- dispatch({ type : LOAD_SIMILAR_ACTIVATIONS_REQUEST });
-
- return api.activations.list({
- similarTo, assigneeId, limit: 8, include: 'accounts'
- }).then(({ data, linked }) => {
- dispatch({
- similarTo,
- type : LOAD_SIMILAR_ACTIVATIONS_SUCCESS,
- accounts : linked.accounts,
- activations : data.entities
- });
- }).catch(error => {
- dispatch({
- type: LOAD_SIMILAR_ACTIVATIONS_FAIL,
- error
- });
- });
- };
-}
-
-export const LOAD_AUTHOR_ACTIVATIONS_SUCCESS = 'LOAD_AUTHOR_ACTIVATIONS_SUCCESS';
-export const LOAD_AUTHOR_ACTIVATIONS_FAIL = 'LOAD_AUTHOR_ACTIVATIONS_FAIL';
-
-export function loadAuthorActivations(params) {
- const {
- accountId = '',
- assigneeId = '',
- openedActivationId = '',
- limit = 0,
- isAllActivationsLoaded = false
- } = params;
-
- return (dispatch, getState) => {
- const authorId = accountId || getState().currentActivation.activation.author.id;
- const activationId = openedActivationId || getState().currentActivation.activation.id;
-
- return api.activations.list({ accountId: authorId, assigneeId, limit }).then((response) => {
- dispatch({
- isAllActivationsLoaded,
- type : LOAD_AUTHOR_ACTIVATIONS_SUCCESS,
- openedActivationId : activationId,
- authorActivations : response.data.entities
- });
- }).catch(error => {
- dispatch({
- type: LOAD_AUTHOR_ACTIVATIONS_FAIL,
- error
- });
- });
- };
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/actions/assessmentSystems.js b/parser_setup/__tests__/itsquiz-wall/shared/actions/assessmentSystems.js
deleted file mode 100644
index dabd49d..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/actions/assessmentSystems.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import api from '../apiSingleton';
-
-import standardAssessmentSystems from '../utils/LocaleUtil/assessmentSystems.json';
-
-export const LOAD_ASSESSMENT_SYSTEM_SUCCESS = 'LOAD_ASSESSMENT_SYSTEM_SUCCESS';
-export const LOAD_ASSESSMENT_SYSTEM_FAIL = 'LOAD_ASSESSMENT_SYSTEM_FAIL';
-
-export function loadAssessmentSystem(activation, locale) {
- return (dispatch) => {
- if (activation.assessmentSystemType === 'GLOBAL') {
- const localizedStandardSystems = standardAssessmentSystems[locale.toUpperCase()];
-
- for (const standardSystemName in localizedStandardSystems) {
- if (localizedStandardSystems[standardSystemName].id === activation.assessmentSystemId) {
- dispatch({
- type : LOAD_ASSESSMENT_SYSTEM_SUCCESS,
- assessmentSystem : localizedStandardSystems[standardSystemName].assessmentSystem
- });
-
- return Promise.resolve();
- }
- }
- } else {
- return api.assessmentSystems.show(
- activation.assessmentSystemId
- ).then((response) => {
- dispatch({
- type : LOAD_ASSESSMENT_SYSTEM_SUCCESS,
- assessmentSystem : response.assessmentSystem
- });
- }).catch(error => {
- dispatch({
- type: LOAD_ASSESSMENT_SYSTEM_FAIL,
- error
- });
- });
- }
- };
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/api/Accounts.js b/parser_setup/__tests__/itsquiz-wall/shared/api/Accounts.js
deleted file mode 100644
index 9fdcda5..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/api/Accounts.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import Base from './Base';
-
-export default class AccountsAPI extends Base {
- list(params) {
- return this.apiClient.get('quizwall/accounts', {}, params);
- }
-
- show(id, params) {
- return this.apiClient.get(`quizwall/accounts/${id}`, {}, params);
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/api/Activations.js b/parser_setup/__tests__/itsquiz-wall/shared/api/Activations.js
deleted file mode 100644
index d1bb961..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/api/Activations.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import Base from './Base';
-
-export default class ActivationsAPI extends Base {
- list(params) {
- return this.apiClient.get('quizwall/activations', {}, params);
- }
-
- show(id, params) {
- return this.apiClient.get(`quizwall/activations/${id}`, {}, params);
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/api/ApiClient.js b/parser_setup/__tests__/itsquiz-wall/shared/api/ApiClient.js
deleted file mode 100644
index 073cf20..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/api/ApiClient.js
+++ /dev/null
@@ -1,94 +0,0 @@
-import fetch from 'isomorphic-fetch';
-import queryString from 'query-string';
-import Promise from 'bluebird';
-
-export default class ApiClient {
- constructor({ prefix = 'api/v1' } = {}) {
- this.prefix = prefix;
- }
-
- get(requestUrl, payload = {}, params = {}) {
- return this.request({
- url: requestUrl,
- method: 'get',
- body: payload,
- params
- });
- }
-
- put(requestUrl, payload = {}) {
- return this.request({
- url: requestUrl,
- method: 'put',
- body: payload
- });
- }
-
- patch(requestUrl, payload = {}) {
- return this.request({
- url: requestUrl,
- method: 'put',
- body: payload
- });
- }
-
- post(requestUrl, payload = {}) {
- return this.request({
- url: requestUrl,
- method: 'post',
- body: payload
- });
- }
-
- delete(requestUrl) {
- return this.request({
- url: requestUrl,
- method: 'delete'
- });
- }
-
- request({ url, method, params = {}, body }) {
- if (this.authToken) {
- /* eslint-disable */
- params.token = this.authToken;
- /* eslint-enable */
- }
-
- const urlWithQuery = `${url}?${queryString.stringify(params)}`;
-
- const init = {
- method,
- headers: {
- Accept: 'application/json',
- 'Content-Type': 'application/json',
- 'x-real-ip': this.XRealIP
- }
- };
-
- if (method !== 'get' && method !== 'head') {
- init.body = JSON.stringify(body);
- }
-
- return fetch(`${this.prefix}/${urlWithQuery}`, init).then(res => {
- if (res.status >= 400) {
- throw new Error('Bad response from server');
- }
-
- return res.json();
- }).then(data => {
- if (data && data.status === 1) {
- return data;
- }
-
- return Promise.reject(data.error);
- });
- }
-
- setAuthToken(authToken) {
- this.authToken = authToken;
- }
-
- setXRealIP(XRealIP) {
- this.XRealIP = XRealIP;
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/api/AssessmentSystems.js b/parser_setup/__tests__/itsquiz-wall/shared/api/AssessmentSystems.js
deleted file mode 100644
index fed0fc2..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/api/AssessmentSystems.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import Base from './Base';
-
-export default class AssessmentSystemsAPI extends Base {
- show(id, params) {
- return this.apiClient.get(`quizwall/assessmentsystems/${id}`, {}, params);
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/api/Base.js b/parser_setup/__tests__/itsquiz-wall/shared/api/Base.js
deleted file mode 100644
index dd45229..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/api/Base.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export default class Base {
- constructor({ apiClient }) {
- if (!apiClient) throw new Error('[apiClient] required');
- this.apiClient = apiClient;
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/api/index.js b/parser_setup/__tests__/itsquiz-wall/shared/api/index.js
deleted file mode 100644
index b252915..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/api/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import ApiClient from './ApiClient';
-import ActivationsAPI from './Activations';
-import AccountsAPI from './Accounts';
-import AssessmentSystemsAPI from './AssessmentSystems';
-
-export default function ({ apiPrefix } = {}) {
- if (!apiPrefix) {
- throw new Error('[apiPrefix] required');
- }
-
- const api = new ApiClient({ prefix: apiPrefix });
-
- return {
- apiClient : api,
- activations : new ActivationsAPI({ apiClient: api }),
- accounts : new AccountsAPI({ apiClient: api }),
- assessmentSystems : new AssessmentSystemsAPI({ apiClient: api })
- };
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/apiSingleton.js b/parser_setup/__tests__/itsquiz-wall/shared/apiSingleton.js
deleted file mode 100644
index 9336bdc..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/apiSingleton.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import config from './config';
-import apiFactory from './api';
-
-export default apiFactory({
- apiPrefix: config.apiPrefix
-});
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/assets/colors.less b/parser_setup/__tests__/itsquiz-wall/shared/assets/colors.less
deleted file mode 100644
index af3e6bb..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/assets/colors.less
+++ /dev/null
@@ -1,303 +0,0 @@
-// Red
-@red-50: #FFEBEE;
-@red-100: #FFCDD2;
-@red-200: #EF9A9A;
-@red-300: #E57373;
-@red-400: #EF5350;
-@red-500: #F44336;
-@red-600: #E53935;
-@red-700: #D32F2F;
-@red-800: #C62828;
-@red-900: #B71C1C;
-@red-A100: #FF8A80;
-@red-A200: #FF5252;
-@red-A400: #FF1744;
-@red-A700: #D50000;
-
-// Pink
-@pink-50: #FCE4EC;
-@pink-100: #F8BBD0;
-@pink-200: #F48FB1;
-@pink-300: #F06292;
-@pink-400: #EC407A;
-@pink-500: #E91E63;
-@pink-600: #D81B60;
-@pink-700: #C2185B;
-@pink-800: #AD1457;
-@pink-900: #880E4F;
-@pink-A100: #FF80AB;
-@pink-A200: #FF4081;
-@pink-A400: #F50057;
-@pink-A700: #C51162;
-
-// Purple
-@purple-50: #F3E5F5;
-@purple-100: #E1BEE7;
-@purple-200: #CE93D8;
-@purple-300: #BA68C8;
-@purple-400: #AB47BC;
-@purple-500: #9C27B0;
-@purple-600: #8E24AA;
-@purple-700: #7B1FA2;
-@purple-800: #6A1B9A;
-@purple-900: #4A148C;
-@purple-A100: #EA80FC;
-@purple-A200: #E040FB;
-@purple-A400: #D500F9;
-@purple-A700: #AA00FF;
-
-// Deep Purple
-@deep-purple-50: #EDE7F6;
-@deep-purple-100: #D1C4E9;
-@deep-purple-200: #B39DDB;
-@deep-purple-300: #9575CD;
-@deep-purple-400: #7E57C2;
-@deep-purple-500: #673AB7;
-@deep-purple-600: #5E35B1;
-@deep-purple-700: #512DA8;
-@deep-purple-800: #4527A0;
-@deep-purple-900: #311B92;
-@deep-purple-A100: #B388FF;
-@deep-purple-A200: #7C4DFF;
-@deep-purple-A400: #651FFF;
-@deep-purple-A700: #6200EA;
-
-// Indigo
-@indigo-50: #E8EAF6;
-@indigo-100: #C5CAE9;
-@indigo-200: #9FA8DA;
-@indigo-300: #7986CB;
-@indigo-400: #5C6BC0;
-@indigo-500: #3F51B5;
-@indigo-600: #3949AB;
-@indigo-700: #303F9F;
-@indigo-800: #283593;
-@indigo-900: #1A237E;
-@indigo-A100: #8C9EFF;
-@indigo-A200: #536DFE;
-@indigo-A400: #3D5AFE;
-@indigo-A700: #304FFE;
-
-// Blue
-@blue-50: #E3F2FD;
-@blue-100: #BBDEFB;
-@blue-200: #90CAF9;
-@blue-300: #64B5F6;
-@blue-400: #42A5F5;
-@blue-500: #2196F3;
-@blue-600: #1E88E5;
-@blue-700: #1976D2;
-@blue-800: #1565C0;
-@blue-900: #0D47A1;
-@blue-A100: #82B1FF;
-@blue-A200: #448AFF;
-@blue-A400: #2979FF;
-@blue-A700: #2962FF;
-
-// Light Blue
-@light-blue-50: #E1F5FE;
-@light-blue-100: #B3E5FC;
-@light-blue-200: #81D4FA;
-@light-blue-300: #4FC3F7;
-@light-blue-400: #29B6F6;
-@light-blue-500: #03A9F4;
-@light-blue-600: #039BE5;
-@light-blue-700: #0288D1;
-@light-blue-800: #0277BD;
-@light-blue-900: #01579B;
-@light-blue-A100: #80D8FF;
-@light-blue-A200: #40C4FF;
-@light-blue-A400: #00B0FF;
-@light-blue-A700: #0091EA;
-
-// Cyan
-@cyan-50: #E0F7FA;
-@cyan-100: #B2EBF2;
-@cyan-200: #80DEEA;
-@cyan-300: #4DD0E1;
-@cyan-400: #26C6DA;
-@cyan-500: #00BCD4;
-@cyan-600: #00ACC1;
-@cyan-700: #0097A7;
-@cyan-800: #00838F;
-@cyan-900: #006064;
-@cyan-A100: #84FFFF;
-@cyan-A200: #18FFFF;
-@cyan-A400: #00E5FF;
-@cyan-A700: #00B8D4;
-
-// Teal
-@teal-50: #E0F2F1;
-@teal-100: #B2DFDB;
-@teal-200: #80CBC4;
-@teal-300: #4DB6AC;
-@teal-400: #26A69A;
-@teal-500: #009688;
-@teal-600: #00897B;
-@teal-700: #00796B;
-@teal-800: #00695C;
-@teal-900: #004D40;
-@teal-A100: #A7FFEB;
-@teal-A200: #64FFDA;
-@teal-A400: #1DE9B6;
-@teal-A700: #00BFA5;
-
-// Green
-@green-50: #E8F5E9;
-@green-100: #C8E6C9;
-@green-200: #A5D6A7;
-@green-300: #81C784;
-@green-400: #66BB6A;
-@green-500: #4CAF50;
-@green-600: #43A047;
-@green-700: #388E3C;
-@green-800: #2E7D32;
-@green-900: #1B5E20;
-@green-A100: #B9F6CA;
-@green-A200: #69F0AE;
-@green-A400: #00E676;
-@green-A700: #00C853;
-
-// Light Green
-@light-green-50: #F1F8E9;
-@light-green-100: #DCEDC8;
-@light-green-200: #C5E1A5;
-@light-green-300: #AED581;
-@light-green-400: #9CCC65;
-@light-green-500: #8BC34A;
-@light-green-600: #7CB342;
-@light-green-700: #689F38;
-@light-green-800: #558B2F;
-@light-green-900: #33691E;
-@light-green-A100: #CCFF90;
-@light-green-A200: #B2FF59;
-@light-green-A400: #76FF03;
-@light-green-A700: #64DD17;
-
-// Lime
-@lime-50: #F9FBE7;
-@lime-100: #F0F4C3;
-@lime-200: #E6EE9C;
-@lime-300: #DCE775;
-@lime-400: #D4E157;
-@lime-500: #CDDC39;
-@lime-600: #C0CA33;
-@lime-700: #AFB42B;
-@lime-800: #9E9D24;
-@lime-900: #827717;
-@lime-A100: #F4FF81;
-@lime-A200: #EEFF41;
-@lime-A400: #C6FF00;
-@lime-A700: #AEEA00;
-
-// Yellow
-@yellow-50: #FFFDE7;
-@yellow-100: #FFF9C4;
-@yellow-200: #FFF59D;
-@yellow-300: #FFF176;
-@yellow-400: #FFEE58;
-@yellow-500: #FFEB3B;
-@yellow-600: #FDD835;
-@yellow-700: #FBC02D;
-@yellow-800: #F9A825;
-@yellow-900: #F57F17;
-@yellow-A100: #FFFF8D;
-@yellow-A200: #FFFF00;
-@yellow-A400: #FFEA00;
-@yellow-A700: #FFD600;
-
-// Amber
-@amber-50: #FFF8E1;
-@amber-100: #FFECB3;
-@amber-200: #FFE082;
-@amber-300: #FFD54F;
-@amber-400: #FFCA28;
-@amber-500: #FFC107;
-@amber-600: #FFB300;
-@amber-700: #FFA000;
-@amber-800: #FF8F00;
-@amber-900: #FF6F00;
-@amber-A100: #FFE57F;
-@amber-A200: #FFD740;
-@amber-A400: #FFC400;
-@amber-A700: #FFAB00;
-
-// Orange
-@orange-50: #FFF3E0;
-@orange-100: #FFE0B2;
-@orange-200: #FFCC80;
-@orange-300: #FFB74D;
-@orange-400: #FFA726;
-@orange-500: #FF9800;
-@orange-600: #FB8C00;
-@orange-700: #F57C00;
-@orange-800: #EF6C00;
-@orange-900: #E65100;
-@orange-A100: #FFD180;
-@orange-A200: #FFAB40;
-@orange-A400: #FF9100;
-@orange-A700: #FF6D00;
-
-// Deep Orange
-@deep-orange-50: #FBE9E7;
-@deep-orange-100: #FFCCBC;
-@deep-orange-200: #FFAB91;
-@deep-orange-300: #FF8A65;
-@deep-orange-400: #FF7043;
-@deep-orange-500: #FF5722;
-@deep-orange-600: #F4511E;
-@deep-orange-700: #E64A19;
-@deep-orange-800: #D84315;
-@deep-orange-900: #BF360C;
-@deep-orange-A100: #FF9E80;
-@deep-orange-A200: #FF6E40;
-@deep-orange-A400: #FF3D00;
-@deep-orange-A700: #DD2C00;
-
-// Brown
-@brown-50: #EFEBE9;
-@brown-100: #D7CCC8;
-@brown-200: #BCAAA4;
-@brown-300: #A1887F;
-@brown-400: #8D6E63;
-@brown-500: #795548;
-@brown-600: #6D4C41;
-@brown-700: #5D4037;
-@brown-800: #4E342E;
-@brown-900: #3E2723;
-
-// Grey
-@grey-50: #FAFAFA;
-@grey-100: #F5F5F5;
-@grey-200: #EEEEEE;
-@grey-300: #E0E0E0;
-@grey-400: #BDBDBD;
-@grey-500: #9E9E9E;
-@grey-600: #757575;
-@grey-700: #616161;
-@grey-800: #424242;
-@grey-900: #212121;
-
-// Blue Grey
-@blue-grey-50: #ECEFF1;
-@blue-grey-100: #CFD8DC;
-@blue-grey-200: #B0BEC5;
-@blue-grey-300: #90A4AE;
-@blue-grey-400: #78909C;
-@blue-grey-500: #607D8B;
-@blue-grey-600: #546E7A;
-@blue-grey-700: #455A64;
-@blue-grey-800: #37474F;
-@blue-grey-900: #263238;
-
-// White
-@white-lighter: rgba(255,255,255,.12); // Dividers
-@white-light: rgba(255,255,255,.30); // Disabled / Hint Text
-@white-dark: rgba(255,255,255,.70); // Secondary Text
-@white-darker: rgba(255,255,255, 1); // Text / Icons
-
-// Black
-@black-lighter: rgba(0,0,0,.12); // Dividers
-@black-light: rgba(0,0,0,.26); // Disabled / Hint Text
-@black-dark: rgba(0,0,0,.54); // Secondary text / Icons
-@black-darker: rgba(0,0,0,.87); // Text
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/assets/index.js b/parser_setup/__tests__/itsquiz-wall/shared/assets/index.js
deleted file mode 100644
index e982e93..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/assets/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import './normalize.css';
-import './typography.less';
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/assets/media.less b/parser_setup/__tests__/itsquiz-wall/shared/assets/media.less
deleted file mode 100644
index 14723f9..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/assets/media.less
+++ /dev/null
@@ -1,13 +0,0 @@
-@xs-min : 480px;
-@sm-min : 768px;
-@md-min : 992px;
-@lg-min : 1200px;
-
-@xs-max : (@sm-min - 1);
-@sm-max : (@md-min - 1);
-@md-max : (@lg-min - 1);
-
-@phone : ~"only screen and (max-width: @{xs-max})";
-@tablet : ~"only screen and (min-width: @{sm-min}) and (max-width: @{sm-max})";
-@desktop : ~"only screen and (min-width: @{md-min}) and (max-width: @{md-max})";
-@large : ~"only screen and (min-width: @{lg-min})";
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/assets/mixins.less b/parser_setup/__tests__/itsquiz-wall/shared/assets/mixins.less
deleted file mode 100644
index 0b4ebea..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/assets/mixins.less
+++ /dev/null
@@ -1,6 +0,0 @@
-.text-ellipsis {
- width: 100%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/assets/normalize.css b/parser_setup/__tests__/itsquiz-wall/shared/assets/normalize.css
deleted file mode 100644
index 5e5e3c8..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/assets/normalize.css
+++ /dev/null
@@ -1,424 +0,0 @@
-/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
-
-/**
- * 1. Set default font family to sans-serif.
- * 2. Prevent iOS and IE text size adjust after device orientation change,
- * without disabling user zoom.
- */
-
-html {
- font-family: sans-serif; /* 1 */
- -ms-text-size-adjust: 100%; /* 2 */
- -webkit-text-size-adjust: 100%; /* 2 */
-}
-
-/**
- * Remove default margin.
- */
-
-body {
- margin: 0;
-}
-
-/* HTML5 display definitions
- ========================================================================== */
-
-/**
- * Correct `block` display not defined for any HTML5 element in IE 8/9.
- * Correct `block` display not defined for `details` or `summary` in IE 10/11
- * and Firefox.
- * Correct `block` display not defined for `main` in IE 11.
- */
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-main,
-menu,
-nav,
-section,
-summary {
- display: block;
-}
-
-/**
- * 1. Correct `inline-block` display not defined in IE 8/9.
- * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
- */
-
-audio,
-canvas,
-progress,
-video {
- display: inline-block; /* 1 */
- vertical-align: baseline; /* 2 */
-}
-
-/**
- * Prevent modern browsers from displaying `audio` without controls.
- * Remove excess height in iOS 5 devices.
- */
-
-audio:not([controls]) {
- display: none;
- height: 0;
-}
-
-/**
- * Address `[hidden]` styling not present in IE 8/9/10.
- * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.
- */
-
-[hidden],
-template {
- display: none;
-}
-
-/* Links
- ========================================================================== */
-
-/**
- * Remove the gray background color from active links in IE 10.
- */
-
-a {
- background-color: transparent;
-}
-
-/**
- * Improve readability of focused elements when they are also in an
- * active/hover state.
- */
-
-a:active,
-a:hover {
- outline: 0;
-}
-
-/* Text-level semantics
- ========================================================================== */
-
-/**
- * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
- */
-
-abbr[title] {
- border-bottom: 1px dotted;
-}
-
-/**
- * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
- */
-
-b,
-strong {
- font-weight: bold;
-}
-
-/**
- * Address styling not present in Safari and Chrome.
- */
-
-dfn {
- font-style: italic;
-}
-
-/**
- * Address variable `h1` font-size and margin within `section` and `article`
- * contexts in Firefox 4+, Safari, and Chrome.
- */
-
-h1 {
- font-size: 2em;
- margin: 0.67em 0;
-}
-
-/**
- * Address styling not present in IE 8/9.
- */
-
-mark {
- background: #ff0;
- color: #000;
-}
-
-/**
- * Address inconsistent and variable font size in all browsers.
- */
-
-small {
- font-size: 80%;
-}
-
-/**
- * Prevent `sub` and `sup` affecting `line-height` in all browsers.
- */
-
-sub,
-sup {
- font-size: 75%;
- line-height: 0;
- position: relative;
- vertical-align: baseline;
-}
-
-sup {
- top: -0.5em;
-}
-
-sub {
- bottom: -0.25em;
-}
-
-/* Embedded content
- ========================================================================== */
-
-/**
- * Remove border when inside `a` element in IE 8/9/10.
- */
-
-img {
- border: 0;
-}
-
-/**
- * Correct overflow not hidden in IE 9/10/11.
- */
-
-svg:not(:root) {
- overflow: hidden;
-}
-
-/* Grouping content
- ========================================================================== */
-
-/**
- * Address margin not present in IE 8/9 and Safari.
- */
-
-figure {
- margin: 1em 40px;
-}
-
-/**
- * Address differences between Firefox and other browsers.
- */
-
-hr {
- box-sizing: content-box;
- height: 0;
-}
-
-/**
- * Contain overflow in all browsers.
- */
-
-pre {
- overflow: auto;
-}
-
-/**
- * Address odd `em`-unit font size rendering in all browsers.
- */
-
-code,
-kbd,
-pre,
-samp {
- font-family: monospace, monospace;
- font-size: 1em;
-}
-
-/* Forms
- ========================================================================== */
-
-/**
- * Known limitation: by default, Chrome and Safari on OS X allow very limited
- * styling of `select`, unless a `border` property is set.
- */
-
-/**
- * 1. Correct color not being inherited.
- * Known issue: affects color of disabled elements.
- * 2. Correct font properties not being inherited.
- * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
- */
-
-button,
-input,
-optgroup,
-select,
-textarea {
- color: inherit; /* 1 */
- font: inherit; /* 2 */
- margin: 0; /* 3 */
-}
-
-/**
- * Address `overflow` set to `hidden` in IE 8/9/10/11.
- */
-
-button {
- overflow: visible;
-}
-
-/**
- * Address inconsistent `text-transform` inheritance for `button` and `select`.
- * All other form control elements do not inherit `text-transform` values.
- * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
- * Correct `select` style inheritance in Firefox.
- */
-
-button,
-select {
- text-transform: none;
-}
-
-/**
- * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
- * and `video` controls.
- * 2. Correct inability to style clickable `input` types in iOS.
- * 3. Improve usability and consistency of cursor style between image-type
- * `input` and others.
- */
-
-button,
-html input[type="button"], /* 1 */
-input[type="reset"],
-input[type="submit"] {
- -webkit-appearance: button; /* 2 */
- cursor: pointer; /* 3 */
-}
-
-/**
- * Re-set default cursor for disabled elements.
- */
-
-button[disabled],
-html input[disabled] {
- cursor: default;
-}
-
-/**
- * Remove inner padding and border in Firefox 4+.
- */
-
-button::-moz-focus-inner,
-input::-moz-focus-inner {
- border: 0;
- padding: 0;
-}
-
-/**
- * Address Firefox 4+ setting `line-height` on `input` using `!important` in
- * the UA stylesheet.
- */
-
-input {
- line-height: normal;
-}
-
-/**
- * It's recommended that you don't attempt to style these elements.
- * Firefox's implementation doesn't respect box-sizing, padding, or width.
- *
- * 1. Address box sizing set to `content-box` in IE 8/9/10.
- * 2. Remove excess padding in IE 8/9/10.
- */
-
-input[type="checkbox"],
-input[type="radio"] {
- box-sizing: border-box; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * Fix the cursor style for Chrome's increment/decrement buttons. For certain
- * `font-size` values of the `input`, it causes the cursor style of the
- * decrement button to change from `default` to `text`.
- */
-
-input[type="number"]::-webkit-inner-spin-button,
-input[type="number"]::-webkit-outer-spin-button {
- height: auto;
-}
-
-/**
- * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
- * 2. Address `box-sizing` set to `border-box` in Safari and Chrome.
- */
-
-input[type="search"] {
- -webkit-appearance: textfield; /* 1 */
- box-sizing: content-box; /* 2 */
-}
-
-/**
- * Remove inner padding and search cancel button in Safari and Chrome on OS X.
- * Safari (but not Chrome) clips the cancel button when the search input has
- * padding (and `textfield` appearance).
- */
-
-input[type="search"]::-webkit-search-cancel-button,
-input[type="search"]::-webkit-search-decoration {
- -webkit-appearance: none;
-}
-
-/**
- * Define consistent border, margin, and padding.
- */
-
-fieldset {
- border: 1px solid #c0c0c0;
- margin: 0 2px;
- padding: 0.35em 0.625em 0.75em;
-}
-
-/**
- * 1. Correct `color` not being inherited in IE 8/9/10/11.
- * 2. Remove padding so people aren't caught out if they zero out fieldsets.
- */
-
-legend {
- border: 0; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * Remove default vertical scrollbar in IE 8/9/10/11.
- */
-
-textarea {
- overflow: auto;
-}
-
-/**
- * Don't inherit the `font-weight` (applied by a rule above).
- * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
- */
-
-optgroup {
- font-weight: bold;
-}
-
-/* Tables
- ========================================================================== */
-
-/**
- * Remove most spacing between table cells.
- */
-
-table {
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-td,
-th {
- padding: 0;
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/assets/palette.less b/parser_setup/__tests__/itsquiz-wall/shared/assets/palette.less
deleted file mode 100644
index 45cca61..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/assets/palette.less
+++ /dev/null
@@ -1,32 +0,0 @@
-@import 'colors.less';
-
-//App colors
-@primary-1-color : @cyan-500;
-@primary-2-color : @cyan-700;
-@primary-3-color : @cyan-100;
-@accent-1-color : @pink-A200;
-@accent-2-color : @pink-A400;
-@accent-3-color : @pink-A100;
-
-@text-color : rgba(0,0,0,0.87);
-@additional-text-color : rgba(0,0,0,0.67);
-@secondary-text-color : rgba(0,0,0,0.54);
-@hint-text-color : rgba(0,0,0,0.26);
-@divider-color : rgba(0,0,0,0.12);
-@background-color : #eaeaea;
-@cards-color : #ffffff;
-
-@green-app : @green-500;
-@pink-app : @pink-500;
-@red-app : @red-500;
-@purple-app : @purple-500;
-@indigo-app : @indigo-500;
-@blue-app : @blue-500;
-@teal-app : @teal-500;
-@cyan-app : @cyan-500;
-@lime-app : @lime-500;
-@amber-app : @amber-500;
-@yellow-app : @yellow-500;
-@orange-app : @orange-500;
-@brown-app : @brown-500;
-@grey-app : @grey-500;
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/assets/typography.less b/parser_setup/__tests__/itsquiz-wall/shared/assets/typography.less
deleted file mode 100644
index 0d0fa1f..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/assets/typography.less
+++ /dev/null
@@ -1,120 +0,0 @@
-html, body {
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- font-size: 14px;
- font-weight: 400;
- line-height: 20px;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- text-rendering: optimizeLegibility;
-}
-
-h1, h2, h3, h4, h5, h6, p {
- margin: 0;
- padding: 0; }
-
-h1 small, h2 small, h3 small, h4 small, h5 small, h6 small {
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- font-size: 56px;
- font-weight: 400;
- line-height: 1.35;
- letter-spacing: -0.02em;
- opacity: 0.54;
- font-size: 0.6em; }
-
-h1 {
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- font-size: 56px;
- font-weight: 400;
- line-height: 1.35;
- letter-spacing: -0.02em;
- margin-top: 24px;
- margin-bottom: 24px; }
-
-h2 {
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- font-size: 45px;
- font-weight: 400;
- line-height: 48px;
- margin-top: 24px;
- margin-bottom: 24px; }
-
-h3 {
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- font-size: 34px;
- font-weight: 400;
- line-height: 40px;
- margin-top: 24px;
- margin-bottom: 24px; }
-
-h4 {
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- font-size: 24px;
- font-weight: 400;
- line-height: 32px;
- -moz-osx-font-smoothing: grayscale;
- margin-top: 24px;
- margin-bottom: 16px; }
-
-h5 {
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- font-size: 20px;
- font-weight: 500;
- line-height: 1;
- letter-spacing: 0.02em;
- margin-top: 24px;
- margin-bottom: 16px; }
-
-h6 {
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- font-size: 16px;
- font-weight: 400;
- line-height: 24px;
- letter-spacing: 0.04em;
- margin-top: 24px;
- margin-bottom: 16px; }
-
-p {
- font-size: 14px;
- font-weight: 400;
- line-height: 24px;
- letter-spacing: 0;
- margin-bottom: 16px; }
-
-a {
- color: rgb(255,64,129);
- font-weight: 500; }
-
-blockquote {
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- position: relative;
- font-size: 24px;
- font-weight: 300;
- font-style: italic;
- line-height: 1.35;
- letter-spacing: 0.08em; }
- blockquote:before {
- position: absolute;
- left: -0.5em;
- content: '“'; }
- blockquote:after {
- content: '”';
- margin-left: -0.05em; }
-
-mark {
- background-color: #f4ff81; }
-
-dt {
- font-weight: 700; }
-
-address {
- font-size: 12px;
- font-weight: 400;
- line-height: 1;
- letter-spacing: 0;
- font-style: normal; }
-
-ul, ol {
- font-size: 14px;
- font-weight: 400;
- line-height: 24px;
- letter-spacing: 0; }
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/AppBar.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/AppBar.jsx
deleted file mode 100644
index 2a383c8..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/AppBar.jsx
+++ /dev/null
@@ -1,166 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import cx from 'classnames';
-
-import IconButton from 'react-mdl/lib/IconButton';
-
-import config from '../config';
-
-import LanguageSwitch from '../containers/LanguageSwitch.jsx';
-import LoginDialog from '../containers/LoginDialog.jsx';
-import SearchBox from './SearchBox.jsx';
-
-import './AppBar.less';
-
-const LOGO_SRC = '/static/logo.png';
-
-
-export default class AppBar extends Component {
- static propTypes = {
- className : PropTypes.string,
- title : PropTypes.string,
- search : PropTypes.string,
- rightIconName : PropTypes.string,
- displayRightMenu : PropTypes.bool,
- displaySearch : PropTypes.bool,
- isOrganization : PropTypes.bool,
- fixOnScroll : PropTypes.bool,
- hideGoBackBtn : PropTypes.bool,
- scrollOffset : PropTypes.number,
- onRightIconClick : PropTypes.func,
- onSearch : PropTypes.func
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- static defaultProps = {
- title : '',
- search : '',
- fixOnScroll : true,
- displaySearch : false,
- displayRightMenu : true,
- rightIconName : '',
- scrollOffset : 0
- };
-
- state = {
- isFixedToTop : false,
- isLoggingIn : false
- };
-
- componentDidMount() {
- if (this.props.fixOnScroll) {
- window.addEventListener('scroll', this.handleScroll);
- }
- }
-
- componentWillUnmount() {
- if (this.props.fixOnScroll) {
- window.removeEventListener('scroll', this.handleScroll);
- }
- }
-
- handleScroll = () => {
- const scrollTop = (window.pageYOffset !== undefined)
- ? window.pageYOffset
- : (document.documentElement || document.body.parentNode || document.body).scrollTop;
-
- const isFixedToTop = scrollTop > this.props.scrollOffset;
-
- if (isFixedToTop !== this.state.isFixedToTop) {
- this.setState({ isFixedToTop });
- }
- };
-
- handleLogin = () => {
- this.setState({
- isLoggingIn: true
- });
- };
-
- handleLoginDialogClose = () => {
- this.setState({
- isLoggingIn: false
- });
- };
-
- render() {
- const {
- title,
- search,
- className,
- displaySearch,
- displayRightMenu,
- rightIconName,
- hideGoBackBtn,
- onRightIconClick,
- onSearch,
- isOrganization
- } = this.props;
-
- const { l } = this.context.i18n;
-
- const { isLoggingIn, isFixedToTop } = this.state;
-
- const rootClassNames = cx('AppBar', className, {
- 'AppBar--fixed' : isFixedToTop,
- 'AppBar--with-search' : displaySearch
- });
-
- return (
-
-
-
- {
- !isOrganization && !hideGoBackBtn
- ?
-
- {
- rightIconName
- ?
- :
-
-
- }
-
-
{title}
-
- :
- null
- }
- {
- displaySearch
- ?
-
-
- : null
- }
-
- {
- displayRightMenu
- ?
-
-
- {l('Sign up / Sign in')}
-
-
- : null
- }
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/AppBar.less b/parser_setup/__tests__/itsquiz-wall/shared/components/AppBar.less
deleted file mode 100644
index cce7517..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/AppBar.less
+++ /dev/null
@@ -1,100 +0,0 @@
-@import "../assets/mixins.less";
-@import "../assets/palette.less";
-@import "../assets/media.less";
-
-.AppBar {
- height: 65px;
- max-width: 100vw;
- width: 100%;
- box-sizing: border-box;
- padding: 16px;
- background-color: @primary-1-color;
- color: @white-darker;
- z-index: 99;
- transition-duration: .3s;
- display: flex;
- top: 0;
- align-items: center;
-
- @media @phone, @tablet {
- justify-content: space-between;
- }
-
- &.AppBar--with-search {
- .AppBar__left {
- flex: 2;
-
- @media @phone {
- flex: 3;
- }
- }
-
- .AppBar__right {
- @media @phone {
- flex: auto !important;
- }
-
- }
- }
-}
-
-.AppBar__title {
- font-size: 20px;
- margin-left: 16px;
- font-weight: 400;
-
- .text-ellipsis;
-}
-
-.AppBar__left {
- display: flex;
- align-items: center;
- flex: 4;
-}
-
-.AppBar__right {
- display: flex;
- height: 40px;
- align-items: center;
- justify-content: flex-end;
- flex: 2;
-
- @media @phone {
- max-width: 50px;
- flex: 0;
-
- .AppBar__menu-item {
- display: none;
- }
- }
-}
-
-.AppBar__center {
- display: flex;
- align-items: center;
- flex: 3;
-
- @media @phone {
- justify-content: flex-end;
- flex: 2;
- }
-
- @media @large {
- flex: 4;
- }
-}
-
-.AppBar__menu-item {
- padding: 10px;
- margin-left: 5px;
- height: 20px;
- cursor: pointer;
- font-weight: 400;
- font-size: 14px;
- color: @white-darker;
-}
-
-&.AppBar--fixed {
- position: fixed;
- box-shadow: 0 3px 4px 0 rgba(0,0,0,.14),0 3px 3px -2px rgba(0,0,0,.2),0 1px 8px 0 rgba(0,0,0,.12);
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/AppBarWithBackground.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/AppBarWithBackground.jsx
deleted file mode 100644
index 53942de..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/AppBarWithBackground.jsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import AppBar from './AppBar.jsx';
-
-import './AppBarWithBackground.less';
-
-export default class AppBarWithBackground extends Component {
- static propTypes = {
- backgroundURL : PropTypes.string,
- height : PropTypes.number,
- onLogin : PropTypes.func,
- isOrganization: PropTypes.bool
- };
-
- static defaultProps = {
- backgroundURL : '',
- height : 0
- };
-
- render() {
- const { backgroundURL, height, onLogin, isOrganization } = this.props;
-
- const appBarStyle = {
- background: `url(${backgroundURL}) center / cover`
- };
-
- return (
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/AppBarWithBackground.less b/parser_setup/__tests__/itsquiz-wall/shared/components/AppBarWithBackground.less
deleted file mode 100644
index cb73166..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/AppBarWithBackground.less
+++ /dev/null
@@ -1,22 +0,0 @@
-@import "../assets/palette.less";
-
-.AppBarWithBackground {
- height: 300px;
- width: 100vw;
- background-color: @primary-1-color;
- position: absolute;
- top: 0;
-}
-
-.AppBarWithBackground__fixed {
- background-color: transparent;
-
- &.AppBar--fixed {
- background-color: @white-darker;
- color: @text-color;
-
- .AppBar__title {
- color: @text-color;
- }
- }
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/CompanyCard.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/CompanyCard.jsx
deleted file mode 100644
index e01d589..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/CompanyCard.jsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import Button from 'react-mdl/lib/Button';
-
-export class CompanyCard extends Component {
- static propTypes = {
- companyName : PropTypes.string,
- country : PropTypes.string,
- city : PropTypes.string,
- onClick : PropTypes.string
- };
-
- render() {
- const { companyName, country, city, onClick } = this.props;
-
- return (
-
- Company {companyName} from {country} {city}
-
-
- View details
-
-
- );
- }
-}
-
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/Dialog.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/Dialog.jsx
deleted file mode 100644
index d72ba5b..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/Dialog.jsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import ReactModal from 'react-modal';
-
-import './Dialog.less';
-
-
-export default class Dialog extends Component {
- static propTypes = {
- title : PropTypes.string,
- isOpen : PropTypes.bool,
- children : PropTypes.any,
- onRequestClose : PropTypes.func
- };
-
- render() {
- const { isOpen, title, children, onRequestClose } = this.props;
-
- const styles = {
- overlay : {
- backgroundColor : 'rgba(0, 0, 0, 0.5)'
- },
- content : {
- position : 'static',
- outline : 'none'
- }
- };
-
- return (
-
- {
- title
- ? {title}
- : null
- }
- {children}
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/Dialog.less b/parser_setup/__tests__/itsquiz-wall/shared/components/Dialog.less
deleted file mode 100644
index 18dd655..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/Dialog.less
+++ /dev/null
@@ -1,51 +0,0 @@
-@import '../assets/palette.less';
-@import "../assets/media.less";
-
-.ReactModalPortal {
- .ReactModal__Overlay {
- z-index: 1000;
- display: flex;
- background-color: rgba(0,0,0,0.5);
- overflow-y: auto !important;
- }
-
- .ReactModal__Content {
- padding-top: 16px;
- padding-right: 16px;
- padding-left: 16px;
- padding-bottom: 8px;
- margin: auto;
- border: 0;
- border-radius: 2px !important;
- max-width: 800px;
- overflow: visible !important;
- min-width: 300px;
- box-sizing: border-box;
- box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
- opacity: 0;
- transition: all 0.2s ease-in-out;
- transform: scale(0.6);
- display: flex;
- flex-direction: column;
-
- @media @phone {
- border-radius: 0 !important;
- }
-
- &.ReactModal__Content--after-open {
- opacity: 1;
- transform: scale(1);
- }
-
- &.ReactModal__Content--before-close {
- transform: scale(0.4);
- }
- }
-}
-
-.Dialog__title {
- margin: 8px 0;
- font-size: 18px;
- color: black;
- font-weight: 500;
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/ExpandableText.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/ExpandableText.jsx
deleted file mode 100644
index caea850..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/ExpandableText.jsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import cx from 'classnames';
-
-import Button from 'react-mdl/lib/Button';
-import Markdown from './Markdown.jsx';
-
-import './ExpandableText.less';
-
-const MAX_CHAR_NUMBER = 300;
-
-export default class ExpandableText extends Component {
- static propTypes = {
- text : PropTypes.string,
- markdownPreset : PropTypes.string,
- isMarkdownEnabled : PropTypes.bool
- };
-
- static contextTypes = { i18n: React.PropTypes.object };
-
- state = {
- expanded: false
- };
-
- handleClick = () => {
- this.setState({
- expanded: !this.state.expanded
- });
- };
-
- renderedText = () => {
- const { text, markdownPreset, isMarkdownEnabled } = this.props;
-
- return isMarkdownEnabled
- ?
- : {text}
;
- }
-
- render() {
- const { l } = this.context.i18n;
-
- const { text, markdownPreset } = this.props;
-
- const classes = cx('ExpandableText__text', {
- 'minimized': !this.state.expanded
- });
-
- return (
-
- {
- text.length > MAX_CHAR_NUMBER
- ?
-
-
-
-
-
- {
- this.state.expanded
- ?
- l('Minimize')
- :
- l('Expand')
- }
-
-
- :
-
-
-
- }
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/ExpandableText.less b/parser_setup/__tests__/itsquiz-wall/shared/components/ExpandableText.less
deleted file mode 100644
index 102e3db..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/ExpandableText.less
+++ /dev/null
@@ -1,32 +0,0 @@
-@import "../assets/media.less";
-
-@line-height: 22px;
-
-.ExpandableText {
- padding: 24px;
- font-weight: 200;
-
- @media @phone {
- margin-top: 20px;
- padding: 16px;
- }
-}
-
-.ExpandableText__text {
- p {
- white-space: pre-wrap;
- word-wrap: break-word;
- line-height: @line-height;
- margin-bottom: @line-height;
- }
-
- &.minimized {
- height: @line-height * 3;
- overflow: hidden;
- }
-}
-
-.ExpandableText__expand-button {
- display: block;
- margin: 0 auto;
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/Footer.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/Footer.jsx
deleted file mode 100644
index 0025770..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/Footer.jsx
+++ /dev/null
@@ -1,139 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import ShareDialog from '../containers/ShareDialog.jsx';
-
-import './Footer.less';
-
-export default class Footer extends Component {
- static propTypes = {
- links : PropTypes.object,
- linkToShare : PropTypes.string,
- showShareDialog : PropTypes.bool,
- onLinkClick : PropTypes.func,
- onShareClick : PropTypes.func,
- onShareClose : PropTypes.func
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- render() {
- const { l } = this.context.i18n;
-
- const { links, linkToShare, showShareDialog, onLinkClick, onShareClick, onShareClose } = this.props;
-
- return (
-
-
-
-
-
-
{l('Keep in touch')}
-
-
-
-
-
-
-
{l('Do you like It\'s quiz?')}
-
-
-
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/Footer.less b/parser_setup/__tests__/itsquiz-wall/shared/components/Footer.less
deleted file mode 100644
index 0bdfe7a..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/Footer.less
+++ /dev/null
@@ -1,72 +0,0 @@
-@footer-color: #343434;
-
-.Footer {
- margin-top: 20px;
- background-color: @footer-color;
- width: 100%;
- display: flex;
-}
-
-.Footer__menus-container {
- padding: 20px;
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-start;
-}
-
-.Footer__menu {
- width: 200px;
- flex-grow: 1;
- padding: 0 15px;
-}
-
-.Footer__menu-header {
- color: lighten(@footer-color, 60%);
- text-transform: uppercase;
- margin: 0;
- font-size: 14px;
-}
-
-.Footer__menu-items {
- list-style-type: none;
- margin: 0;
- padding: 0;
-
- a {
- text-decoration: none;
- color: lighten(@footer-color, 40%);
- transition: .4s;
- font-weight: 300;
- cursor: pointer;
-
- &:hover {
- text-decoration: underline;
- }
- }
-}
-
-.Footer__content {
- max-width: 900px;
- margin: auto;
- display: flex;
- flex-direction: column;
- justify-content: center;
-}
-
-.Footer__socials {
- margin-top: 10px;
- width: 100%;
- text-align: center;
-}
-
-.Footer__social-icon {
- cursor: pointer;
- font-size: 32px;
- margin: 5px;
- color: lighten(@footer-color, 50%);
- transition: .4s;
-
- &:hover {
- color: lighten(@footer-color, 70%);
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/Icon.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/Icon.jsx
deleted file mode 100644
index c076891..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/Icon.jsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import cx from 'classnames';
-
-export default class Icon extends Component {
- static propTypes = {
- type : PropTypes.string.isRequired,
- className : PropTypes.string
- };
-
- render() {
- const { type, className, ...otherProps } = this.props;
-
- return (
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/LanguageSwitch.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/LanguageSwitch.jsx
deleted file mode 100644
index 38724fa..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/LanguageSwitch.jsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import cx from 'classnames';
-
-import './LanguageSwitch.less';
-
-export default class LanguageSwitch extends Component {
- static propTypes = {
- languages : PropTypes.arrayOf(PropTypes.string),
- selectedLanguage : PropTypes.string,
- className : PropTypes.func,
- onSelect : PropTypes.func.isRequired
- };
-
- handleSelectValueChange = (e) => {
- this.props.onSelect(e.target.value);
- };
-
- render() {
- const { className, selectedLanguage, languages } = this.props;
-
- const classes = cx('LanguageSwitch__select', className);
-
- return (
-
-
- {
- languages.map(lang =>
-
- {lang.toUpperCase()}
-
- )
- }
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/LanguageSwitch.less b/parser_setup/__tests__/itsquiz-wall/shared/components/LanguageSwitch.less
deleted file mode 100644
index bc71594..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/LanguageSwitch.less
+++ /dev/null
@@ -1,28 +0,0 @@
-@import "../assets/mixins.less";
-@import "../assets/palette.less";
-
-.LanguageSwitch__select {
- background-color: transparent;
- cursor: pointer;
- border: none;
- height: 40px;
- padding: 10px;
- font-size: 14px;
- font-weight: 400;
- color: @white-darker;
- -webkit-appearance: none;
- appearance: none;
-
- &:focus{
- outline: 0;
- }
-
- &::-ms-expand { display: none; }
-}
-
-.LanguageSwitch__option {
- color: @black-darker;
- background-color: @white-darker;
- border: none;
- box-shadow: none;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/LoginDialog.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/LoginDialog.jsx
deleted file mode 100644
index 401fd9d..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/LoginDialog.jsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import Dialog from './Dialog.jsx';
-import Icon from './Icon.jsx';
-
-import './LoginDialog.less';
-
-export default class LoginDialog extends Component {
- static propTypes = {
- isOpen : PropTypes.bool.isRequired,
- title : PropTypes.string,
- onSocialLogin : PropTypes.func.isRequired,
- onEmailLogin : PropTypes.func.isRequired,
- onRequestClose : PropTypes.func.isRequired
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- render() {
- const { l } = this.context.i18n;
- const { title, onSocialLogin, onEmailLogin } = this.props;
-
- return (
-
-
-
- {l('Sign in with your social network account to continue')}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {l('or use your e-mail')}
-
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/LoginDialog.less b/parser_setup/__tests__/itsquiz-wall/shared/components/LoginDialog.less
deleted file mode 100644
index bab2f9a..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/LoginDialog.less
+++ /dev/null
@@ -1,71 +0,0 @@
-.LoginDialog {
- display: flex;
- flex-direction: column;
- align-items: center;
-}
-
-.LoginDialog__buttons-container {
- display: flex;
- width: 350px;
- margin: auto;
- padding: 8px 0;
- max-width: 100%;
- justify-content: space-around;
-}
-
-.LoginDialog__button {
- width: 50px;
- height: 50px;
- border-radius: 50px;
- background-color: grey;
- display: flex;
- cursor: pointer;
-
- &.LoginDialog__button--facebook {
- background-color: #47639E;
- }
-
- &.LoginDialog__button--google {
- background-color: #DB4437;
- }
-
- &.LoginDialog__button--github {
- background-color: #333333;
-
- .LoginDialog__icon {
- font-size: 30px;
- }
- }
-
- &.LoginDialog__button--vkontakte {
- background-color: #4E7094;
- }
-
- &.LoginDialog__button--linkedin {
- background-color: #0075B2;
- }
-}
-
-.LoginDialog__title {
- font-size: 15px;
- color: rgba(0,0,0,.54);
- padding-top: 10px;
- padding-bottom: 10px;
- text-align: center;
- margin: 0 auto;
- cursor: default;
-}
-
-.LoginDialog__title--clickable {
- cursor: pointer;
-
- &:hover {
- color: rgba(0,0,0,.74);
- }
-}
-
-.LoginDialog__icon {
- font-size: 25px;
- color: white;
- margin: auto;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/Markdown.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/Markdown.jsx
deleted file mode 100644
index dabc219..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/Markdown.jsx
+++ /dev/null
@@ -1,81 +0,0 @@
- /* eslint
- react/no-danger: 0,
- max-params: 0,
- func-style: 0,
- camelcase: 0
-*/
-
-import React, { Component, PropTypes } from 'react';
-
-import MarkdownIt from 'markdown-it';
-import sanitizeHtml from 'sanitize-html';
-
-import { activationDescriptionPreset } from './Markdown/presets.js';
-
-const MAX_LINK_LENGTH = 35;
-
-class Markdown extends Component {
- static propTypes = {
- source : PropTypes.string.isRequired,
- preset : PropTypes.oneOf([ 'activationDescription' ])
- };
-
- componentWillMount() {
- this.md = new MarkdownIt();
-
- const { preset } = this.props;
-
- switch (preset) {
- case 'activationDescription': {
- this.md.configure(activationDescriptionPreset).enable('linkify').enable(['link', 'list', 'emphasis']);
-
- break;
- }
-
- default: {
- this.md.enable('linkify');
- }
- }
-
- const customRenderer = (tokens, idx, options, env, self) => self.renderToken(tokens, idx, options);
- const rules = this.md.renderer.rules;
-
- const defaultRender = rules.link_open || customRenderer;
-
- rules.link_open = (tokens, idx, options, env, self) => {
- const newTokens = tokens;
- const aIndex = newTokens[idx].attrIndex('target');
-
- if (aIndex < 0) {
- newTokens[idx].attrPush(['target', '_blank']);
- } else {
- newTokens[idx].attrs[aIndex][1] = '_blank';
- }
-
- if (newTokens[idx].info === 'auto') {
- let href = newTokens[idx].attrs[0][1];
-
- if (href.length > MAX_LINK_LENGTH) {
- href = `${href.slice(0, MAX_LINK_LENGTH)}...`;
- newTokens[idx + 1].content = href;
- }
- }
-
- return defaultRender(newTokens, idx, options, env, self);
- };
- }
-
- getMarkdownMarkup = () => {
- const renderedMarkdown = this.md.render(sanitizeHtml(this.props.source));
-
- return {
- __html : renderedMarkdown
- };
- };
-
- render() {
- return
;
- }
-}
-
-export default Markdown;
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/Markdown/presets.js b/parser_setup/__tests__/itsquiz-wall/shared/components/Markdown/presets.js
deleted file mode 100644
index 42602fa..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/Markdown/presets.js
+++ /dev/null
@@ -1,39 +0,0 @@
-export const activationDescriptionPreset = {
- options: {
- html : false,
- xhtmlOut : false,
- breaks : false,
- langPrefix : 'language-',
- linkify : true,
- typographer : false,
- quotes : '\u201c\u201d\u2018\u2019',
- highlight : null,
- maxNesting : 20
- },
-
- components: {
- core: {
- rules: [
- 'normalize',
- 'block',
- 'inline'
- ]
- },
-
- block: {
- rules: [
- 'paragraph'
- ]
- },
-
- inline: {
- rules: [
- 'text'
- ],
- rules2: [
- 'balance_pairs',
- 'text_collapse'
- ]
- }
- }
-};
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/QuizCard.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/QuizCard.jsx
deleted file mode 100644
index 33b8550..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/QuizCard.jsx
+++ /dev/null
@@ -1,191 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import cx from 'classnames';
-
-import IconButton from 'react-mdl/lib/IconButton';
-import { Card, CardTitle, CardActions } from 'react-mdl/lib/Card';
-import Button from 'react-mdl/lib/Button';
-
-import { makeSlug } from '../utils/urlUtil';
-import { sprintf } from '../utils';
-
-import MdiIcon from './Icon.jsx';
-
-import './QuizCard.less';
-
-export default class QuizCard extends Component {
- static propTypes = {
- id : PropTypes.string,
- name : PropTypes.string,
- message : PropTypes.string,
- timeToPass : PropTypes.number,
- numberOfQuestions : PropTypes.number,
- pictureURL : PropTypes.string,
- author : PropTypes.object,
- isSponsored : PropTypes.bool,
- isSurvey : PropTypes.bool,
- className : PropTypes.string,
- category : PropTypes.string,
- isPassed : PropTypes.bool,
- accountQuizSession : PropTypes.object,
- onShare : PropTypes.func,
- onAuthorAvatarClick : PropTypes.func,
- onClick : PropTypes.func
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- handleClick = (e) => {
- e.preventDefault();
- this.props.onClick();
- };
-
- getCategoryLabel = (category) => {
- const { l } = this.context.i18n;
-
- const categoryLabels = {
- 'EDUCATION': l('Education'),
- 'ENTERTAINMENT': l('Entertainment'),
- 'VACANCY': l('Vacancy')
- };
-
- return categoryLabels[category];
- };
-
- render() {
- const {
- id,
- name,
- message,
- className,
- category,
- timeToPass,
- numberOfQuestions,
- pictureURL,
- author,
- isSponsored,
- isPassed,
- isSurvey,
- accountQuizSession,
- onClick,
- onShare,
- onAuthorAvatarClick
- } = this.props;
-
- const { l, nl, humanizeDuration } = this.context.i18n;
-
- const classes = cx('QuizCard', className, {
- 'QuizCard--sponsored': isSponsored
- });
-
- const classesForActionBlock = cx('QuizCard__actions', {
- 'QuizCard__actions--survey': isSurvey
- });
-
- return (
-
-
-
-
-
-
-
-
-
- {
- isPassed
- ?
- {
- !isSurvey
- ?
-
- {accountQuizSession.score}%
-
- :
-
- }
-
- : null
- }
-
-
- {this.getCategoryLabel(category)}
-
-
-
-
- {
- isSponsored
- ?
- {l('Special proposition!')}
-
- :
-
- {
- sprintf(
- nl('%d question', '%d questions', numberOfQuestions),
- numberOfQuestions
- )
- }
-
- •
- {humanizeDuration(timeToPass, 'second')}
-
- }
-
-
{message}
-
-
-
- {
- !isSurvey
- ?
-
-
-
- :
- null
- }
-
-
- {l('View details')}
-
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/QuizCard.less b/parser_setup/__tests__/itsquiz-wall/shared/components/QuizCard.less
deleted file mode 100644
index 43df35a..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/QuizCard.less
+++ /dev/null
@@ -1,184 +0,0 @@
-@import "../assets/mixins.less";
-@import "../assets/palette.less";
-
-@AVATAR_SIZE : 45px;
-
-.QuizCard {
- width: 100%;
- text-decoration: none;
- color: @text-color;
-}
-
-.QuizCard__head {
- color: @text-color;
- height: 60px;
- padding: 10px;
- display: flex;
-
- .mdl-card__title-text {
- marhin: auto 0;
- font-size: 19px;
- }
-}
-
-.QuizCard__media {
- min-height: 200px;
- cursor: default;
- padding: 0;
- position: relative;
-}
-
-.QuizCard__overlay {
- opacity: 1;
- height: 100%;
- width: 100%;
- position: absolute;
- top: 0;
- left:0;
- display: flex;
- transition: .3s;
- background-color: rgba(0, 0, 0, 0.35);
-
- &:hover {
- opacity: 0;
- }
-}
-
-.QuizCard__category {
- background-color: @black-dark;
- color: @white-darker;
- padding: 3px 5px;
- position: absolute;
- bottom: 4px;
- left: 4px;
- font-size: 13px;
- font-weight: 500;
- border-radius: 2px;
-}
-
-.QuizCard__account-score {
- margin: auto;
- font-size: 60px;
- color: white;
-}
-
-.QuizCard__survey--passed {
- font-size: 100px;
- color: white;
- display: block;
- margin: auto;
-}
-
-@font-size: 14px;
-@line-height: 1.4;
-@lines-to-show: 2;
-
-.QuizCard__content {
- margin: 0;
- padding: 8px;
-}
-
-.QuizCard__text {
- color: @secondary-text-color;
- display: block;
- display: -webkit-box;
- max-width: 400px;
- height: @font-size*@line-height*@lines-to-show;
- margin: 0 auto;
- font-size: @font-size;
- line-height: @line-height;
- -webkit-line-clamp: @lines-to-show;
- -webkit-box-orient: vertical;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.QuizCard__title {
- color: @text-color;
- font-size: 19px;
-}
-
-.QuizCard__info {
- display: flex;
- width: 100%;
- align-items: center;
-
- .QuizCard__avatar {
- width: @AVATAR_SIZE;
- height: @AVATAR_SIZE;
- border-radius: 50%;
- cursor: pointer;
- }
-
- .QuizCard__name-author {
- margin-left: 10px;
- width: calc(~"100% -" @AVATAR_SIZE ~"- 20px");
- }
-
- .QuizCard__name {
- font-size: 14px;
- color: @text-color;
- text-decoration: none;
- display: block;
- width: 100%;
- font-weight: 600;
- cursor: pointer;
-
- .text-ellipsis;
-
- &:hover {
- text-decoration: underline;
- }
- }
-
- .QuizCard__author {
- margin-top: 3px;
- font-size: 12px;
- color: @secondary-text-color;
- font-weight: 500;
-
- .text-ellipsis;
- }
-}
-
-.QuizCard__details {
- font-size: 14px;
- margin-bottom: 5px;
-
- .QuizCard__span-divider {
- margin: 0 5px;
- }
-}
-
-.QuizCard__special {
- font-size: 14px;
- cursor: pointer;
- margin-bottom: 5px;
- font-weight: 600;
- color: @primary-1-color;
-}
-
-.QuizCard__actions {
- display: flex;
- justify-content: space-between;
-}
-
-.QuizCard__actions--survey {
- display: flex;
- justify-content: flex-end;
-}
-
-.QuizCard--sponsored {
- .QuizCard__share-button {
- color: @accent-1-color;
- }
-
- .QuizCard__more-button {
- color: white;
- background-color: @accent-1-color;
-
- &:hover {
- background-color: @accent-2-color;
- }
- }
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/QuizTile.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/QuizTile.jsx
deleted file mode 100644
index 6867032..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/QuizTile.jsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import { Card, CardTitle, CardActions } from 'react-mdl/lib/Card';
-
-import { makeSlug } from '../utils/urlUtil';
-
-import MdiIcon from './Icon.jsx';
-
-import './QuizTile.less';
-
-export default class QuizTile extends Component {
- static propTypes = {
- id : PropTypes.string,
- name : PropTypes.string,
- message : PropTypes.string,
- pictureURL : PropTypes.string,
- author : PropTypes.object,
- accountQuizSession : PropTypes.object,
- isPassed : PropTypes.bool,
- onClick : PropTypes.func
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- handleClick = (e) => {
- e.preventDefault();
- this.props.onClick();
- };
-
- render() {
- const {
- id,
- name,
- pictureURL,
- author,
- accountQuizSession,
- isPassed,
- onClick
- } = this.props;
-
- const isSurvey = accountQuizSession ? accountQuizSession.maxPoints === 0 : false;
-
- return (
-
-
-
- {
- isPassed
- ?
- {
- !isSurvey
- ?
-
- {accountQuizSession.score}%
-
- :
-
- }
-
- : null
- }
-
-
-
-
- {name}
-
-
-
- {author.fullName}
-
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/QuizTile.less b/parser_setup/__tests__/itsquiz-wall/shared/components/QuizTile.less
deleted file mode 100644
index bfbf247..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/QuizTile.less
+++ /dev/null
@@ -1,76 +0,0 @@
-@import "../assets/mixins.less";
-@import "../assets/palette.less";
-
-.QuizTile {
- width: 100%;
- height: calc(~"100% + 50px");
- position: relative;
- background-color: @white-darker;
-}
-
-.QuizTile__text {
- background-color: @white-darker;
- height: 50px;
- width: 100%;
-
- .QuizTile__name {
- font-size: 14px;
- color: @text-color;
- text-decoration: none;
- display: block;
- width: 100%;
- font-weight: 600;
- cursor: pointer;
-
- .text-ellipsis;
-
- &:hover {
- text-decoration: underline;
- }
- }
-
- .QuizTile__author {
- margin-top: 3px;
- font-size: 12px;
- color: @secondary-text-color;
- font-weight: 500;
-
- .text-ellipsis;
- }
-}
-
-.QuizTile__title {
- color: @white-darker;
- padding: 0;
- position: relative;
- cursor: default;
-}
-
-.QuizTile__overlay {
- opacity: 1;
- height: 100%;
- width: 100%;
- position: absolute;
- top: 0;
- left:0;
- background-color: rgba(0, 0, 0, 0.35);
- display: flex;
- transition: .3s;
-
- &:hover {
- opacity: 0;
- }
-}
-
-.QuizTile__account-score {
- margin: auto;
- font-size: 60px;
- color: white;
-}
-
-.QuizTile__survey--passed {
- display: block;
- margin: auto;
- font-size: 90px;
- color: white;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/SearchBox.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/SearchBox.jsx
deleted file mode 100644
index e885d9c..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/SearchBox.jsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import cx from 'classnames';
-
-import Icon from 'react-mdl/lib/Icon';
-import Textfield from 'react-mdl/lib/Textfield';
-
-import './SearchBox.less';
-
-const ENTER_KEY = 13;
-
-export default class SearchBox extends Component {
- static propTypes = {
- search : PropTypes.string,
- onSearch : PropTypes.func
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- state = {
- isFocused: false
- };
-
- handleKeyDown = (e) => {
- if (e.keyCode === ENTER_KEY) {
- this.props.onSearch(e.target.value);
- }
- };
-
- handleSearchChange = (e) => {
- const value = e.target.value;
-
- if (!value) {
- this.props.onSearch(value);
- }
- };
-
- handleBoxClick = () => {
- this._input.focus();
- };
-
- handleFocus = () => {
- this.setState({
- isFocused: true
- });
- };
-
- handleBlur = () => {
- this.setState({
- isFocused: false
- });
- };
-
- render() {
- const { search } = this.props;
- const { l } = this.context.i18n;
-
- const rootClassNames = cx('SearchBox', {
- 'SearchBox--focused' : this.state.isFocused
- });
-
- return (
-
-
-
-
- this._input = ref}
- placeholder = {l('Search')}
- defaultValue = {search}
- onChange = {this.handleSearchChange}
- onKeyDown = {this.handleKeyDown}
- onFocus = {this.handleFocus}
- onBlur = {this.handleBlur}
- />
-
-
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/SearchBox.less b/parser_setup/__tests__/itsquiz-wall/shared/components/SearchBox.less
deleted file mode 100644
index 3e4a68a..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/SearchBox.less
+++ /dev/null
@@ -1,133 +0,0 @@
-@import "../assets/mixins.less";
-@import "../assets/palette.less";
-@import "../assets/media.less";
-
-.SearchBox {
- width: 100%;
-
- &.SearchBox--focused {
- .SearchBox__box {
- background-color: @white-darker;
- box-shadow: 0 3px 4px 0 rgba(0,0,0,.14),0 3px 3px -2px rgba(0,0,0,.2),0 1px 8px 0 rgba(0,0,0,.12);
- }
-
- .SearchBox__input {
- color: @black-dark;
-
- &::-webkit-input-placeholder {
- color: @black-light;
- }
-
- &:-moz-placeholder {
- color: @black-light;
- }
-
- &::-moz-placeholder {
- color: @black-light;
- }
-
- &:-ms-input-placeholder {
- color: @black-light;
- }
- }
-
- .SearchBox__search-icon {
- color: @black-light;
- }
- }
-
- @media @phone {
- width: auto;
-
- .SearchBox__box {
- display: none;
- }
-
- .SearchBox__input-expandable {
- display: block;
- }
- }
-}
-
-.SearchBox__input-expandable {
- position: relative;
- top: 3px;
- display: none;
-
- .mdl-textfield__input {
- font-weight: 300;
- margin-left: 5px;
-
- &::-webkit-input-placeholder {
- color: @white-dark;
- }
-
- &:-moz-placeholder {
- color: @white-dark;
- }
-
- &::-moz-placeholder {
- color: @white-dark;
- }
-
- &:-ms-input-placeholder {
- color: @white-dark;
- }
- }
-
- .mdl-button--icon i {
- font-size: 28px;
- }
-}
-
-.SearchBox__box {
- min-width: 100px;
- box-sizing: border-box;
- width: 100%;
- background-color: @white-light;
- display: flex;
- flex-direction: row;
- height: 45px;
- padding: 3px 16px;
- border-radius: 3px;
- margin: 0;
- align-items: center;
- transition: .3s;
- cursor: default;
-}
-
-.SearchBox__input {
- border: none;
- box-shadow: none;
- background-color: transparent;
- font-size: 16px;
- margin-left: 16px;
- font-family: 'Roboto', sans-serif;
- font-weight: 300;
- width: 100%;
- color: @white-darker;
-
- &::-webkit-input-placeholder {
- color: @white-dark;
- }
-
- &:-moz-placeholder {
- color: @white-dark;
- }
-
- &::-moz-placeholder {
- color: @white-dark;
- }
-
- &:-ms-input-placeholder {
- color: @white-dark;
- }
-
- &:focus {
- outline: 0;
- }
-}
-
-.SearchBox__search-icon {
- color: @white-darker;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/ShareDialog.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/ShareDialog.jsx
deleted file mode 100644
index 2337de0..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/ShareDialog.jsx
+++ /dev/null
@@ -1,67 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import Dialog from './Dialog.jsx';
-import Icon from './Icon.jsx';
-
-import './ShareDialog.less';
-
-export default class ShareDialog extends Component {
- static propTypes = {
- title : PropTypes.string.isRequired,
- isOpen : PropTypes.bool.isRequired,
- onShare : PropTypes.func.isRequired,
- onRequestClose : PropTypes.func.isRequired
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- render() {
- const { title, onShare } = this.props;
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/ShareDialog.less b/parser_setup/__tests__/itsquiz-wall/shared/components/ShareDialog.less
deleted file mode 100644
index 66151e5..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/ShareDialog.less
+++ /dev/null
@@ -1,42 +0,0 @@
-.ShareDialog__buttons-container {
- display: flex;
- width: 350px;
- padding: 8px 0;
- max-width: 100%;
- justify-content: space-around;
-}
-
-.ShareDialog__button {
- width: 50px;
- height: 50px;
- border-radius: 50%;
- background-color: red;
- display: flex;
- cursor: pointer;
-
- &.ShareDialog__button--facebook {
- background-color: #47639E;
- }
-
- &.ShareDialog__button--google {
- background-color: #DB4437;
- }
-
- &.ShareDialog__button--twitter {
- background-color: #53A9EA;
- }
-
- &.ShareDialog__button--vk {
- background-color: #4E7094;
- }
-
- &.ShareDialog__button--linkedin {
- background-color: #0075B2;
- }
-}
-
-.ShareDialog__icon {
- font-size: 25px;
- color: white;
- margin: auto;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/WelcomeDialog.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/WelcomeDialog.jsx
deleted file mode 100644
index 7ff048c..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/WelcomeDialog.jsx
+++ /dev/null
@@ -1,190 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import Button from 'react-mdl/lib/Button';
-import IconButton from 'react-mdl/lib/IconButton';
-import Checkbox from 'react-mdl/lib/Checkbox';
-
-import Dialog from './Dialog.jsx';
-
-import './WelcomeDialog.less';
-
-export default class WelcomeDialog extends Component {
- static propTypes = {
- isOpen : PropTypes.bool.isRequired,
- onCreateTest : PropTypes.func,
- onDiscoverTests : PropTypes.func,
- onEnglishCampaign : PropTypes.func,
- onLearnMoreAboutItsquiz : PropTypes.func,
- onDismiss : PropTypes.func.isRequired
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- state = {
- currentSlide: 0,
- needToSkip: false
- };
-
- handleNextSlide = () => {
- const { currentSlide } = this.state;
-
- this.setState({
- currentSlide: currentSlide + 1
- });
- };
-
- handlePrevSlide = () => {
- const { currentSlide } = this.state;
-
- this.setState({
- currentSlide: currentSlide - 1
- });
- };
-
- handleSkipToggle = () => {
- const { needToSkip } = this.state;
-
- this.setState({
- needToSkip: !needToSkip
- });
- };
-
- handleClose = () => {
- const { needToSkip } = this.state;
-
- this.props.onDismiss(needToSkip);
- };
-
- render() {
- const { l } = this.context.i18n;
- const { onCreateTest, onDiscoverTests } = this.props;
- const { currentSlide, needToSkip } = this.state;
-
- const slides = [
-
-
-
-
-
-
-
{l('Welcome to It\'s quiz!')}
-
{l('Explore hundreds of open tests on Quiz Wall, check your knowledge, explore new topics, '
- + 'share your achievements with friends!')}
-
-
- {l('Learn more')}
-
-
-
,
-
-
-
-
-
-
-
-
{l('Check your knowledge')}
-
{l('Find out your language level, check knowledge of professional topics, pass entertainment '
- + 'tests or even find a new job! Everything absolutely free!')}
-
- {l('Discover tests')}
-
-
-
,
-
-
-
-
-
-
-
-
{l('Find best ever employees')}
-
{l('Filter out candidates who don’t meet your standards before you interview them. '
- + 'Create test for a position, publish on Quiz Wall, enjoy interviewing only the best!')}
-
- {l('Create a vacancy')}
-
-
-
,
-
-
-
-
-
-
-
-
{l('Create your own tests!')}
-
{l('Everyone can create a test on It\'s quiz! Simply add new questions, compose a quiz, '
- + 'activate and share with your friends!')}
-
- {l('Create a test')}
-
-
-
- ];
-
- const currentSlideIndex = currentSlide % slides.length;
-
- return (
-
-
-
-
-
-
-
-
-
- {slides[currentSlideIndex]}
-
-
-
-
-
-
-
-
-
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/WelcomeDialog.less b/parser_setup/__tests__/itsquiz-wall/shared/components/WelcomeDialog.less
deleted file mode 100644
index 51a4db4..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/WelcomeDialog.less
+++ /dev/null
@@ -1,121 +0,0 @@
-@import "../assets/mixins.less";
-@import "../assets/palette.less";
-@import "../assets/media.less";
-
-@button-area: 64px;
-
-.WelcomeDialog__dialog {
- @media @phone {
- min-height: 100vh !important;
- }
-}
-
-.WelcomeDialog__content {
- max-width: 100%;
- display: flex;
- align-items: center;
- flex-direction: column;
- flex: 1;
-
- @media @phone {
- height: 100%;
- justify-content: space-between;
- }
-}
-
-.WelcomeDialog__carousel {
- display: flex;
- align-items: center;
- max-width: 100%;
-}
-
-.WelcomeDialog__close {
- display: block;
- position: absolute;
- color: @grey-500;
- top: 10px;
- right: 10px;
-}
-
-.WelcomeDialog__slide-wrapper {
- box-sizing: border-box;
- min-width: 200px;
- width: calc(~"100% - "@button-area);
- padding: 10px;
- display: flex;
- min-height: 300px;
-}
-
-.WelcomeDialog__slide {
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- align-items: center;
-}
-
-.WelcomeDialog__slide-image {
- padding: 10px;
- flex: 1;
- min-width: 200px;
-
- @media @phone {
- flex: auto;
- width: 200px;
- }
-
- img {
- max-width: 100%;
-
- @media @phone {
- margin: auto;
- }
- }
-}
-
-.WelcomeDialog__btn {
- color: white !important;
-}
-
-.WelcomeDialog__skip {
- color: @additional-text-color;
- font-size: 12px;
-
- @media @phone {
- display: absolute;
- bottom: 5px;
- }
-}
-
-.WelcomeDialog__slide-content {
- padding: 10px;
- flex: 1;
- min-width: 200px;
- display: flex;
- flex-direction: column;
-
-
- @media @phone {
- align-items: center;
- }
-
- h1 {
- font-size: 22px;
- color: @text-color;
-
- @media @phone {
- text-align: center;
- font-weight: 500;
- font-size: 16px;
- }
- }
-
- p {
- font-size: 16px;
- color: @additional-text-color;
-
- @media @phone {
- text-align: center;
- font-size: 14px;
- }
- }
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/layouts/MainLayout.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/layouts/MainLayout.jsx
deleted file mode 100644
index 39b8f86..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/layouts/MainLayout.jsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-// import WelcomeDialog from '../../containers/WelcomeDialog.jsx';
-import Footer from '../../containers/Footer.jsx';
-
-import './MainLayout.less';
-
-export default class MainLayout extends Component {
- static propTypes = {
- showWelcomeScreen : PropTypes.bool,
- showFooter : PropTypes.bool,
- children : PropTypes.object,
- footerLinks : PropTypes.object,
- onWelcomeScreenDismiss : PropTypes.func
- };
-
- render() {
- // const { showWelcomeScreen, showFooter, children, onWelcomeScreenDismiss } = this.props;
- const { showFooter, children } = this.props;
-
- return (
-
-
- {/* */}
- {children}
-
-
- {
- showFooter
- ?
- : null
- }
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/layouts/MainLayout.less b/parser_setup/__tests__/itsquiz-wall/shared/components/layouts/MainLayout.less
deleted file mode 100644
index 8846e6c..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/layouts/MainLayout.less
+++ /dev/null
@@ -1,7 +0,0 @@
-.MainLayout {
- background-color: #eaeaea;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- min-height: 100vh;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/other/ScoreCircle.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/other/ScoreCircle.jsx
deleted file mode 100644
index e136497..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/other/ScoreCircle.jsx
+++ /dev/null
@@ -1,94 +0,0 @@
- /* eslint
- no-param-reassign: 0
-*/
-
-import React, { Component, PropTypes } from 'react';
-
-import ProgressBar from 'progressbar.js';
-import ColorUtil from '../../utils/ColorUtil';
-
-import './ScoreCircle.less';
-
-const RED = '#F71D1D';
-const ORANGE = '#EAB42C';
-const GREEN = '#47D62A';
-const PURPLE = '#00bcd4';
-
-class ScoreCircle extends Component {
- static propTypes = {
- value : PropTypes.number,
- size : PropTypes.number
- };
-
- componentWillMount() {
- this.id = Date.now();
- }
-
- componentDidMount() {
- this.colorUtil = new ColorUtil([RED, ORANGE, GREEN]);
- const { value } = this.props;
-
- this.scoreColor = '#FFF' || this.colorUtil.getColorCodeByPercent(value ? value : 0);
-
- this.circle = new ProgressBar.Circle(`#score-${this.id}`, {
- color: '#FCB03C',
- strokeWidth: 3,
- trailWidth: 1,
- duration: 1500,
- text: {
- value: `${value}%`,
- color: this.scoreColor
- },
- step: (state, shape) => {
- shape.path.setAttribute('stroke', state.color);
- shape.setText(`${(shape.value() * 100).toFixed(0)}%`);
- shape.text.style.color = state.color;
- }
- });
-
- this.circle.animate(value / 100, {
- from: { color: PURPLE },
- to: { color: this.scoreColor }
- });
- }
-
- shouldComponentUpdate(nextProps) {
- return nextProps.value !== this.props.value;
- }
-
- componentDidUpdate() {
- const { value } = this.props;
- const prevScoreColor = this.scoreColor;
-
- this.scoreColor = this.colorUtil.getColorCodeByPercent(value ? value : 0);
-
- this.circle.animate(value / 100, {
- from : { color: prevScoreColor },
- to : { color: this.scoreColor }
- });
- }
-
- componentWillUnmount() {
- this.circle = null;
- }
-
- render() {
- const { size } = this.props;
-
- const style = {
- width : size,
- height : size,
- fontSize : size / 3
- };
-
- return (
-
- );
- }
-}
-
-export default ScoreCircle;
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/other/ScoreCircle.less b/parser_setup/__tests__/itsquiz-wall/shared/components/other/ScoreCircle.less
deleted file mode 100644
index 1398228..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/other/ScoreCircle.less
+++ /dev/null
@@ -1,8 +0,0 @@
-.ScoreCircle {
- width: 100%;
- height: 100%;
-
- .progressbar-text {
- font-size: inherit;
- }
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationPage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationPage.jsx
deleted file mode 100644
index c4070a1..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationPage.jsx
+++ /dev/null
@@ -1,875 +0,0 @@
-import React, { PropTypes } from 'react';
-import cx from 'classnames';
-
-import { Card, CardTitle } from 'react-mdl/lib/Card';
-import Grid, { Cell } from 'react-mdl/lib/Grid';
-import Button from 'react-mdl/lib/Button';
-import IconButton from 'react-mdl/lib/IconButton';
-import Spinner from 'react-mdl/lib/Spinner';
-
-import { sendEvent } from '../../utils/googleAnalytics';
-
-import QuizTile from '../QuizTile.jsx';
-import Icon from '../Icon.jsx';
-import ShareDialog from '../../containers/ShareDialog.jsx';
-import LoginDialog from '../../containers/LoginDialog.jsx';
-import AppBarWithBackground from '../AppBarWithBackground.jsx';
-import ExpandableText from '../ExpandableText.jsx';
-import ScoreCircle from '../other/ScoreCircle.jsx';
-import Dialog from '../Dialog.jsx';
-
-import { sprintf } from '../../utils';
-
-import './ActivationPage.less';
-
-export default class ActivationPage extends React.Component {
- static propTypes = {
- activation : PropTypes.object,
- authorActivations : PropTypes.arrayOf(PropTypes.object),
- similarActivations : PropTypes.arrayOf(PropTypes.object),
- proposedActivations : PropTypes.arrayOf(PropTypes.object),
- showAccountResult : PropTypes.bool,
- isSurvey : PropTypes.bool,
- isAllAuthorActivationsLoaded : PropTypes.bool,
- sharingLink : PropTypes.string,
- accountQuizSession : PropTypes.object,
- isLoading : PropTypes.bool,
- isLoggingIn : PropTypes.bool,
- isEmbedded : PropTypes.bool,
- isShowingProposedActivations : PropTypes.bool,
- isOrganization : PropTypes.bool,
- isAvailable : PropTypes.bool,
- hideGoBackBtn : PropTypes.bool,
- isLoadingAuthorActivations : PropTypes.bool,
- dueTime : PropTypes.string,
- assessmentSystem : PropTypes.array,
- onPass : PropTypes.func,
- onShare : PropTypes.func,
- onShareComplete : PropTypes.func,
- onLoginDialogClose : PropTypes.func,
- onStopSharing : PropTypes.func,
- onGoBack : PropTypes.func,
- onShareResult : PropTypes.func,
- onFillProfile : PropTypes.func,
- onSponsoredClick : PropTypes.func,
- onViewAnswers : PropTypes.func,
- onActivationClick : PropTypes.func,
- onLoadAllAuthorActivations : PropTypes.func,
- onCloseMessageNotAvailable : PropTypes.func
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- componentWillMount() {
- const { l } = this.context.i18n;
-
- this.sponsoredButtonLabel = Math.random() < 0.5 ? l('Contact me') : l('Get the gift');
- }
-
- handleActivationClick = (activation) => {
- this.props.onActivationClick(activation);
- };
-
- handlePassViaTelegram = () => {
- sendEvent('Activation Page', 'Pass via Telegram');
- };
-
- getGreeting = () => {
- const { l } = this.context.i18n;
- const { activation, assessmentSystem, isSurvey } = this.props;
- const score = activation.accountQuizSession.score;
-
- if (isSurvey) {
- return { phrase: l('Thank you for your answers!') };
- }
-
- if (assessmentSystem.length === 0) {
- if (score > 95) {
- return { phrase: l('You rock! Excellent job!') };
- }
-
- if (score > 75) {
- return { phrase: l('Great result!') };
- }
-
- if (score > 50) {
- return { phrase: l('Good job!') };
- }
-
- if (score > 30) {
- return { phrase: l('You could do better!') };
- }
-
- return { phrase: l('You could do better!') };
- }
-
- for (let i = assessmentSystem.length - 1; i >= 0; i--) {
- if (score >= assessmentSystem[i].grade) {
- return {
- phrase: assessmentSystem[i].phrase,
- description: assessmentSystem[i].description || ''
- };
- }
- }
- };
-
- renderStatisticsForSurvey = () => {
- const { activation } = this.props;
- const { l } = this.context.i18n;
-
- if (!activation.accountQuizSession) return null;
-
- return (
-
- {sprintf(l('(%d of %d answered)'), activation.accountQuizSession.answeredQuestionsNumber,
- activation.accountQuizSession.totalQuestionsNumber)}
-
- );
- };
-
- renderProposedActivations = () => {
- if (!this.props.proposedActivations) {
- return;
- }
-
- return (
-
- {
- this.props.proposedActivations.map(proposedActivation =>
-
-
-
- )
- }
-
- );
- };
-
- renderAuthorActivations = () => {
- const {
- activation,
- authorActivations,
- isAllAuthorActivationsLoaded,
- isLoadingAuthorActivations,
- onLoadAllAuthorActivations
- } = this.props;
-
- const { l } = this.context.i18n;
-
- if (authorActivations && authorActivations.length) {
- return (
-
-
- {sprintf(l('More tests by %s'), activation.author.fullName)}
-
-
-
- {
- authorActivations.map(authorActivation =>
-
-
- |
- )
- }
-
-
- {
- isLoadingAuthorActivations
- ?
-
- :
- null
- }
-
- {
- !isAllAuthorActivationsLoaded
- ?
-
- {l('Load more')}
-
- :
- null
- }
-
- );
- }
-
- return null;
- };
-
- renderSimilarActivations = () => {
- const {
- similarActivations
- } = this.props;
-
- const { l } = this.context.i18n;
-
- if (similarActivations && similarActivations.length) {
- return (
-
-
- {l('Similar tests')}
-
-
-
- {
- similarActivations.map(similarActivation =>
-
-
- |
- )
- }
-
-
- );
- }
-
- return null;
- };
-
- renderContent = () => {
- const {
- activation,
- isLoading,
- showAccountResult,
- isEmbedded,
- isSurvey,
- onPass,
- onShare,
- onShareResult,
- onFillProfile,
- onSponsoredClick,
- onViewAnswers
- } = this.props;
-
- const {
- id,
- pictureURL,
- name,
- isPrivate,
- canPassViaChat,
- accountQuizSession,
- numberOfQuestions,
- timeToPass,
- author,
- isSponsored,
- canAssigneePass,
- numberOfTriesLeft,
- dueTime,
- canAssigneeViewQuestions
- } = activation;
-
- const { l, nl, humanizeDuration, getTimeFromNow } = this.context.i18n;
-
- const isPassingBtnAvailable = isEmbedded ? canAssigneePass : true;
-
- const greeting = showAccountResult ? this.getGreeting().phrase : '';
- const greetingDescription = showAccountResult ? this.getGreeting().description : '';
-
- if (isLoading) {
- return ;
- }
-
- const classes = cx('ActivationPage__activation', {
- 'ActivationPage__activation--sponsored': isSponsored,
- 'ActivationPage__activation--passed': showAccountResult
- });
-
- const passInfoClasses = cx('ActivationPage__pass-info', { 'ActivationPage__pass-info--expires': dueTime });
-
- const settingsIconsClasses = cx('ActivationPage__settings-icons--indented', {
- 'ActivationPage__settings-icons--on' : canAssigneeViewQuestions,
- 'ActivationPage__settings-icons--off' : !canAssigneeViewQuestions
- });
-
- const resultsContainerClasses = showAccountResult
- ? cx('ActivationPage__results-container', accountQuizSession.resultBackground, { 'survey' : isSurvey })
- : '';
-
- return (
-
-
-
-
-
-
- {name}
- {
- isPrivate
- ?
-
- {l('private')}
-
- : null
- }
-
-
-
- {author.fullName}
-
-
-
-
- {
- sprintf(
- nl('%d question', '%d questions', numberOfQuestions),
- numberOfQuestions
- )
- }
-
-
-
- •
-
-
-
- {humanizeDuration(timeToPass, 'second')}
-
-
- {
- dueTime
- ? (
-
-
- •
-
- {sprintf(l('expires %s'), getTimeFromNow(dueTime))}
-
-
- )
- : null
- }
-
-
-
-
-
-
-
- {
- showAccountResult && !isSurvey
- ?
-
- {l('Share result with friends')}
-
- :
- null
- }
-
- {
- !showAccountResult && isPassingBtnAvailable
- ?
-
-
- {l('Pass the test')}
-
- {
- canPassViaChat
- ?
-
- {l('pass via Telegram')}
-
- :
- null
- }
- {
- numberOfTriesLeft
- ?
-
- {
- sprintf(
- nl(
- 'You have %d try left',
- 'You have %d tries left',
- numberOfTriesLeft),
- numberOfTriesLeft
- )
- }
-
- :
- null
- }
-
- :
- null
- }
-
- {
- isSponsored
- ? (
-
- {this.sponsoredButtonLabel}
-
- )
- : null
- }
-
-
-
-
- {
- !activation.isPrivate && !isSurvey
- ? (
-
- )
- : null
- }
-
-
-
- {
- showAccountResult
- ?
-
-
-
- {
- !activation.isPrivate && !isSurvey
- ? (
-
- )
- : null
- }
-
-
-
- {
- !isSurvey
- ?
-
-
-
-
- :
- null
- }
-
- {
- !isSurvey
- ?
-
- ({
- sprintf(
- nl(
- '%s of %s point',
- '%s of %s points',
- accountQuizSession.maxPoints
- ),
- accountQuizSession.gainedPoints,
- accountQuizSession.maxPoints
- )
- })
-
- :
- null
- }
-
-
-
- {greeting}
-
-
- {
- !isSurvey
- ?
-
- {l('Share result')}
-
- :
- null
- }
-
- {
- !isSurvey
- ?
-
- {accountQuizSession.score}%
-
- :
- this.renderStatisticsForSurvey()
- }
-
- {
- !isSurvey
- ?
-
- ({
- sprintf(
- nl(
- '%s of %s point',
- '%s of %s points',
- accountQuizSession.maxPoints
- ),
- accountQuizSession.gainedPoints,
- accountQuizSession.maxPoints
- )
- })
-
- :
- null
- }
-
- {
- accountQuizSession.canViewAnswers
- ?
-
- {l('View my answers')}
-
- : null
- }
-
- {
- isPassingBtnAvailable
- ? (
-
-
- {
- accountQuizSession.gainedPoints
- === accountQuizSession.maxPoints
- ?
- l('Pass the test')
- :
- l('Improve result')
- }
-
- {
- canPassViaChat
- ?
-
- {l('pass via Telegram')}
-
- :
- null
- }
- {
- numberOfTriesLeft
- ?
-
- {
- sprintf(
- nl(
- 'You have %d try left',
- 'You have %d tries left',
- numberOfTriesLeft),
- numberOfTriesLeft
- )
- }
-
- :
- null
- }
-
- )
- : null
- }
-
-
-
- {
- isPassingBtnAvailable
- ? (
-
-
- {
- accountQuizSession.gainedPoints
- === accountQuizSession.maxPoints
- ?
- l('Pass the test')
- :
- l('Improve result')
- }
-
- {
- canPassViaChat
- ?
-
- {l('pass via Telegram')}
-
- :
- null
- }
- {
- numberOfTriesLeft
- ?
-
- {
- sprintf(
- nl(
- 'You have %d try left',
- 'You have %d tries left',
- numberOfTriesLeft),
- numberOfTriesLeft
- )
- }
-
- :
- null
- }
-
- )
- : null
- }
-
- {
- accountQuizSession.canViewAnswers
- ?
-
- {l('View my answers')}
-
- : null
- }
-
- {
- activation.category === 'VACANCY'
- ?
-
- {l('Fill in your resume')}
-
-
- {l('Filled profiles receive 70% more views')}
-
-
- : null
- }
-
-
-
- : null
- }
-
-
-
-
-
-
- {this.renderSimilarActivations()}
- {this.renderAuthorActivations()}
-
- );
- }
-
- render() {
- const { l } = this.context.i18n;
- const {
- activation,
- showAccountResult,
- sharingLink,
- isLoading,
- isLoggingIn,
- isEmbedded,
- isOrganization,
- isAvailable,
- onCloseMessageNotAvailable,
- hideGoBackBtn,
- onLoginDialogClose,
- onStopSharing,
- onGoBack
- } = this.props;
-
- const classes = cx('ActivationPage', {
- 'ActivationPage--loading' : isLoading,
- 'ActivationPage--embedded' : isEmbedded
- });
-
- return (
-
-
-
-
-
-
-
- {
-
-
- {l('Unfortunately, this quiz is not available. Author will be informed.')}
-
-
- }
-
- {this.renderProposedActivations()}
-
-
- {this.renderContent()}
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationPage.less b/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationPage.less
deleted file mode 100644
index 990b60e..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationPage.less
+++ /dev/null
@@ -1,750 +0,0 @@
-@import "../../assets/mixins.less";
-@import "../../assets/palette.less";
-@import "../../assets/media.less";
-
-.ActivationPage {
- margin: 0 auto;
- position: relative;
- width: 100%;
- box-sizing: border-box;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- background-color: @background-color;
-}
-
-.ActivationPage__content {
- margin: 0 auto;
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 100%;
- min-width: 300px;
- max-width: 800px;
-}
-
-.ActivationPage__activation {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 100%;
-}
-
-.ActivationPage__span-divider {
- margin: 0 10px;
-}
-
-.ActivationPage__menu {
- position: absolute;
- top: 16px;
- right: 16px;
-}
-
-.ActivationPage__menu--mobile {
- display: none;
-
- @media @phone {
- display: block;
- position: absolute;
- top: 16px;
- right: 16px;
- color: @white-darker;
- }
-}
-
-.ActivationPage__spinner {
- margin-top: 30px;
-}
-
-.ActivationPage__private-tag {
- display: inline-block;
- padding: 5px;
- background-color: @amber-app;
- border-radius: 5px;
- font-size: 15px;
- width: auto;
- margin-left: 10px;
- font-weight: 500;
- color: @white-darker;
-
- .ActivationPage__lock {
- margin: 0 3px;
- }
-}
-
-.ActivationPage__offer-btn {
- font-size: 16px;
-
- .Icon {
- font-size: 18px;
- }
-}
-
-.ActivationPage__paper {
- align-self: center;
- margin: 8px;
- margin-top: 150px;
- width: calc(~"100% - 32px");
-
- @media @phone {
- margin-top: 65px;
- }
-
- .ActivationPage__actions {
- margin: 16px 0;
- display: flex;
- justify-content: flex-end;
- }
-
- .ActivationPage__head {
- padding: 0;
- display: flex;
- padding: 16px;
- align-items: flex-start;
-
- @media @phone {
- flex-direction: column;
- align-items: center;
- }
-
- .ActivationPage__picture {
- width: 150px;
- height: 150px;
- border-radius: 150px;
- flex-shrink: 0;
- }
-
- .ActivationPage__info {
- margin-left: 16px;
- display: flex;
- flex-direction: column;
- position: relative;
- width: 100%;
- height: 150px;
-
- @media @phone {
- margin-left: 0;
- height: auto;
- margin-top: 24px;
- align-items: center;
- }
-
- .ActivationPage__heading {
- width: calc(~"100% - 40px");
-
- .ActivationPage__name {
- font-size: 25px;
- font-weight: 300;
-
- @media @phone {
- width: 100%;
- text-align: center;
- }
- }
-
- @media @phone {
- width: 100%;
- text-align: center;
- margin-bottom: 10px;
- }
- }
-
- .ActivationPage__author-name {
- margin-top: 5px;
- font-weight: bold;
- font-size: 15px;
- color: @additional-text-color;
- }
-
- .ActivationPage__price {
- margin: 0 20px;
- font-weight: bold;
- font-size: 16px;
- color: @green-200;
- text-transform: uppercase;
- }
-
- .ActivationPage__pass-info {
- margin-top: 5px;
- font-size: 15px;
- color: @secondary-text-color;
- font-weight: 400;
- }
-
- .ActivationPage__pass-info--expires {
- @media @phone {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- }
-
- .ActivationPage__expires {
- @media @phone {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- }
-
- .ActivationPage__settings-icons {
- margin-top: 5px;
-
- &--off {
- opacity: 0.5;
- }
-
- &--indented {
- margin-right: 6px;
- }
-
- @media @phone {
- text-align: center;
- }
- }
-
- .ActivationPage__actions {
- position: absolute;
- display: flex;
- flex-direction: row;
- align-items: center;
- right: 0;
- bottom: 0;
-
- @media @phone {
- position: relative;
- margin-bottom: 10px;
- margin-top: 20px;
- flex-direction: column;
-
- .ActivationPage__btn {
- order: 1;
- }
- }
- }
-
- .ActivationPage__btn {
- background-color: @green-app;
- color: @white-darker;
- }
-
- .ActivationPage__number-of-tries {
- color: @secondary-text-color;
- font-size: 12px;
- margin-top: 8px;
- text-align: center;
- }
- }
- }
-
- .ActivationPage__head--passed {
- padding: 0;
- display: flex;
- padding: 16px;
- align-items: flex-start;
-
- @media @phone {
- flex-direction: column;
- align-items: center;
- }
-
- .ActivationPage__picture {
- width: 150px;
- height: 150px;
- border-radius: 150px;
- flex-shrink: 0;
- }
-
- .ActivationPage__info {
- margin-left: 16px;
- display: flex;
- flex-direction: column;
- position: relative;
- width: 100%;
- height: 150px;
-
- @media @phone {
- margin-left: 0;
- height: auto;
- margin-top: 24px;
- align-items: center;
- }
-
- .ActivationPage__heading {
- width: calc(~"100% - 40px");
-
- .ActivationPage__name {
- font-size: 25px;
- font-weight: 300;
-
- @media @phone {
- width: 100%;
- text-align: center;
- }
- }
-
- @media @phone {
- width: 100%;
- text-align: center;
- margin-bottom: 10px;
- }
- }
-
- .ActivationPage__author-name {
- margin-top: 5px;
- font-weight: bold;
- font-size: 15px;
- color: @additional-text-color;
- }
-
- .ActivationPage__price {
- margin: 0 20px;
- font-weight: bold;
- font-size: 16px;
- color: @green-200;
- text-transform: uppercase;
- }
-
- .ActivationPage__pass-info {
- margin-top: 5px;
- font-size: 15px;
- color: @secondary-text-color;
- font-weight: 400;
- }
-
- .ActivationPage__pass-info--expires {
- @media @phone {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- }
-
- .ActivationPage__expires {
- @media @phone {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- }
-
- .ActivationPage__settings-icons {
- margin-top: 5px;
-
- &--off {
- opacity: 0.5;
- }
-
- &--indented {
- margin-right: 6px;
- }
-
- @media @phone {
- text-align: center;
- }
- }
-
- .ActivationPage__actions {
- position: absolute;
- display: flex;
- flex-direction: row;
- align-items: center;
- right: 0;
- bottom: 0;
-
- @media @phone {
- position: relative;
- margin-bottom: 10px;
- margin-top: 20px;
- flex-direction: column;
-
- .ActivationPage__btn {
- order: 1;
- }
- }
- }
-
- .ActivationPage__btn {
- background-color: @green-app;
- color: @white-darker;
- }
-
- .ActivationPage__number-of-tries {
- color: @secondary-text-color;
- font-size: 12px;
- margin-top: 8px;
- text-align: center;
- }
- }
-
- @media @phone {
- display: none;
- }
- }
-
- .ActivationPage__divider {
- width: 100%;
- height: 1px;
- background-color: @white-lighter;
- margin: 0 auto;
- }
-
- .ActivationPage__author {
- margin-top: 10px;
- }
-}
-
-.ActivationPage__ad {
- margin-bottom: 16px;
-}
-
-.ActivationPage_score--circle {
- display: none;
-
- .ScoreCircle {
- margin: 0px auto;
- }
-
- @media @phone {
- display: block;
- }
-}
-
-.ActivationPage__greeting {
- margin-top: 5px;
- color: @white-darker;
- text-shadow: rgba(0, 0, 0, 0.3) 2px 0px 3px;
- margin-bottom: 10px;
- // max-width added for transposition of long words
- max-width: 470px;
- word-wrap: break-word;
-
- @media @phone {
- margin-top: 15px;
- max-width: 280px;
- font-size: 20px;
- line-height: normal;
- font-size: 18px;
- }
-}
-
-.ActivationsPage__greeting-description {
- font-size: 14px;
- color: #fff;
- text-decoration: underline;
- cursor: pointer;
-
- &:hover {
- text-decoration: none;
- }
-}
-
-.ActivationPage__activation--sponsored {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 100%;
-}
-
-.ActivationPage__score {
- font-size: 38px;
- color: @white-darker;
- text-shadow: rgba(0, 0, 0, 0.3) 2px 0px 3px;
- margin: 16px 0;
-
- @media @phone {
- display: none;
- }
-}
-
-.ActivationPage__points, .ActivationPage__survey-statistics {
- font-size: 12px;
- text-shadow: rgba(0, 0, 0, 0.3) 2px 0px 3px;
- color: @white-darker;
-
- @media @phone {
- display: none;
- }
-}
-
-.ActivationPage__points--mobile {
- font-size: 12px;
- text-shadow: rgba(0, 0, 0, 0.3) 2px 0px 3px;
- color: @white-darker;
- display: none;
-
- @media @phone {
- display: block;
- margin-top: 10px;
- }
-}
-
-.ActivationPage__overlay {
- background-color: rgba(0,0,0,0.1);
-}
-
-.ActivationPage__result-share-btn {
- background-color: @green-app;
- color: @white-darker;
- display: block;
- margin: 6px auto;
-
- &:hover {
- background-color: @green-app;
- }
-}
-
-.ActivationPage__result-share-btn--mobile {
- display: none;
-
- @media @phone {
- display: block;
- background-color: @green-app;
- color: @white-darker;
- margin: 0px auto;
- margin-top: 19px;
-
- &:hover {
- background-color: @green-app;
- }
- }
-}
-
-.ActivationPage__result-answers-btn {
- margin: 6px auto;
- color: @white-darker;
- display: block;
-}
-
-.ActivationPage__result-answers-btn--mobile {
- margin: 6px auto;
- color: @white-darker;
- display: none;
-
- @media @phone {
- display: block;
- }
-}
-
-.ActivationPage__fill-profile-btn {
- margin: 6px auto;
- color: @white-darker;
- background-color: rgba(255, 255, 255, 0.05);
- display: block;
-}
-
-.ActivationPage__results-text {
- flex: 1;
- padding: 30px;
-
- @media @phone {
- padding: 10px 30px;
- }
-}
-
-.ActivationPage__results-actions {
- flex: 0.5;
- display: flex;
- justify-content: center;
- flex-direction: column;
- margin-top: 30px;
-
- @media @phone {
- display: none;
- margin-left: 0px;
- }
-}
-
-.ActivationPage__overlay {
- position: absolute;
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
- align-items: center;
- display: flex;
-
- @media @phone {
- flex-direction: column;
- }
-}
-
-.ActivationPage__tip {
- font-size: 12px;
- color: @white-dark;
- margin: 0 auto;
- text-align: center;
-}
-
-.ActivationPage__results-container {
- position: relative;
- width: 100%;
- min-height: 200px;
- background-position: center;
- background-size: cover;
-
- &.verybad {
- background-image: url('/static/images/resultBackgrounds/verybad.png');
- }
-
- &.bad {
- background-image: url('/static/images/resultBackgrounds/bad.png');
- }
-
- &.normal {
- background-image: url('/static/images/resultBackgrounds/normal.png');
- }
-
- &.good {
- background-image: url('/static/images/resultBackgrounds/good.png');
- }
-
- &.excellent {
- background-image: url('/static/images/resultBackgrounds/excellent.png');
- }
-
- @media @phone {
- min-height: 535px;
- text-align: center;
-
- &.survey {
- min-height: 170px;
- }
- }
-}
-
-.ActivationPage__subheader {
- font-weight: bold;
- align-self: flex-start;
- margin: 32px 18px -8px 18px;
-}
-
-.ActivationPage__author-activations-grid,
-.ActivationPage__similar-activations-grid {
- box-sizing: border-box;
- width: 100%;
-
- .mdl-cell {
- height: 100% !important;
- }
-}
-
-.ActivationPage__author-activations,
-.ActivationPage__similar-activations {
- width: 100%;
-}
-
-.ActivationPage__telegram-link {
- display: block;
- font-size: 12px;
- margin-top: 6px;
- text-align: center;
- color: @secondary-text-color;
-}
-
-.ActivationPage__pass-btn-wrapper-passed {
- margin: 0px auto;
-
- .ActivationPage__pass-btn {
- background-color: @white-darker;
- }
-
- .ActivationPage__number-of-tries {
- color: @white-darker;
- font-size: 12px;
- margin-top: 6px;
- text-align: center;
- }
-
- @media @phone {
- display: none;
- }
-}
-
-.ActivationPage__pass-btn-wrapper-passed--mobile {
- display: none;
-
- @media @phone {
- background-color: @white-darker;
- flex: 1;
- display: flex;
- justify-content: center;
- flex-direction: column;
- width: 200px;
- margin: 0px auto;
- margin-top: 10px;
- }
-}
-
-.ActivationPage__activation--sponsored {
-
- .ActivationPage__pass-btn {
- margin-right: 10px;
- background-color: @green-50 !important;
- color: @green-700 !important;
-
- @media @phone {
- order: 2;
- margin-right: 0;
- margin-top: 10px;
- }
- }
-}
-
-.ActivationPage__proposed-activations {
- background-color: rgba(0, 0, 0, 0);
- position: fixed;
- right: 0px;
- top: 50%;
- transform: translateY(-50%);
- display: flex;
- flex-direction: column;
- width: 150px;
- height: 420px;
- z-index: 2;
- justify-content: space-between;
- transition: right 0.3s ease-in-out;
- right: -150px;
-
-
- &--hidden {
- &:extend(.ActivationPage__proposed-activations all);
- }
-
- &--visible {
- &:extend(.ActivationPage__proposed-activations all);
- right: 0px;
- }
-
- @media @phone {
- display: none;
- }
-
- .ActivationPage__proposed-activation {
- .QuizTile {
- height: 100%;
- }
- }
-}
-
-.ActivationPage__author-activations-spinner {
- display: block;
- margin: 10px auto 0;
-}
-
-.ActivationPage__load-more-btn {
- color: #fff !important;
- background-color: @accent-1-color !important;
- margin: 10px auto 0;
- display: block;
-}
-
-.ActivationPage__advertisement-wrapper {
- padding: 10px;
- background: #d8f9ff;
- font-size: 14px;
-
- a {
- cursor: pointer;
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationsPage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationsPage.jsx
deleted file mode 100644
index 8b233aa..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationsPage.jsx
+++ /dev/null
@@ -1,296 +0,0 @@
-import React from 'react';
-import cx from 'classnames';
-
-import { Tab, Tabs } from 'react-mdl/lib/Tabs';
-import ReactList from 'react-list';
-import { Card } from 'react-mdl/lib/Card';
-import Spinner from 'react-mdl/lib/Spinner';
-import Button from 'react-mdl/lib/Button';
-
-import QuizCard from '../QuizCard.jsx';
-import AppBar from '../AppBar.jsx';
-import ShareDialog from '../../containers/ShareDialog.jsx';
-import LoginDialog from '../../containers/LoginDialog.jsx';
-import Icon from '../Icon.jsx';
-
-import './ActivationsPage.less';
-
-const CATEGORIES = ['ALL', 'VACANCY', 'EDUCATION', 'ENTERTAINMENT', 'SPECIAL'];
-
-export default class ActivationsPage extends React.Component {
- static propTypes = {
- activations : React.PropTypes.arrayOf(React.PropTypes.object),
- search : React.PropTypes.string,
- totalActivationsAmount : React.PropTypes.number,
- sortType : React.PropTypes.string,
- selectedCategory : React.PropTypes.string,
- linkToShare : React.PropTypes.string,
- isLoading : React.PropTypes.bool,
- isEmpty : React.PropTypes.bool,
- isSharing : React.PropTypes.bool,
- isEmbedded : React.PropTypes.bool,
- isLoggingIn : React.PropTypes.bool,
- onSearch : React.PropTypes.func,
- onSpecialsSubscribe : React.PropTypes.func,
- onChangeSortType : React.PropTypes.func,
- onTabChange : React.PropTypes.func,
- onLoginClose : React.PropTypes.func,
- onStopSharing : React.PropTypes.func,
- onItemClick : React.PropTypes.func,
- onSubscribe : React.PropTypes.func,
- onShare : React.PropTypes.func,
- onItemRenderRequest : React.PropTypes.func,
- onAuthorAvatarClick : React.PropTypes.func
- };
-
- static contextTypes = { i18n: React.PropTypes.object };
-
- handleTabClick = (index, e) => {
- e.preventDefault();
-
- this.props.onTabChange(CATEGORIES[index]);
- };
-
- renderQuizItem = (index, key) => {
- const {
- activations,
- onShare,
- onItemClick,
- onAuthorAvatarClick,
- onItemRenderRequest
- } = this.props;
-
- const activation = activations[index];
-
- const isSurvey = activation.accountQuizSession ? activation.accountQuizSession.maxPoints === 0 : false;
-
- onItemRenderRequest(index);
-
- if (!activation) {
- return (
-
-
-
- );
- }
-
- return (
-
- );
- };
-
- renderQuizItemsGrid = (items, ref) => {
- return (
-
- );
- };
-
- renderContent = () => {
- const { l } = this.context.i18n;
-
- const {
- activations,
- totalActivationsAmount,
- search,
- isLoading,
- isEmpty
- } = this.props;
-
- if (isLoading) {
- return ;
- }
-
- if (isEmpty && search) {
- return (
-
- {l('Sorry, we couldn\'t find any tests for ')} {search}
-
- );
- }
-
- if (isEmpty) {
- return (
-
- {l('There are no activations in this category yet')}
-
- );
- }
-
- return (
-
-
-
- {
- activations.length < totalActivationsAmount
- ?
-
-
- : null
- }
-
- );
- };
-
- render() {
- const {
- search,
- sortType,
- selectedCategory,
- isSharing,
- isEmbedded,
- isLoggingIn,
- isLoading,
- linkToShare,
- onSearch,
- onSpecialsSubscribe,
- onChangeSortType,
- onLoginClose,
- onStopSharing
- } = this.props;
-
- const { l } = this.context.i18n;
-
- const classes = cx('ActivationsPage', {
- 'ActivationsPage--embedded' : isEmbedded,
- 'ActivationsPage--loading' : isLoading
- });
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
- {l('All tests')}
-
-
-
- {l('Vacancies')}
-
-
-
- {l('Education')}
-
-
-
- {l('Entertainment')}
-
-
-
- {l('Special offer')}
-
-
-
-
-
- {l('Newest first')}
-
-
-
- {l('Popular first')}
-
-
-
-
-
-
-
- {
- selectedCategory === 'SPECIAL' && !isEmbedded
- ?
-
- {l('I want to receive new special offers')}
-
- :
- null
-
- }
-
- {this.renderContent()}
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationsPage.less b/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationsPage.less
deleted file mode 100644
index 429d208..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/ActivationsPage.less
+++ /dev/null
@@ -1,251 +0,0 @@
-@import "../../assets/palette.less";
-@import "../../assets/media.less";
-
-.ActivationsPage {
- background-color: @background-color;
- width: 100%;
- overflow: hidden;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
-
- .ActivationsPage__toolbar-container {
- height: 48px;
- background-color: @primary-1-color;
- display: flex;
- justify-content: center;
-
- @media @phone {
- width: 100%;
- overflow: auto;
-
- .mdl-tabs {
- width: 500px;
- }
-
- &::-webkit-scrollbar {
- display: none;
- }
- }
-
- .mdl-tabs {
- width: auto;
- }
-
- .mdl-tabs__tab-bar {
- width: auto;
- justify-content: center;
- border-bottom: none;
- }
-
- .mdl-tabs__tab {
- color: @white-dark;
- font-weight: regular;
- font-size: 14px;
-
- &::after {
- background: @accent-1-color;
- }
-
- &.is-active {
- color: @white-darker;
- }
-
- .mdl-ripple {
- background: white;
- }
- }
-
- .mdl-tabs__tab.is-active::after {
- background: @accent-1-color;
- }
- }
-
- .ActivationsPage__toolbar {
- display: flex;
- padding-left: 50px;
- padding-right: 50px;
- width: 100%;
- max-width: 1300px;
- box-sizing: border-box;
- justify-content: center;
- }
-}
-
-.ActivationsPage__header {
- box-shadow: 0 3px 4px 0 rgba(0,0,0,.14),0 3px 3px -2px rgba(0,0,0,.2),0 1px 8px 0 rgba(0,0,0,.12);
- position: fixed;
- z-index: 999;
- width: 100%;
- top: 0;
-}
-
-.ActivationsPage__content {
- margin-top: 120px;
- margin-bottom: 120px;
- width: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
-}
-
-.ActivationsPage__empty-state {
- font-size: 20px;
- text-align: center;
- max-width: 500px;
- line-height: 30px;
- color: @additional-text-color;
- margin-top: 50px;
- font-weight: 300;
-}
-
-.ActivationsPage__special-tab {
- background-color: rgba(0, 0, 0, 0);
-
- // temporary hide special-tab
- display: none;
-}
-
-.ActivationsPage__tab-text {
- @media @phone {
- display: none;
- }
-}
-
-.ActivationsPage__tab-icon {
- display: none;
- font-size: 18px;
-
- @media @phone {
- display: inline-block;
- }
-}
-
-.ActivationsPage__list {
- width: 100%;
- max-width: 1200px;
- margin: 0 auto;
-}
-
-.ActivationsPage__spinner {
- margin: 10px;
-}
-
-.ActivationsPage__subscribe-btn {
- background-color: @accent-1-color !important;
- color: white !important;
- margin-top: 8px;
-}
-
-.ActivationsPage--embedded {
- width: 100%;
-
- .ActivationsPage__app-bar {
- display: none;
- }
-
- .ActivationPage__select {
- color: @accent-1-color;
- }
-
- .ActivationsPage__toolbar-container {
- background-color: @white-darker;
- top: 0;
-
- .mdl-tabs__tab {
- color: @black-dark;
- font-weight: medium;
- font-size: 14px;
-
- &.is-active {
- color: @black-darker;
- }
- }
- }
-
- .ActivationsPage__content {
- margin-top: 60px;
- margin-bottom: 60px;
- }
-}
-
-.ActivationsPage__grid-container {
- display: flex;
- flex-direction: column;
- max-width: 1300px;
- align-items: center;
- justify-content: center;
-}
-
-.ActivationsPage__grid {
- display: flex;
- flex-wrap: wrap;
- width: 100%;
- align-items: center;
- justify-content: center;
-}
-
-.ActivationsPage__grid-toolbar {
- height: 50px;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100%;
-}
-
-.ActivationPage__select {
- background-color: transparent;
- text-transform: uppercase;
- cursor: pointer;
- border: 0;
- height: 49px;
- font-size: 14px;
- padding: 0 5px;
- font-weight: 500;
- text-overflow: "";
- color: @white-darker;
- -webkit-appearance: none;
- appearance: none;
- margin: 0 10px;
-
- option {
- color: black;
- background-color: white;
- }
-
- &:focus{
- outline: 0;
- }
-
- &::-ms-expand { display: none; }
-
- @media @phone {
- display: none;
- font-size: 11px;
- }
-}
-
-.ActivationsPage__loading-next-spinner-container {
- width: 100%;
- margin-top: 70px;
- display: flex;
- justify-content: center;
-}
-
-.ActivationsPage__quiz-card {
- margin: 10px;
- width: 300px;
- height: 394px;
-}
-
-.ActivationsPage__card-spinner {
- margin: auto;
-}
-
-.ActivationsPage__loading-card {
- width: 300px;
- height: 393px;
- margin: 10px;
- display: flex;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/BasicSharePage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/pages/BasicSharePage.jsx
deleted file mode 100644
index 7fc585f..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/BasicSharePage.jsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-
-export default class BasicSharePage extends React.Component {
- static propTypes = {
- title : React.PropTypes.string,
- picture : React.PropTypes.string,
- text : React.PropTypes.string
- };
-
- render() {
- const {
- title,
- picture,
- text
- } = this.props;
-
- return (
-
-
{title}
-
-
{text}
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/PromoPage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/components/pages/PromoPage.jsx
deleted file mode 100644
index 0e08312..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/PromoPage.jsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import React from 'react';
-
-import { Card } from 'react-mdl/lib/Card';
-
-import Markdown from '../Markdown.jsx';
-
-import './PromoPage.less';
-
-export default class PromoPage extends React.Component {
- static propTypes = {
- title : React.PropTypes.string,
- picture : React.PropTypes.string,
- text : React.PropTypes.string
- };
-
- render() {
- const {
- picture,
- text
- } = this.props;
-
- return (
-
-
-
-
-
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/PromoPage.less b/parser_setup/__tests__/itsquiz-wall/shared/components/pages/PromoPage.less
deleted file mode 100644
index 33eabc3..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/components/pages/PromoPage.less
+++ /dev/null
@@ -1,17 +0,0 @@
-.PromoPage {
-}
-
-.PromoPage__head {
- width: 100%;
-}
-
-.PromoPage__content {
- background-color: #ffffff;
- padding-left: 24px;
- padding-right: 24px;
- width: 100%;
- height: 100%;
- max-width: 800px;
- margin: 0 auto;
- margin-top: 20px;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/config.js b/parser_setup/__tests__/itsquiz-wall/shared/config.js
deleted file mode 100644
index ef002d8..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/config.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- eslint
- import/no-commonjs: 0
- import/no-unresolved: 0
-*/
-
-if (process.env.BROWSER) {
- module.exports = window.__CONFIG__;
-} else {
- const confme = require('confme');
- const path = require('path');
-
- const config = confme(path.join(__dirname, '../etc/client-config.json'));
-
- module.exports = config;
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/App.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/App.jsx
deleted file mode 100644
index bafb9de..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/App.jsx
+++ /dev/null
@@ -1,154 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import EmbedEvents from '../utils/EmbedEventsUtil';
-import config from '../config';
-import { initialize, navigate } from '../utils/googleAnalytics';
-import isIOSDevice from '../utils/isIOSDevice';
-
-if (process.env.BROWSER) {
- require('../assets');
-}
-
-const TIMER_DELAY = 1000;
-
-const embedEvents = new EmbedEvents({
- embedOrigin: config.embedOrigin
-});
-
-export default class App extends Component {
- static propTypes = {
- location : PropTypes.object,
- routes : PropTypes.array,
- children : PropTypes.object,
- history : PropTypes.object
- };
-
- componentWillMount() {
- this.appContainerHeight = 0;
-
- clearInterval(this.iframeHeightCalcTimer);
- }
-
- componentDidMount() {
- initialize();
- const routes = this.props.routes;
-
- navigate({
- page : this.props.location.pathname,
- title : routes[routes.length - 1].path
- });
-
- embedEvents.subscribe({
- 'REDIRECT_QUIZ_WALL' : this.handleRedirect
- });
-
- if (isIOSDevice()) {
- this.appContainerHeight = this.getContainerHeight();
-
- this.sendIframeHeightEvent(this.appContainerHeight);
- }
- }
-
- componentWillReceiveProps(nextProps) {
- const currentLocation = this.props.location;
- const nextLocation = nextProps.location;
-
- const isEmbed = Boolean(currentLocation.query.embed);
-
- const isPathnameChanged = currentLocation.pathname !== nextLocation.pathname;
- const isQueryChanged = currentLocation.query !== nextLocation.query;
-
- if (isPathnameChanged) {
- navigate({
- page : nextLocation.pathname,
- title : nextProps.routes[nextProps.routes.length - 1].path
- });
-
- this.sendIframeHeightEvent();
- }
-
- if (isEmbed && (isPathnameChanged || isQueryChanged)) {
- const pathname = nextLocation.pathname;
- const { category, search, sortType } = nextLocation.query;
-
- const query = {};
-
- if (category) {
- query.category = category;
- }
-
- if (search) {
- query.search = search;
- }
-
- if (sortType) {
- query.sortType = sortType;
- }
-
- const quizWallEmbedPath = this.props.history.createHref(pathname, query);
-
- embedEvents.send({
- type : 'PATH_CHANGED',
- quizWallEmbedPath
- });
- }
- }
-
- componentDidUpdate() {
- if (isIOSDevice()) {
- const nextHeightOfAppContainer = this.getContainerHeight();
-
- if (nextHeightOfAppContainer !== this.appContainerHeight) {
- this.sendIframeHeightEvent(nextHeightOfAppContainer);
-
- this.appContainerHeight = nextHeightOfAppContainer;
- } else {
- this.iframeHeightCalcTimer = setTimeout(() => {
- const newHeightOfAppContainer = this.getContainerHeight();
-
- this.sendIframeHeightEvent(newHeightOfAppContainer);
-
- this.appContainerHeight = newHeightOfAppContainer;
- }, TIMER_DELAY);
- }
- }
- }
-
- componentWillUnmount() {
- this.appContainerHeight = null;
- }
-
- handleRedirect = () => {
- const { query } = this.props.location;
-
- const newState = {
- embed : query.embed,
- assigneeId : query.assigneeId
- };
-
- if (query.search) {
- newState.search = query.search;
- }
-
- this.props.history.pushState(null, '/activations', newState);
- };
-
- getContainerHeight = () => {
- return document.getElementById('app-view').scrollHeight;
- };
-
- sendIframeHeightEvent = (height = 0) => {
- embedEvents.send({
- type : 'IFRAME_HEIGHT_CALCULATED',
- iframeHeight : height
- });
- }
-
- render() {
- return (
-
- {this.props.children}
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/Footer.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/Footer.jsx
deleted file mode 100644
index dab4d03..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/Footer.jsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import strformat from 'strformat';
-
-import Footer from '../components/Footer.jsx';
-
-import { footerLinks, quizwallShareLink } from '../config';
-
-import { sendEvent } from '../utils/googleAnalytics';
-
-export default class FooterContainer extends Component {
- static contextTypes = { i18n: PropTypes.object };
-
- state = {
- showShareDialog: false
- };
-
- componentWillMount() {
- const { getLocale } = this.context.i18n;
-
- this.links = {};
-
- for (const linkType in footerLinks) {
- if ({}.hasOwnProperty.call(footerLinks, linkType)) {
- this.links[linkType] = strformat(footerLinks[linkType], {
- lang: getLocale()
- });
- }
- }
-
- this.linkToShare = quizwallShareLink;
- }
-
- handleLinkClick = (type) => {
- sendEvent('footer', 'click', type);
- };
-
- handleShare = () => {
- this.setState({ showShareDialog: true });
- sendEvent('footer', 'share');
- };
-
- handleShareClose = () => {
- this.setState({ showShareDialog: false });
- };
-
- openLinkInPopup = (URL) => {
- window.open(URL, '', 'width=500, height=500');
- };
-
- openLinkInNewTab = (URL) => {
- window.open(URL, '_blank');
- };
-
- render() {
- return (
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/GoogleAd.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/GoogleAd.jsx
deleted file mode 100644
index c583712..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/GoogleAd.jsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import GoogleAd from 'react-google-ad';
-
-import { ads } from '../config.js';
-
-export default class GoogleAdContainer extends Component {
- static propTypes = {
- type : PropTypes.string.isRequired
- };
-
- render() {
- const { type } = this.props;
-
- if (!type || !ads || !ads[type]) {
- return null;
- }
-
- const adInfo = ads[type];
-
- return (
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/LanguageSwitch.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/LanguageSwitch.jsx
deleted file mode 100644
index 5a2b654..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/LanguageSwitch.jsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import cookie from 'cookie';
-
-import { getSupportedLocales } from '../utils';
-import { sendEvent } from '../utils/googleAnalytics';
-
-import LanguageSwitch from '../components/LanguageSwitch.jsx';
-
-const SUPPORTED_LOCALES = getSupportedLocales();
-
-export default class LanguageSwitchContainer extends Component {
- static contextTypes = { i18n: PropTypes.object };
-
- handleSelectLanguage = (newLocale) => {
- document.cookie = cookie.serialize('locale', newLocale, { path: '/', maxAge: 900000 });
-
- sendEvent('language', 'change', newLocale);
- window.location.reload();
- };
-
- render() {
- const { getLocale } = this.context.i18n;
-
- return (
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/LoginDialog.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/LoginDialog.jsx
deleted file mode 100644
index bc31075..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/LoginDialog.jsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import strformat from 'strformat';
-import escapeHTML from 'lodash/string/escape';
-
-import LoginDialog from '../components/LoginDialog.jsx';
-
-import { socialAuthURL, emailAuthURL } from '../config';
-
-import { sendEvent } from '../utils/googleAnalytics';
-
-export default class LoginDialogContainer extends Component {
- static propTypes = {
- isOpen : PropTypes.bool.isRequired,
- onRequestClose : PropTypes.func
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- componentWillReceiveProps(nextProps) {
- if (!this.props.isOpen && nextProps.isOpen) {
- sendEvent('login dialog', 'view');
- }
- }
-
- handleSocialLogin = (type) => {
- const { getLocale } = this.context.i18n;
-
- sendEvent('login dialog', 'login', type);
-
- const redirectURL = strformat(socialAuthURL, {
- lang: getLocale().toUpperCase(),
- continueRoute: escapeHTML(`/quizwall${window.location.pathname + window.location.search}`),
- socialType: type,
- ref: localStorage.getItem('ref') || ''
- });
-
- this.openLink(redirectURL);
- };
-
- handleEmailLogin = () => {
- const { getLocale } = this.context.i18n;
-
- sendEvent('login dialog', 'login', 'email');
-
- const redirectURL = strformat(emailAuthURL, {
- lang: getLocale().toLowerCase(),
- continueRoute: escapeHTML(`/quizwall${window.location.pathname + window.location.search}`),
- ref: localStorage.getItem('ref') || ''
- });
-
- this.openLink(redirectURL);
- };
-
- openLink = (URL) => {
- window.open(URL, '_self');
- };
-
- render() {
- const { isOpen, onRequestClose } = this.props;
-
- return (
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/ShareDialog.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/ShareDialog.jsx
deleted file mode 100644
index ebb6660..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/ShareDialog.jsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import ShareDialog from '../components/ShareDialog.jsx';
-import { facebookAppId } from '../config';
-
-// import { getLocale } from '../i18n/Tools';
-import { sendEvent } from '../utils/googleAnalytics';
-
-export default class ShareDialogContainer extends Component {
- static propTypes = {
- title : PropTypes.string,
- isOpen : PropTypes.bool.isRequired,
- twitterMessage : PropTypes.string,
- linkToShare : PropTypes.string.isRequired,
- onRequestClose : PropTypes.func,
- onShare : PropTypes.func
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- static defaultProps = {
- twitterMessage : ''
- };
-
- handleShare = (type) => {
- const { getLocale } = this.context.i18n;
- const { twitterMessage } = this.props;
- let { linkToShare } = this.props;
-
- const currentLocale = getLocale() !== 'tr' ? getLocale() : 'en';
- const date = +new Date();
-
- // Date parameter is added here to create unique link (resolves facebook cashing problem)
- linkToShare += `?locale=${currentLocale}&date=${date}`;
-
- const linksHash = {
- 'google': `https://plus.google.com/share?url=${linkToShare}`,
- 'facebook': `https://www.facebook.com/dialog/share?app_id=${facebookAppId}&display=popup`
- + `&href=${linkToShare}&redirect_uri=${linkToShare}`,
- 'twitter': `https://twitter.com/intent/tweet?text=${encodeURI(twitterMessage)}&url=${linkToShare}&via=itsquizcom`,
- 'linkedin': `https://www.linkedin.com/shareArticle?mini=true&url=${linkToShare}`,
- 'vk': `http://vk.com/share.php?url=${linkToShare}`
- };
-
- this.openLinkInPopup(linksHash[type]);
-
- if (this.props.onShare) {
- this.props.onShare({
- sharedLink: linksHash[type],
- socialNetwork: type
- });
- }
-
- sendEvent('activation', 'share', type);
- };
-
- openLinkInPopup = (URL) => {
- window.open(URL, '', 'width=500, height=500');
- };
-
- render() {
- const { title, isOpen, onRequestClose } = this.props;
-
- return (
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/WelcomeDialog.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/WelcomeDialog.jsx
deleted file mode 100644
index 9819419..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/WelcomeDialog.jsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import strformat from 'strformat';
-
-import WelcomeDialog from '../components/WelcomeDialog.jsx';
-
-import { welcomeLinks } from '../config';
-
-export default class WelcomeDialogContainer extends Component {
- static propTypes = {
- isOpen : PropTypes.bool.isRequired,
- onDismiss : PropTypes.func.isRequired
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- handleLearnMoreAboutItsquz = () => {
- window.open(welcomeLinks.aboutItsquiz, '_blank');
- };
-
- handleDiscoverTests = () => {
- const linkToOpen = welcomeLinks.discoverTests;
-
- window.open(linkToOpen, '_blank');
- };
-
- handleCreateTest = () => {
- const { getLocale } = this.context.i18n;
- const linkToOpen = strformat(welcomeLinks.createTest, {
- lang: getLocale()
- });
-
- window.open(linkToOpen, '_blank');
- };
-
- handleEnglishCampaign = () => {
- const { getLocale } = this.context.i18n;
- const linkToOpen = strformat(welcomeLinks.englishCampaign, {
- lang: getLocale()
- });
-
- window.open(linkToOpen, '_blank');
- };
-
- render() {
- const { isOpen, onDismiss } = this.props;
-
- return (
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/layouts/MainLayout.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/layouts/MainLayout.jsx
deleted file mode 100644
index 87da97c..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/layouts/MainLayout.jsx
+++ /dev/null
@@ -1,61 +0,0 @@
-/* eslint react/no-did-mount-set-state: 0 */
-
-import React, { Component, PropTypes } from 'react';
-
-import MainLayout from '../../components/layouts/MainLayout.jsx';
-
-import { sendEvent } from '../../utils/googleAnalytics';
-
-export default class MainLayoutContainer extends Component {
- static propTypes = {
- history : PropTypes.object,
- dispatch : PropTypes.func,
- location : PropTypes.object,
- params : PropTypes.object,
- children : PropTypes.object
- };
-
- state = {
- isWelcomeScreenShown: false
- };
-
- componentDidMount() {
- const skipWelcomeScreen = localStorage.getItem('skipWelcomeScreen');
- const { skipWelcomeDialog, ref } = this.props.location.query;
-
- if (!skipWelcomeScreen && !skipWelcomeDialog) {
- this.setState({ isWelcomeScreenShown: true });
- }
-
- if (ref && !localStorage.getItem('ref')) {
- localStorage.setItem('ref', ref);
- sendEvent('initial', 'ref', ref);
- }
- }
-
- handleWelcomeScreenDismiss = (needToSkip) => {
- this.setState({ isWelcomeScreenShown: false });
-
- if (needToSkip) {
- localStorage.setItem('skipWelcomeScreen', 'true');
- }
- };
-
- render() {
- const { isWelcomeScreenShown } = this.state;
-
- const { location, children } = this.props;
-
- const isEmbedded = location.query.embed;
-
- return (
-
- {children}
-
- );
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/ActivationPage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/ActivationPage.jsx
deleted file mode 100644
index 5fcc261..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/ActivationPage.jsx
+++ /dev/null
@@ -1,448 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import { connect } from 'react-redux';
-
-import {
- loadActivation,
- loadSimilarActivations,
- loadAuthorActivations
-} from '../../actions/activations';
-
-import { loadAccountType } from '../../actions/accounts';
-import connectDataFetchers from '../../lib/connectDataFetchers.jsx';
-import EmbedEvents from '../../utils/EmbedEventsUtil';
-import config from '../../config';
-import { sendEvent } from '../../utils/googleAnalytics';
-import { makeSlug } from '../../utils/urlUtil';
-
-import ActivationPage from '../../components/pages/ActivationPage.jsx';
-
-const embedEvents = new EmbedEvents({
- embedOrigin: config.embedOrigin
-});
-
-
-class ActivationPageContainer extends Component {
- static propTypes = {
- history : PropTypes.object,
- location : PropTypes.object,
- params : PropTypes.object,
- activation : PropTypes.object,
- customAssessmentSystem : PropTypes.array,
- authorActivations : PropTypes.array,
- similarActivations : PropTypes.array,
- isLoading : PropTypes.bool,
- isLoadingAuthorActivations : PropTypes.bool,
- isAllAuthorActivationsLoaded : PropTypes.bool,
- isOrganization : PropTypes.bool,
- handleLoadAllAuthorActivations : PropTypes.func,
- dispatch : PropTypes.func
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- state = {
- proposedActivations : [],
- sharingLink : '',
- isShowingProposedActivations : false,
- isLoggingIn : false,
- isAvailable : true
- };
-
- componentWillMount() {
- const { id, accountId } = this.props.params;
-
- if (accountId) {
- this.props.history.replaceState(null, `/activations/${id}`);
- }
- }
-
- componentDidMount() {
- const {
- activation,
- similarActivations,
- authorActivations
- } = this.props;
-
- this.generateProposedActivations({
- activation,
- similarActivations,
- authorActivations
- });
-
- this.timer = this.createTimer(10 * 1000);
-
- this.timer.start({
- activation,
- similarActivations,
- authorActivations
- });
- }
-
- componentWillReceiveProps(nextProps) {
- const {
- activation,
- similarActivations,
- authorActivations
- } = nextProps;
-
- if (this.props.isLoading && !nextProps.isLoading && nextProps.activation) {
- if (nextProps.activation.isSponsored) {
- sendEvent('sponsored activation', 'view', nextProps.activation.name);
- }
- sendEvent('activation', 'view', nextProps.activation.name);
- }
-
- if (activation.id !== this.props.activation.id) {
- this.generateProposedActivations({
- activation,
- similarActivations,
- authorActivations
- });
-
- this.timer.restart({
- activation,
- similarActivations,
- authorActivations
- });
- }
- }
-
- componentWillUnmount() {
- this.timer.stop();
-
- delete this.timer;
- }
-
- handlePassActivationClick = (activation) => {
- if (activation.passingsLeft === 0) {
- this.setState({
- isAvailable: false
- });
-
- return;
- }
-
- const isEmbedded = this.props.location.query.embed;
- const { actionId, isSponsored, name } = activation;
-
- if (isEmbedded) {
- embedEvents.send({
- type : 'PASS_TEST',
- actionId
- });
- } else {
- this.setState({ isLoggingIn: true });
- }
-
- if (isSponsored) {
- sendEvent('sponsored activation', 'pass', name);
- }
- sendEvent('activation', 'pass', name);
- };
-
- handleViewAnswers = (activation) => {
- const isEmbedded = this.props.location.query.embed;
-
- if (isEmbedded && activation.isPassed) {
- const quizSessionId = activation.accountQuizSession.id;
-
- embedEvents.send({
- type : 'VIEW_ANSWERS',
- quizSessionId
- });
- }
-
- sendEvent('activation', 'view answers', activation.name);
- };
-
- handleFillProfile = (activation) => {
- const isEmbedded = this.props.location.query.embed;
-
- if (isEmbedded && activation.isPassed) {
- embedEvents.send({
- type : 'FILL_PROFILE'
- });
- }
-
- sendEvent('activation', 'fill profile click', activation.name);
- };
-
- handleSponsoredClick = (activation, buttonLabelForResearch) => {
- const isEmbedded = this.props.location.query.embed;
- const { id } = activation;
-
- if (isEmbedded) {
- embedEvents.send({
- type : 'COURSE_REQUEST',
- activationId : id
- });
- } else {
- this.setState({ isLoggingIn: true });
- this.props.history.pushState(null, this.props.location.pathname, {
- requestActivationId: id
- });
- }
-
- sendEvent('sponsored activation', 'request', activation.name);
-
- // We conduct research which button label works better
- sendEvent('sponsored request button', 'click', buttonLabelForResearch);
- };
-
- handleGoBack = () => {
- window.history.back();
- };
-
- handleActivationClick = (activation) => {
- this.props.history.pushState(null, `/activations/${activation.id}/${makeSlug(activation.name)}`, {
- embed : this.props.location.query.embed,
- assigneeId : this.props.location.query.assigneeId
- });
-
- sendEvent('activation', 'author activation view');
- };
-
- handleShare = (activation) => {
- this.setState({
- sharingLink : activation.publicLink
- });
-
- sendEvent('activation', 'share', 'click');
- };
-
- handleShareResult = (activation) => {
- this.setState({
- sharingLink : activation.accountQuizSession.shareResultLink
- });
-
- sendEvent('activation', 'share result', activation.name);
- };
-
- handleShareComplete = (activation, { socialNetwork }) => {
- embedEvents.send({
- type : 'SHARE_RESULT',
- activationId: activation.id,
- socialNetwork
- });
- };
-
- handleStopSharing = () => {
- this.setState({
- sharingLink : ''
- });
- };
-
- handleLoginClose = () => {
- this.setState({
- isLoggingIn : false
- });
- };
-
- handleCloseMessageNotAvailable = () => {
- this.setState({
- isAvailable: true
- });
- };
-
- handleLoadAllAuthorActivations = () => {
- this.props.dispatch(loadAuthorActivations({ isAllActivationsLoaded: true }));
- };
-
- getRandomInteger = (min, max) => {
- return Math.round(min - 0.5 + Math.random() * (max - min + 1));
- };
-
- getRandomNumbers = (min, max, amount) => {
- if (amount < 1) {
- return;
- }
-
- const result = [];
-
- while (result.length !== amount) {
- const randomNumber = this.getRandomInteger(min, max - 1);
-
- if (result.indexOf(randomNumber) !== -1) {
- continue;
- }
-
- result.push(randomNumber);
- }
-
- return result;
- };
-
- generateProposedActivations = ({ activation, similarActivations, authorActivations }) => {
- if (!activation || !activation.accountQuizSession || !similarActivations || !authorActivations
- || similarActivations.length + authorActivations.length === 0) {
- this.hideProposedActivations();
-
- return;
- }
-
- const amount = 2;
-
- let candidatesForPropose = similarActivations.length >= amount
- ? similarActivations
- : similarActivations.concat(authorActivations);
-
- candidatesForPropose = candidatesForPropose.filter(item => !item.accountQuizSession);
-
- if (candidatesForPropose.length === 0) {
- return;
- }
-
- if (candidatesForPropose.length === 1) {
- this.setState({
- proposedActivations: this.state.proposedActivations || candidatesForPropose,
- isShowingProposedActivations : false
- });
-
- this.showProposedActivations(candidatesForPropose);
-
- return;
- }
-
- const proposedActivationsIndexes = this.getRandomNumbers(0, candidatesForPropose.length, amount);
-
- const proposedActivations = proposedActivationsIndexes.map(index => candidatesForPropose[index]);
-
- this.setState({
- proposedActivations: this.state.proposedActivations || proposedActivations,
- isShowingProposedActivations : false
- });
-
- this.showProposedActivations(proposedActivations);
- };
-
- showProposedActivations = (proposedActivations) => {
- setTimeout(() => {
- this.setState({
- proposedActivations,
- isShowingProposedActivations: true
- });
- }, 500);
- }
-
- hideProposedActivations = () => {
- this.setState({
- isShowingProposedActivations: false
- });
-
- setTimeout(() => {
- this.setState({
- proposedActivations: []
- });
- }, 500);
- }
-
- createTimer = (period) => {
- const self = this;
-
- return {
- start(data) {
- this.interval = setInterval(self.generateProposedActivations.bind(self, data), period);
- },
- restart(data) {
- this.stop();
- this.start(data);
- },
- stop() {
- clearInterval(this.interval);
- }
- };
- }
-
- isArraysEqual(array1, array2) {
- return array1.sort().join() === array2.sort().join();
- }
-
- render() {
- const {
- activation,
- authorActivations,
- similarActivations,
- isLoading,
- customAssessmentSystem,
- isOrganization,
- isAllAuthorActivationsLoaded,
- isLoadingAuthorActivations
- } = this.props;
-
- const {
- sharingLink,
- proposedActivations,
- isLoggingIn,
- isShowingProposedActivations,
- isAvailable
- } = this.state;
-
- const { embed, assigneeId, hideLeftMenu } = this.props.location.query;
-
- const isSurvey = activation.accountQuizSession ? Boolean(activation.accountQuizSession.maxPoints === 0) : false;
-
- return (
-
- );
- }
-}
-
-function mapStateToProps({
- currentActivation : {
- activation,
- authorActivations,
- similarActivations,
- isLoadingActivation,
- isLoadingAuthorActivations,
- isAllAuthorActivationsLoaded
- },
- currentAssessmentSystem : { assessmentSystem },
- currentAccount : { isOrganization }
-}) {
- return {
- isOrganization,
- activation,
- authorActivations,
- similarActivations,
- isAllAuthorActivationsLoaded,
- isLoadingAuthorActivations,
- isLoading: isLoadingActivation,
- customAssessmentSystem: assessmentSystem
- };
-}
-
-export default connect(mapStateToProps)(
- connectDataFetchers(ActivationPageContainer, [loadActivation, loadSimilarActivations, loadAccountType])
-);
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/ActivationsPage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/ActivationsPage.jsx
deleted file mode 100644
index aff9afe..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/ActivationsPage.jsx
+++ /dev/null
@@ -1,189 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import { connect } from 'react-redux';
-
-import { loadActivations } from '../../actions/activations';
-import connectDataFetchers from '../../lib/connectDataFetchers.jsx';
-import EmbedEvents from '../../utils/EmbedEventsUtil';
-import config from '../../config';
-import { sendEvent } from '../../utils/googleAnalytics';
-import { makeSlug } from '../../utils/urlUtil';
-
-import ActivationsPage from '../../components/pages/ActivationsPage.jsx';
-
-const embedEvents = new EmbedEvents({
- embedOrigin: config.embedOrigin
-});
-
-class ActivationsPageContainer extends Component {
- static propTypes = {
- history : PropTypes.object,
- dispatch : PropTypes.func,
- location : PropTypes.object,
- params : PropTypes.object,
-
- totalActivationsAmount : PropTypes.number,
- search : PropTypes.string,
- category : PropTypes.string,
- sortType : PropTypes.string,
- activations : PropTypes.array,
- isLoading : PropTypes.bool
- };
-
- static contextTypes = { i18n: PropTypes.object };
-
- state = {
- linkToShare : '',
- isSharing : false,
- isLoggingIn : false
- };
-
- componentDidMount() {
- embedEvents.subscribe({
- 'SEARCH_QUIZ_WALL' : this.handleSearch
- });
- }
-
- componentWillUnmount() {
- embedEvents.unsubscribe();
- }
-
- handleQuizCardClick = (activation) => {
- this.props.history.pushState(null, `/activations/${activation.id}/${makeSlug(activation.name)}`, {
- embed : this.props.location.query.embed,
- assigneeId : this.props.location.query.assigneeId
- });
-
- sendEvent('activation card', 'view details', activation.name);
- };
-
- handleSearch = (searchText) => {
- this.props.history.pushState(null, this.props.location.pathname, {
- ...this.props.location.query,
- search : searchText || undefined
- });
-
- sendEvent('activations page', 'search');
- };
-
- handleShare = (activation) => {
- this.setState({
- linkToShare : activation.publicLink,
- isSharing : true
- });
-
- sendEvent('activation card', 'share', activation.name);
- };
-
- handleChangeSortType = (e) => {
- const newSortType = e.target.value;
-
- this.props.history.pushState(null, this.props.location.pathname, {
- ...this.props.location.query,
- sortType : newSortType
- });
- };
-
- handleSpecialsSubscribe = () => {
- this.setState({
- isLoggingIn : true
- });
-
- sendEvent('specials subscribe', 'click');
-
- if (!localStorage.getItem('ref')) {
- localStorage.setItem('ref', 'new_offers');
- }
- };
-
- handleLoginClose = () => {
- this.setState({
- isLoggingIn : false
- });
- };
-
- handleTabChange = (category) => {
- this.props.history.pushState(null, this.props.location.pathname, {
- ...this.props.location.query,
- category : category !== 'ALL' ? category : undefined
- });
-
- sendEvent('activations page', 'category change', category);
- };
-
- handleStopSharing = () => {
- this.setState({
- linkToShare : '',
- isSharing : false
- });
- };
-
- handleItemRenderRequest = (index) => {
- const { activations, totalActivationsAmount } = this.props;
-
- if (index + 1 < totalActivationsAmount && index + 1 >= activations.length) {
- this.props.dispatch(loadActivations({
- params : this.props.params,
- query : this.props.location.query,
- offset : activations.length
- }));
- }
- };
-
- handleAuthorAvatarClick = (authorId) => {
- const isEmbedded = this.props.location.query.embed;
-
- if (isEmbedded) {
- embedEvents.send({
- authorId,
- type : 'VIEW_AUTHOR_PROFILE'
- });
- } else {
- this.setState({ isLoggingIn: true });
- }
- };
-
- render() {
- return (
-
- );
- }
-}
-
-function mapStateToProps({ activations }) {
- const { entitiesByCategory, sortType, search, category, isLoading, totalActivationsAmount } = activations;
-
- return {
- totalActivationsAmount,
- isLoading,
- search,
- category,
- sortType: sortType || 'new',
- activations: entitiesByCategory[category] || []
- };
-}
-
-export default connect(mapStateToProps)(
- connectDataFetchers(ActivationsPageContainer, [ loadActivations ])
-);
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/CustomShareResultPage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/CustomShareResultPage.jsx
deleted file mode 100644
index a53ce75..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/CustomShareResultPage.jsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import strformat from 'strformat';
-
-import BasicSharePage from '../../components/pages/BasicSharePage.jsx';
-
-import { customShareInfo } from '../../config';
-import { sendEvent } from '../../utils/googleAnalytics';
-
-class CustomShareResultPageContainer extends Component {
- static propTypes = {
- history : PropTypes.object,
- location : PropTypes.object,
- params : PropTypes.object
- };
-
- componentDidMount() {
- const { key } = this.props.params;
-
- sendEvent('custom share result', 'direct open', key);
-
- if (customShareInfo && customShareInfo[key] && customShareInfo[key].redirectRoute) {
- this.props.history.replaceState(null, customShareInfo[key].redirectRoute, {
- ...this.props.location.query
- });
- } else {
- this.props.history.replaceState(null, '/activations', {
- ...this.props.location.query
- });
- }
- }
-
- render() {
- const { key } = this.props.params;
-
- const shareInfo = customShareInfo && customShareInfo[key] ? customShareInfo[key] : {};
-
- const { query } = this.props.location;
-
- return (
-
- );
- }
-}
-
-export default CustomShareResultPageContainer;
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/NotFoundPage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/NotFoundPage.jsx
deleted file mode 100644
index c734fcd..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/NotFoundPage.jsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-class NotFoundPage extends Component {
- static contextTypes = { i18n: PropTypes.object };
-
- render() {
- const { l } = this.context.i18n;
-
- return (
-
-
-
-
-
{l('The page you are looking for cannot be found')}
-
-
- );
- }
-}
-
-export default NotFoundPage;
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/PromoPage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/PromoPage.jsx
deleted file mode 100644
index b04e145..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/PromoPage.jsx
+++ /dev/null
@@ -1,44 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import PromoPage from '../../components/pages/PromoPage.jsx';
-
-import { promos } from '../../config';
-
-class PromoPageContainer extends Component {
- static propTypes = {
- history : PropTypes.object,
- location : PropTypes.object,
- params : PropTypes.object
- };
-
- getMarkdownSource() {
- const { key } = this.props.params;
-
- switch (key) {
- case 'iforum-2016': {
- const text = require('./PromoPage/iforum-2016.js');
-
- return text;
- }
-
- default: {
- return 'No such promo';
- }
- }
- }
-
- render() {
- const { key } = this.props.params;
-
- const promoInfo = promos && promos[key] ? promos[key] : {};
-
- return (
-
- );
- }
-}
-
-export default PromoPageContainer;
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/PromoPage/iforum-2016.js b/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/PromoPage/iforum-2016.js
deleted file mode 100644
index 4a5bd7b..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/PromoPage/iforum-2016.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- eslint
- max-len: 0
- import/no-commonjs: 0
-*/
-
-module.exports =
-`
-#### Хочешь стать участником iForum 2016?
-
-It's quiz проводит розыгрыш билетов на самое крупное интернет-событие года [iForum 2016](http://2016.iforum.ua/), который пройдет **20 апреля** в Киевском МВЦ.
-
-It's quiz - это облачная платформа для тестирования и проверки знаний.
-
-Получите входной билет бесплатно, для участия в конкусе создайте тест на тему **Интернет-технологии** на [It's quiz](http://itsquiz.com/). Вы можете создать тест на любую тему, связанную с интернет-технологиями, в который разбираетесь. Это могут быть тесты по программированию, оформлению веб-сайтов, тестированию,оптимизации или другим, интересным вам, темам.
-
-Для участия пройдите несколько простых шагов:
-
-1. Войдите в систему
-2. Создайте тест
-3. Активируйте и опубликуйте его на стене с пометкой **#хочу_на_iforum** в описании
-4. **12 апреля** мы объявим победителей, которые получат билеты на iForum
-
-Все созданные тесты должны соответствовать тематике и быть авторскими. Язык тестов допускается украинский, английский или русский.
-
-При отборе победителей мы будем учитывать:
- - популярность (количество сдач и просмотров вашего теста)
- - содержание (качество вопросов, правильность ответов и соответствие теме)
- - оформление тестов (форматирование вопросов, картинка к тесту, оформление описания)
-
-**[ПОСМОТРЕТЬ ТЕСТЫ УЧАСТНИКОВ](http://itsquiz.com/activations?search=%D1%85%D0%BE%D1%87%D1%83_%D0%BD%D0%B0_iforum)**
-
-##### Требования к тестам
-
- - плагиат не допускается
- - тест должен состоять, как минимум, из 10 вопросов
- - обязательно должна присутсвовать пометка **#хочу_на_iforum** в описании
-
-##### Часто задаваемые вопросы
-
-***Могут ли повторяться темы тестов?***
-
-Да, темы тестов могут повторяться. Главное - чтобы содержимое (вопросы в тесте) оставалось уникальным.
-
-***Как поднять популярность теста?***
-
-Вы можете поделиться ссылкой на тест со своими друзьями в социальных сетях. Также популярность теста напрямую зависит от качества его содержимого и оформления. Добавляйте картинки к вопросам (там, где они уместны), используйте форматирование текста (жирный, курсив, ссылки), добавляйте пояснения к вопросам, чтобы сбелать тест еще более увлекательным. Также немалую роль играет оформление вашей активации на стене: яркая картинка, емкое название и интересное описание - все это поможет поднять популярность!
-
-***Как будет происходить оценивание и отбор победителей?***
-
-Специальный пользователь "Ревизор" сдаст ваш тест и оценит его содержимое и оформление, 12 апреля мы объединим эту оценку с данными о популярности вашего теста и выберем победителей.
-
-***Как создать тест?***
-
-Почитать подробнее об этом вы можете [здесь](http://itsquiz.userecho.com/topics/122).
-
-***Если у вас остались еще вопросы, пишите нам в [службе поддержки](http://support.itsquiz.com)***
-
-Желаем вам удачи!
-
-`;
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/ShareResultPage.jsx b/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/ShareResultPage.jsx
deleted file mode 100644
index b684747..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/containers/pages/ShareResultPage.jsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import { connect } from 'react-redux';
-
-import { loadActivation } from '../../actions/activations';
-import connectDataFetchers from '../../lib/connectDataFetchers.jsx';
-import { sendEvent } from '../../utils/googleAnalytics';
-
-class ShareResultPageContainer extends Component {
- static propTypes = {
- location : PropTypes.object,
- params : PropTypes.object,
- history : PropTypes.object,
- activation : PropTypes.object
- };
-
- componentDidMount() {
- const { id } = this.props.params;
- const { activation } = this.props;
-
- sendEvent('share result', 'direct open', activation.name);
-
- if (activation.isPrivate) {
- this.props.history.replaceState(null, '/activations', {
- ...this.props.location.query
- });
- } else {
- this.props.history.replaceState(null, `/activations/${id}`, {
- ...this.props.location.query
- });
- }
- }
-
- render() {
- return (
-
- );
- }
-}
-
-function mapStateToProps({ currentActivation: { activation, authorActivations, isLoading } }) {
- return {
- activation,
- authorActivations,
- isLoading
- };
-}
-
-export default connect(mapStateToProps)(
- connectDataFetchers(ShareResultPageContainer, [ loadActivation ])
-);
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/history.js b/parser_setup/__tests__/itsquiz-wall/shared/history.js
deleted file mode 100644
index 32b8929..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/history.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- eslint
- import/no-commonjs: 0
-*/
-
-if (process.env.BROWSER) {
- const { createHistory } = require('history');
-
- module.exports = createHistory();
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/i18n/Provider.jsx b/parser_setup/__tests__/itsquiz-wall/shared/i18n/Provider.jsx
deleted file mode 100644
index 2e716ca..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/i18n/Provider.jsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import React from 'react';
-
-export default class Provider extends React.Component {
- static propTypes = {
- i18n : React.PropTypes.object.isRequired,
- children : React.PropTypes.object.isRequired
- };
-
- static childContextTypes = { i18n: React.PropTypes.object };
-
- getChildContext() {
- return { i18n: this.props.i18n };
- }
-
- render() {
- return React.Children.only(this.props.children);
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/i18n/Tools.js b/parser_setup/__tests__/itsquiz-wall/shared/i18n/Tools.js
deleted file mode 100644
index e5c9058..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/i18n/Tools.js
+++ /dev/null
@@ -1,46 +0,0 @@
-import Jed from 'jed';
-import moment from 'moment';
-import { sprintf } from '../utils';
-
-export default class Tools {
- constructor({ localeData, locale }) {
- this.jed = new Jed(localeData);
- this.locale = locale;
- }
-
- l = (text, context) => {
- return context
- ? this.jed.pgettext(context, text)
- : this.jed.gettext(text);
- }
-
- nl = (singular, plural, amount, context) => {
- return context
- ? this.jed.npgettext(context, singular, plural, amount)
- : this.jed.ngettext(singular, plural, amount);
- }
-
- getLocale = () => {
- return this.locale.toLowerCase();
- }
-
- getTimeFromNow = (date) => {
- moment.locale(this.locale);
-
- return moment(date).fromNow();
- }
-
- humanizeDuration = (time, unit) => {
- moment.locale(this.locale);
-
- const duration = moment.duration(time, unit);
-
- const hours = duration.hours();
- const hoursString = hours ? sprintf(this.nl('%d hour', '%d hours', hours), hours) : '';
-
- const minutes = duration.minutes();
- const minutesString = minutes ? sprintf(this.nl('%d minute', '%d minutes', minutes), minutes) : '';
-
- return `${hoursString} ${minutesString}`;
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/i18n/index.js b/parser_setup/__tests__/itsquiz-wall/shared/i18n/index.js
deleted file mode 100644
index 3578f4f..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/i18n/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import Provider from './Provider.jsx';
-import Tools from './Tools';
-
-export default {
- Provider,
- Tools
-};
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/lib/connectDataFetchers.jsx b/parser_setup/__tests__/itsquiz-wall/shared/lib/connectDataFetchers.jsx
deleted file mode 100644
index 29f14af..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/lib/connectDataFetchers.jsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import React, { PropTypes } from 'react';
-import Promise from 'bluebird';
-
-let IS_FIRST_MOUNT_AFTER_LOAD = true;
-
-export default function connectDataFetchers(Component, actionCreators) {
- return class DataFetchersWrapper extends React.Component {
- static contextTypes = { i18n: PropTypes.object };
-
- static propTypes = {
- dispatch : PropTypes.func.isRequired,
- params : PropTypes.object.isRequired,
- location : PropTypes.shape({
- pathname : PropTypes.string.required,
- search : PropTypes.string,
- query : PropTypes.string.object
- }).isRequired
- };
-
- static fetchData({ dispatch, params = {}, query = {}, locale }) {
- return Promise.all(
- actionCreators.map(actionCreator => dispatch(actionCreator({ params, query, locale })))
- );
- }
-
- componentDidUpdate(prevProps) {
- const { location } = this.props;
- const { location: prevLocation } = prevProps;
-
- const isUrlChanged = (location.pathname !== prevLocation.pathname)
- || (location.search !== prevLocation.search);
-
- if (isUrlChanged) {
- this._fetchDataOnClient();
- }
- }
-
- componentDidMount() {
- if (!IS_FIRST_MOUNT_AFTER_LOAD) {
- this._fetchDataOnClient();
- }
-
- IS_FIRST_MOUNT_AFTER_LOAD = false;
- }
-
-
- _fetchDataOnClient() {
- const locale = this.context.i18n ? this.context.i18n.getLocale() : 'en';
-
- DataFetchersWrapper.fetchData({
- locale,
- dispatch : this.props.dispatch,
- params : this.props.params,
- query : this.props.location.query
- });
- }
-
- render() {
- return (
-
- );
- }
- };
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/reducers/accounts.js b/parser_setup/__tests__/itsquiz-wall/shared/reducers/accounts.js
deleted file mode 100644
index 16953f0..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/reducers/accounts.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import {
- LOAD_ACCOUNTS_SUCCESS
-} from '../actions/accounts';
-
-export default function accounts(state = [], action) {
- switch (action.type) {
- case LOAD_ACCOUNTS_SUCCESS:
- return action.accounts;
- default:
- return state;
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/reducers/activations.js b/parser_setup/__tests__/itsquiz-wall/shared/reducers/activations.js
deleted file mode 100644
index 6f4a25a..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/reducers/activations.js
+++ /dev/null
@@ -1,74 +0,0 @@
-import * as apiResponseFormatter from '../utils/apiResponseFormatter';
-
-import {
- LOAD_ACTIVATIONS_SUCCESS,
- LOAD_ACTIVATIONS_REQUEST
-} from '../actions/activations';
-
-const DEFAULT_STATE = {
- entitiesByCategory: {},
- totalActivationsAmount: 0,
- isLoadingNextActivations: false,
- isLoading : true,
- category : 'all',
- search: '',
- sortType : 'new'
-};
-
-export default function activations(state = DEFAULT_STATE, action) {
- switch (action.type) {
- case LOAD_ACTIVATIONS_SUCCESS: {
- const newActivations = action.activations.map(activation => {
- const author = action.accounts.find(account => account.id === activation.links.owner.id);
-
- return apiResponseFormatter.formatActivation(activation, author);
- });
-
- const loadedActivations = state.entitiesByCategory[action.category]
- ? state.entitiesByCategory[action.category].slice(0)
- : [];
-
- newActivations.forEach((newActivation, i) => {
- if (action.offset + i < loadedActivations.length) {
- loadedActivations[action.offset + i] = newActivation;
- } else {
- loadedActivations.push(newActivation);
- }
- });
-
- const entitiesByCategory = {
- ...entitiesByCategory,
- [action.category]: loadedActivations
- };
-
- return {
- ...state,
- entitiesByCategory,
- totalActivationsAmount : action.totalAmount,
- isLoading : false
- };
- }
-
- case LOAD_ACTIVATIONS_REQUEST: {
- const isSortTypeChanged = state.sortType !== action.sortType;
- const isSearchChanged = state.search !== action.search;
-
- const isLoading = !state.entitiesByCategory[action.category]
- || isSortTypeChanged
- || isSearchChanged;
-
- return {
- ...state,
- isLoading,
- search : action.search,
- entitiesByCategory : isSortTypeChanged || isSearchChanged ? {} : state.entitiesByCategory,
- category : action.category,
- sortType : action.sortType
- };
- }
-
- default: {
- return state;
- }
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/reducers/currentAccount.js b/parser_setup/__tests__/itsquiz-wall/shared/reducers/currentAccount.js
deleted file mode 100644
index e6daa87..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/reducers/currentAccount.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { SET_SESSION_TYPE } from '../actions/accounts';
-
-const DEFAULT_STATE = {
- isOrganization: false
-};
-
-export default function currentAccount(state = DEFAULT_STATE, action) {
- switch (action.type) {
- case SET_SESSION_TYPE:
- return {
- ...state,
- isOrganization: action.isOrganization
- };
- default:
- return state;
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/reducers/currentActivation.js b/parser_setup/__tests__/itsquiz-wall/shared/reducers/currentActivation.js
deleted file mode 100644
index 1858f46..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/reducers/currentActivation.js
+++ /dev/null
@@ -1,87 +0,0 @@
-import * as apiResponseFormatter from '../utils/apiResponseFormatter';
-
-import {
- LOAD_ACTIVATION_REQUEST,
- LOAD_ACTIVATION_SUCCESS,
- LOAD_SIMILAR_ACTIVATIONS_SUCCESS,
- LOAD_ACTIVATIONS_REQUEST,
- LOAD_AUTHOR_ACTIVATIONS_SUCCESS
-} from '../actions/activations';
-
-const DEFAULT_STATE = {
- activation : {},
- authorActivations: [],
- similarActications: [],
- isLoadingActivation : true,
- isLoadingAuthorActivations: true,
- isAllAuthorActivationsLoaded: false
-};
-
-export default function currentActivation(state = DEFAULT_STATE, action) {
- // TODO normalize data. in currentActivation save only id. It will allow:
- // 1. Intant activation loading from activations list
- // 2. No activations blinking while you switch between them. From loaded activation to not loaded one.
- switch (action.type) {
- case LOAD_ACTIVATION_REQUEST: {
- const isLoading = state.activation.id !== action.activationId;
-
- return {
- ...state,
- activation : state.activation,
- isLoadingActivation : isLoading,
- isLoadingAuthorActivations : isLoading
- };
- }
-
- case LOAD_ACTIVATION_SUCCESS: {
- return {
- ...state,
- activation : apiResponseFormatter.formatActivation(action.activation, action.author),
- isLoadingActivation : false,
- isAllAuthorActivationsLoaded: false
- };
- }
-
- case LOAD_AUTHOR_ACTIVATIONS_SUCCESS: {
- const otherAuthorActivations = action.authorActivations.filter(authorActivation =>
- authorActivation.id !== action.openedActivationId
- );
-
- const authorActivations = otherAuthorActivations.map(authorActivation =>
- apiResponseFormatter.formatActivation(authorActivation)
- );
-
- return {
- ...state,
- authorActivations,
- isLoadingAuthorActivations : false,
- isAllAuthorActivationsLoaded: action.isAllActivationsLoaded
- };
- }
-
- case LOAD_SIMILAR_ACTIVATIONS_SUCCESS: {
- const similarActivations = action.activations.map(activation => {
- const author = action.accounts.find(account => account.id === activation.links.owner.id);
-
- return apiResponseFormatter.formatActivation(activation, author);
- });
-
- return {
- ...state,
- similarActivations
- };
- }
-
- // react on other reducers actions
-
- case LOAD_ACTIVATIONS_REQUEST: {
- return {
- ...state,
- ...DEFAULT_STATE
- };
- }
-
- default:
- return state;
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/reducers/currentAssessmentSystem.js b/parser_setup/__tests__/itsquiz-wall/shared/reducers/currentAssessmentSystem.js
deleted file mode 100644
index 45df993..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/reducers/currentAssessmentSystem.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import { LOAD_ASSESSMENT_SYSTEM_SUCCESS } from '../actions/assessmentSystems';
-
-const DEFAULT_STATE = {
- assessmentSystem : [],
- isLoading : true
-};
-
-export default function currentAssessmentSystem(state = DEFAULT_STATE, action) {
- switch (action.type) {
- case LOAD_ASSESSMENT_SYSTEM_SUCCESS: {
- return {
- ...state,
- assessmentSystem : action.assessmentSystem,
- isLoading : false
- };
- }
-
- default:
- return state;
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/reducers/index.js b/parser_setup/__tests__/itsquiz-wall/shared/reducers/index.js
deleted file mode 100644
index bed538b..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/reducers/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { combineReducers } from 'redux';
-
-import activations from './activations';
-import currentActivation from './currentActivation';
-import accounts from './accounts';
-import currentAccount from './currentAccount';
-import currentAssessmentSystem from './currentAssessmentSystem';
-
-const rootReducer = combineReducers({
- activations,
- currentActivation,
- accounts,
- currentAccount,
- currentAssessmentSystem
-});
-
-export default rootReducer;
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/routes.jsx b/parser_setup/__tests__/itsquiz-wall/shared/routes.jsx
deleted file mode 100644
index 0308e5d..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/routes.jsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from 'react';
-import { Route, Redirect } from 'react-router';
-
-import App from './containers/App.jsx';
-
-import MainLayout from './containers/layouts/MainLayout.jsx';
-
-import ActivationsPageContainer from './containers/pages/ActivationsPage.jsx';
-import ActivationPageContainer from './containers/pages/ActivationPage.jsx';
-import ShareResultPageContainer from './containers/pages/ShareResultPage.jsx';
-import CustomShareResultPageContainer from './containers/pages/CustomShareResultPage.jsx';
-import PromoPageContainer from './containers/pages/PromoPage.jsx';
-
-export default (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-);
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/store/configureStore.js b/parser_setup/__tests__/itsquiz-wall/shared/store/configureStore.js
deleted file mode 100644
index 5dabcec..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/store/configureStore.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import { createStore, applyMiddleware } from 'redux';
-import thunkMiddleware from 'redux-thunk';
-import rootReducer from '../reducers';
-
-const createStoreWithMiddleware = applyMiddleware(
- thunkMiddleware
- // loggerMiddleware
-)(createStore);
-
-export default function configureStore(initialState) {
- const store = createStoreWithMiddleware(rootReducer, initialState);
-
- if (module.hot) {
- // Enable Webpack hot module replacement for reducers
- module.hot.accept('../reducers', () => {
- const nextRootReducer = require('../reducers');
-
- store.replaceReducer(nextRootReducer);
- });
- }
-
- return store;
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/utils/ColorUtil.js b/parser_setup/__tests__/itsquiz-wall/shared/utils/ColorUtil.js
deleted file mode 100644
index 65c7384..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/utils/ColorUtil.js
+++ /dev/null
@@ -1,69 +0,0 @@
-const R = 0;
-const G = 1;
-const B = 2;
-
-class ColorUtil {
- constructor(colorcodes) {
- this.colors = [];
- this.setGradientColors(colorcodes);
- }
-
- setGradientColors(colorcodes) {
- colorcodes.forEach((colorcode) => {
- const rgbCode = this.parseRGB(colorcode);
-
- this.colors.push(rgbCode);
- });
- }
-
- parseRGB(colorcode) {
- let m = colorcode.match(/^#([0-9a-f]{6})$/i)[1];
-
- if (m) {
- return [
- parseInt(m.substr(0, 2), 16),
- parseInt(m.substr(2, 2), 16),
- parseInt(m.substr(4, 2), 16)
- ];
- }
-
- m = colorcode.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
- if (m) {
- return [m[1], m[2], m[3]];
- }
-
- return false;
- }
-
- colorToString(color) {
- return `rgb(${color[R]}, ${color[G]}, ${color[B]})`;
- }
-
- getColorCodeByPercent(percent) {
- const numberOfColors = this.colors.length;
-
- const percentPerPart = 100 / (numberOfColors - 1);
- const startColorIndex = parseInt(percent / percentPerPart, 10);
- const percentFromPart = (percent % percentPerPart) / percentPerPart;
- const startColor = this.colors[startColorIndex];
- const endColor = startColorIndex === numberOfColors - 1
- ? this.colors[startColorIndex]
- : this.colors[startColorIndex + 1];
-
- const deltaColor = [
- (startColor[R] - endColor[R]),
- (startColor[G] - endColor[G]),
- (startColor[B] - endColor[B])
- ];
-
- const resultColor = [
- startColor[R] + Math.round((deltaColor[R] * percentFromPart)),
- startColor[G] + Math.round((deltaColor[G] * percentFromPart)),
- startColor[B] + Math.round((deltaColor[B] * percentFromPart))
- ];
-
- return this.colorToString(resultColor);
- }
-}
-
-export default ColorUtil;
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/utils/EmbedEventsUtil.js b/parser_setup/__tests__/itsquiz-wall/shared/utils/EmbedEventsUtil.js
deleted file mode 100644
index b7af2e8..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/utils/EmbedEventsUtil.js
+++ /dev/null
@@ -1,30 +0,0 @@
-export default class EmbedEventsUtil {
- constructor({ embedOrigin }) {
- this.events = {};
- this.embedOrigin = embedOrigin;
- }
-
- send(data) {
- window.parent.postMessage(data, this.embedOrigin);
- }
-
- handleEvents = (event) => {
- if (event.origin === this.embedOrigin) {
- const { type, ...otherParams } = event.data;
- const args = Object.keys(otherParams).map(key => otherParams[key]);
-
- return this.events[type] ? this.events[type](...args) : null;
- }
-
- return;
- };
-
- subscribe(events) {
- this.events = events;
- window.addEventListener('message', this.handleEvents, false);
- }
-
- unsubscribe() {
- window.removeEventListener('message', this.handleEvents);
- }
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/utils/LocaleUtil/assessmentSystems.json b/parser_setup/__tests__/itsquiz-wall/shared/utils/LocaleUtil/assessmentSystems.json
deleted file mode 100644
index 88d8435..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/utils/LocaleUtil/assessmentSystems.json
+++ /dev/null
@@ -1,308 +0,0 @@
-{
- "EN": {
- "Standard": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "You could do better!",
- "description": ""
- },
- {
- "grade": "30",
- "phrase": "You could do better!",
- "description": ""
- },
- {
- "grade": "50",
- "phrase": "Good job!",
- "description": ""
- },
- {
- "grade": "75",
- "phrase": "Great result!",
- "description": ""
- },
- {
- "grade": "95",
- "phrase": "You rock! Excellent job!",
- "description": ""
- }
- ],
- "id": "STANDARD"
- },
- "A-F": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "F",
- "description": ""
- },
- {
- "grade": "30",
- "phrase": "E",
- "description": ""
- },
- {
- "grade": "50",
- "phrase": "D",
- "description": ""
- },
- {
- "grade": "70",
- "phrase": "C",
- "description": ""
- },
- {
- "grade": "80",
- "phrase": "B",
- "description": ""
- },
- {
- "grade": "90",
- "phrase": "A",
- "description": ""
- }
- ],
- "id": "A-F"
- },
- "Starwars": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "You do not possess the power",
- "description": ""
- },
- {
- "grade": "50",
- "phrase": "Young Padawan",
- "description": ""
- },
- {
- "grade": "80",
- "phrase": "Jedi",
- "description": ""
- },
- {
- "grade": "99",
- "phrase": "Yoda, is it you?",
- "description": ""
- }
- ],
- "id": "STARWARS"
- },
- "Create new": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "",
- "description": ""
- }
- ],
- "id": "NEW"
- }
- },
- "UK": {
- "\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "\u0412\u0438 \u043c\u043e\u0433\u043b\u0438 \u0431 \u0441\u043a\u043b\u0430\u0441\u0442\u0438 \u043a\u0440\u0430\u0449\u0435!",
- "description": ""
- },
- {
- "grade": "30",
- "phrase": "\u0412\u0438 \u043c\u043e\u0433\u043b\u0438 \u0431 \u0441\u043a\u043b\u0430\u0441\u0442\u0438 \u043a\u0440\u0430\u0449\u0435!",
- "description": ""
- },
- {
- "grade": "50",
- "phrase": "\u0413\u0430\u0440\u043d\u0430 \u0440\u043e\u0431\u043e\u0442\u0430!",
- "description": ""
- },
- {
- "grade": "75",
- "phrase": "\u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442!",
- "description": ""
- },
- {
- "grade": "95",
- "phrase": "\u0412\u0430\u0443! \u0412\u0456\u0434\u043c\u0456\u043d\u043d\u0430 \u0440\u043e\u0431\u043e\u0442\u0430!",
- "description": ""
- }
- ],
- "id": "STANDARD"
- },
- "A-F": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "F",
- "description": ""
- },
- {
- "grade": "30",
- "phrase": "E",
- "description": ""
- },
- {
- "grade": "50",
- "phrase": "D",
- "description": ""
- },
- {
- "grade": "70",
- "phrase": "C",
- "description": ""
- },
- {
- "grade": "80",
- "phrase": "B",
- "description": ""
- },
- {
- "grade": "90",
- "phrase": "A",
- "description": ""
- }
- ],
- "id": "A-F"
- },
- "\u0417\u043e\u0440\u044f\u043d\u0456 \u0432\u0456\u0439\u043d\u0438": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "\u041d\u0435 \u0432\u043e\u043b\u043e\u0434\u0456\u0454\u0448 \u0421\u0438\u043b\u043e\u044e \u0442\u0438!",
- "description": ""
- },
- {
- "grade": "50",
- "phrase": "\u042e\u043d\u0438\u0439 \u043f\u0430\u0434\u0430\u0432\u0430\u043d",
- "description": ""
- },
- {
- "grade": "80",
- "phrase": "\u0414\u0436\u0435\u0434\u0430\u0439",
- "description": ""
- },
- {
- "grade": "99",
- "phrase": "\u0419\u043e\u0434\u0430, \u0446\u0435 \u0442\u0438?",
- "description": ""
- }
- ],
- "id": "STARWARS"
- },
- "\u0421\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0432\u043b\u0430\u0441\u043d\u0443": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "",
- "description": ""
- }
- ],
- "id": "NEW"
- }
- },
- "RU": {
- "\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "\u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0441\u0434\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435!",
- "description": ""
- },
- {
- "grade": "30",
- "phrase": "\u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0441\u0434\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435!",
- "description": ""
- },
- {
- "grade": "50",
- "phrase": "\u0425\u043e\u0440\u043e\u0448\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430!",
- "description": ""
- },
- {
- "grade": "75",
- "phrase": "\u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442!",
- "description": ""
- },
- {
- "grade": "95",
- "phrase": "\u0412\u0430\u0443! \u041e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430!",
- "description": ""
- }
- ],
- "id": "STANDARD"
- },
- "A-F": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "F",
- "description": ""
- },
- {
- "grade": "30",
- "phrase": "E",
- "description": ""
- },
- {
- "grade": "50",
- "phrase": "D",
- "description": ""
- },
- {
- "grade": "70",
- "phrase": "C",
- "description": ""
- },
- {
- "grade": "80",
- "phrase": "B",
- "description": ""
- },
- {
- "grade": "90",
- "phrase": "A",
- "description": ""
- }
- ],
- "id": "A-F"
- },
- "\u0417\u0432\u0435\u0437\u0434\u043d\u044b\u0435 \u0432\u043e\u0439\u043d\u044b": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "\u041d\u0435 \u0432\u043b\u0430\u0434\u0435\u0435\u0448\u044c \u0421\u0438\u043b\u043e\u0439 \u0442\u044b!",
- "description": ""
- },
- {
- "grade": "50",
- "phrase": "\u042e\u043d\u044b\u0439 \u043f\u0430\u0434\u0430\u0432\u0430\u043d",
- "description": ""
- },
- {
- "grade": "80",
- "phrase": "\u0414\u0436\u0435\u0434\u0430\u0439",
- "description": ""
- },
- {
- "grade": "99",
- "phrase": "\u0419\u043e\u0434\u0430, \u0442\u044b \u043b\u0438 \u044d\u0442\u043e?",
- "description": ""
- }
- ],
- "id": "STARWARS"
- },
- "\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e": {
- "assessmentSystem": [
- {
- "grade": "0",
- "phrase": "",
- "description": ""
- }
- ],
- "id": "NEW"
- }
- }
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/utils/apiResponseFormatter.js b/parser_setup/__tests__/itsquiz-wall/shared/utils/apiResponseFormatter.js
deleted file mode 100644
index 114470f..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/utils/apiResponseFormatter.js
+++ /dev/null
@@ -1,126 +0,0 @@
-export function formatActivation(activation, author) {
- return {
- id : activation.id,
- name : activation.name,
- linkToPass : activation.linkToPass,
- publicLink : activation.publicLink,
- actionId : activation.links ? activation.links.action.id : '',
- numberOfQuestions : activation.numberOfQuestions,
- numberOfAccountsPassed : activation.numberOfPeople,
- dueTime : activation.dueTime,
- message : activation.message,
- category : activation.category,
- isSponsored : activation.isSponsored,
- isPrivate : activation.isPublic === false,
- canPassViaChat : activation.canPassViaChat,
- isPassed : activation.assigneeQuizSession && activation.assigneeQuizSession.finishedAt,
- accountQuizSession : formatAccountQuizSession(activation.assigneeQuizSession),
- pictureURL : activation.pictureURL,
- tags : activation.tags,
- timeToPass : activation.timeToPass,
- author : author ? formatAccountInfo(author) : {},
- canAssigneePass : activation.canAssigneePass,
- numberOfTriesLeft : activation.numberOfTriesLeft || 0,
- assessmentSystemId : activation.assessmentSystemId,
- assessmentSystemType : activation.assessmentSystemType,
- canAssigneeViewQuestions : activation.canAssigneeViewQuestions,
- passingsLeft : activation.passingsLeft
- };
-}
-
-export function formatAccountInfo(account) {
- let smallAvatarUrl = account.smallAvatarUrl;
-
- if (!isAvatarStandard(account.avatarUrl) && isAvatarStandard(account.smallAvatarUrl)) {
- smallAvatarUrl = account.avatarUrl;
- }
-
- return {
- smallAvatarUrl,
- id : account.id,
- isTrusted : account.isTrusted,
- type : account.type,
- fullName : _getAccountFullName(account),
- avatar : account.avatarUrl,
- backgroundURL : account.backgroundURL
- };
-}
-
-export function formatAuthorProfileData(account) {
- return {
- id : account.id,
- country : account.country,
- city : account.city,
- industry : account.industry,
- isTrusted : account.isTrusted,
- type : account.type,
- firstName : account.firstName,
- secondName : account.secondName,
- lastName : account.lastName,
- companyName : account.companyName,
- pictureURL : account.avatarUrl,
- backgroundURL : account.backgroundURL
- };
-}
-
-export function formatAccountQuizSession(session) {
- if (!session || !session.createdAt) {
- return null;
- }
-
- const accountGainedPoints = Math.round(+session.gainedPoints * 100) / 100 || 0;
- let accountScore = 0;
-
- if (+session.maxPoints > 0) {
- accountScore = Math.round(+accountGainedPoints * 100 / +session.maxPoints);
- }
-
- return {
- canViewAnswers : session.canAssigneeViewQuestions,
- startedAt : session.startedAt,
- shareResultLink : session.resultShareLink || '',
- finishedAt : session.finishedAt,
- score : accountScore,
- gainedPoints : accountGainedPoints,
- maxPoints : session.maxPoints,
- status : session.status,
- id : session.id,
- resultBackground : _getResultBackground(accountScore),
- answeredQuestionsNumber : session.numberOfAnsweredQuestions,
- totalQuestionsNumber : session.questions.length
- };
-}
-
-function _getAccountFullName({ firstName, secondName, ...account }) {
- if (account.type === 'COMPANY') {
- return account.companyName;
- }
-
- return firstName || secondName
- ? `${firstName} ${secondName}`
- : 'It`s quiz user';
-}
-
-function _getResultBackground(score) {
- if (score > 95) {
- return 'excellent';
- }
-
- if (score > 75) {
- return 'good';
- }
-
- if (score > 50) {
- return 'normal';
- }
-
- if (score > 30) {
- return 'bad';
- }
-
- return 'verybad';
-}
-
-function isAvatarStandard(avatar) {
- return avatar.includes('profile') || avatar.includes('companyProfile');
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/utils/googleAnalytics.js b/parser_setup/__tests__/itsquiz-wall/shared/utils/googleAnalytics.js
deleted file mode 100644
index ae36ba8..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/utils/googleAnalytics.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import { gaTrackingCode } from '../config.js';
-
-export function initialize() {
- ga('create', gaTrackingCode, 'auto');
-}
-
-export function navigate(pageData) {
- ga('set', pageData);
- ga('send', 'pageview');
-}
-
-export function sendEvent(category, action, label, value) {
- ga('send', {
- hitType : 'event',
- eventCategory : category,
- eventAction : action,
- eventLabel : label,
- eventValue : value
- });
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/utils/index.js b/parser_setup/__tests__/itsquiz-wall/shared/utils/index.js
deleted file mode 100644
index 10fe205..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/utils/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import Jed from 'jed';
-
-export function getSupportedLocales() {
- return ['ru', 'en', 'uk', 'tr'];
-}
-
-export function sprintf(text, ...params) {
- return Jed.sprintf(text, ...params);
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/utils/isIOSDevice.js b/parser_setup/__tests__/itsquiz-wall/shared/utils/isIOSDevice.js
deleted file mode 100644
index 729432c..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/utils/isIOSDevice.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import bowser from 'bowser';
-
-export default function () {
- if (bowser.ios) {
- return true;
- }
-
- return false;
-}
diff --git a/parser_setup/__tests__/itsquiz-wall/shared/utils/urlUtil.js b/parser_setup/__tests__/itsquiz-wall/shared/utils/urlUtil.js
deleted file mode 100644
index 38df9eb..0000000
--- a/parser_setup/__tests__/itsquiz-wall/shared/utils/urlUtil.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export function makeSlug(name = '') {
- const cleanName = name.replace(/[-\s]+/g, '-')
- .replace(/[^0-9a-zа-яїі-]/gi, '')
- .toLowerCase();
-
- return encodeURIComponent(cleanName);
-}
diff --git a/parser_setup/__tests__/test_0/components/App.jsx b/parser_setup/__tests__/test_0/components/App.jsx
deleted file mode 100644
index f2f677c..0000000
--- a/parser_setup/__tests__/test_0/components/App.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Component } from 'react';
-
-class App extends Component {
- render () {
- return (
- I am App.
- )
- }
-}
-
-export default App;
diff --git a/parser_setup/__tests__/test_0/index.js b/parser_setup/__tests__/test_0/index.js
deleted file mode 100644
index 2c84eb2..0000000
--- a/parser_setup/__tests__/test_0/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import { prependOnceListener } from 'process';
-import React from 'react';
-import { render } from 'react-dom';
-
-// Import React Components
-import App from './components/App.jsx';
-
-// TEST 0 - Simple React App with one App Component
-
-render(
- , document.getElementById('root')
- );
\ No newline at end of file
diff --git a/parser_setup/__tests__/test_1/components/App.jsx b/parser_setup/__tests__/test_1/components/App.jsx
deleted file mode 100644
index b7180f0..0000000
--- a/parser_setup/__tests__/test_1/components/App.jsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import React, { Component } from 'react';
-
-import Main from './Main.jsx'
-
-class App extends Component {
- render () {
- return (
-
- )
- }
-}
-
-export default App;
diff --git a/parser_setup/__tests__/test_1/components/Main.jsx b/parser_setup/__tests__/test_1/components/Main.jsx
deleted file mode 100644
index bb94263..0000000
--- a/parser_setup/__tests__/test_1/components/Main.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React, { Component } from 'react';
-
-class Main extends Component {
- render () {
- return (
- I am App.
- )
- }
-}
-
-export default Main;
diff --git a/parser_setup/__tests__/test_1/index.js b/parser_setup/__tests__/test_1/index.js
deleted file mode 100644
index 885c402..0000000
--- a/parser_setup/__tests__/test_1/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import React from 'react';
-import { render } from 'react-dom';
-
-// Import React Components
-import App from './components/App.jsx';
-
-// TEST 1 - Simple App with two components, App and Main, App renders Main
-
-render(
- , document.getElementById('root')
- );
diff --git a/parser_setup/__tests__/test_10/components/App.jsx b/parser_setup/__tests__/test_10/components/App.jsx
deleted file mode 100644
index 300ba23..0000000
--- a/parser_setup/__tests__/test_10/components/App.jsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React, { useState } from 'react';
-import { Switch, Route, Redirect } from 'react-router-dom';
-
-// Import React Components
-import Nav from './Nav.jsx';
-import ExercisesDisplay from './ExercisesDisplay.jsx';
-import ExerciseCreator from './ExerciseCreator.jsx';
-import DrillCreator from './DrillCreator.jsx';
-import HistoryDisplay from './HistoryDisplay.jsx';
-import Signup from './Signup.jsx';
-import Login from './Login.jsx';
-import Logout from './Logout.jsx';
-
-// App Component
-const App = () => {
- const [userInfo, setUserInfo] = useState({ name: '', email: '' });
-
- return (
-
-
-
- {/* React Router Switches */}
-
-
-
-
-
-
-
-
-
-
- {/* If not logged in force redirect to login page */}
- {!userInfo.name ? : null}
-
-
- );
-};
-
-export default App;
diff --git a/parser_setup/__tests__/test_10/components/DrillCreator.jsx b/parser_setup/__tests__/test_10/components/DrillCreator.jsx
deleted file mode 100644
index 5e004ec..0000000
--- a/parser_setup/__tests__/test_10/components/DrillCreator.jsx
+++ /dev/null
@@ -1,204 +0,0 @@
-import React, { useState, useEffect } from 'react';
-import { useParams, Link, Redirect } from 'react-router-dom';
-
-const DrillCreator = () => {
- const { id } = useParams();
- const [drillData, setDrillData] = useState({});
- const [redirect, setRedirect] = useState(false);
- const [formVals, setFormVals] = useState({
- exercise_id: id,
- weight: '',
- sets: '',
- reps: '',
- rest_interval: '',
- });
-
- // Helper function to update state formVals on form change
- const updateFormVal = (key, val) => {
- setFormVals({ ...formVals, [key]: val });
- };
-
- // TODO MAKE REAL API CALL OR LIFT STATE TO APP
- // Is there a route for creating a drill? I only see createExercise
- const getExercise = () => {
- fetch(`/api/exercise/${id}`)
- .then((response) => {
- if (response.status === 200) {
- return response.json();
- }
- throw new Error('Error when trying to get exercise details');
- })
- .then((data) => {
- console.log('exercise drill data is', data);
- setDrillData(data);
- })
- .catch((error) => console.error(error));
- };
-
- // Get exercise data for drill info (CURRENTLY FAKE DATA)
- useEffect(() => {
- console.log('Getting data from server for drill');
- getExercise();
- }, []);
-
- // Function to submit drill form data to server, create new drill
- const createDrill = () => {
- console.log('trying to create new drill', formVals);
-
- fetch('/api/drill', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(formVals),
- })
- .then((response) => {
- console.log('drill create response', response.status);
- if (response.status === 201) {
- return response.json();
- }
- throw new Error('error when trying to create a drill');
- })
- .then((data) => {
- console.log('response is 201, data is', data);
- setRedirect(true);
- })
- .catch((error) => console.error(error));
- };
-
- const { weight, sets, reps, rest_interval } = formVals;
-
- // Redirect to home page if drill created successfully
- if (redirect === true) {
- return ;
- }
-
- return (
-
-
Create a new drill:
-
- Exercise Name: {drillData.name}
-
- Exercise Description: {drillData.description}
-
- Exercise Type: {drillData.type}
-
- Last Weight (LBs): {drillData.last_weight}
-
- Last Reps: {drillData.last_reps}
-
- Last Sets: {drillData.last_sets}
-
- Last Rest (Mins): {drillData.last_rest}
-
-
- {/* DRILL INPUT FORM */}
-
-
- );
-};
-
-export default DrillCreator;
diff --git a/parser_setup/__tests__/test_10/components/ExerciseCreator.jsx b/parser_setup/__tests__/test_10/components/ExerciseCreator.jsx
deleted file mode 100644
index 36a6a8e..0000000
--- a/parser_setup/__tests__/test_10/components/ExerciseCreator.jsx
+++ /dev/null
@@ -1,208 +0,0 @@
-import React, { useState } from 'react';
-import { Link, Redirect } from 'react-router-dom';
-
-// React element allowing users to create a new exercise via form
-const ExerciseCreator = () => {
- const [redirect, setRedirect] = useState(false);
- const [formVals, setFormVals] = useState({
- name: '',
- description: '',
- type_id: '1',
- init_weight: '',
- init_reps: '',
- init_sets: '',
- init_rest: '',
- });
-
- // Helper function to update state formVals on form change
- const updateFormVal = (key, val) => {
- setFormVals({ ...formVals, [key]: val });
- };
-
- // Function to submit new exercise form data to server for processing
- const createExercise = () => {
- console.log('Trying to create exercise: ', formVals);
- fetch('/api/exercise', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(formVals),
- })
- .then((response) => {
- // If creation successful, redirect to exercises
- console.log('CREATE RESPONSE: ', response.status);
- if (response.status === 200) {
- return response.json();
- }
- throw new Error('Error when trying to login a user!');
- }).then((data) => {
- console.log('Added new exercise: ', data);
- setRedirect(true);
- })
- .catch((err) => console.error(err));
- };
-
- const {
- name, description, type, init_weight, init_reps, init_sets, init_rest,
- } = formVals;
-
- // If successfully created new exercise, redirect to '/' route:
- if (redirect) {
- return ;
- }
-
- return (
-
- Create a new Exercise:
-
- {/* NEW EXERCISE FORM */}
-
-
- );
-};
-
-export default ExerciseCreator;
diff --git a/parser_setup/__tests__/test_10/components/ExercisesDisplay.jsx b/parser_setup/__tests__/test_10/components/ExercisesDisplay.jsx
deleted file mode 100644
index 34cb6bc..0000000
--- a/parser_setup/__tests__/test_10/components/ExercisesDisplay.jsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import React, { useState, useEffect } from 'react';
-import { Link } from 'react-router-dom';
-
-const ExercisesDisplay = () => {
- const [exerciseData, setExerciseData] = useState([]);
-
- useEffect(() => {
- console.log('Getting data from server');
- // getExercises();
- fetch('/api/')
- .then((res) => res.json())
- .then((exercises) => {
- console.log('exercises are', exercises);
- setExerciseData(exercises);
- })
- .catch((error) => {
- console.log('error on ExercisesDisplay', error);
- });
- }, []);
-
- return (
-
-
Pick an Exercise:
- {exerciseData.map((exercise, i) => {
- console.log('makes all data exercises');
- return (
-
-
{exercise.name}
- Type: {exercise.typesname}
- Description: {exercise.description}
-
- Start Drill
-
-
-
- );
- })}
-
- );
-};
-
-export default ExercisesDisplay;
diff --git a/parser_setup/__tests__/test_10/components/HistoryDisplay.jsx b/parser_setup/__tests__/test_10/components/HistoryDisplay.jsx
deleted file mode 100644
index aca3e7e..0000000
--- a/parser_setup/__tests__/test_10/components/HistoryDisplay.jsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React, { useState, useEffect } from 'react';
-
-const HistoryDisplay = () => {
- const [history, setHistory] = useState([]);
-
- const getHistory = () => {
- fetch('/api/history')
- .then((res) => {
- if (res.status === 200) {
- return res.json();
- }
- throw new Error ('Error getting history from server.');
- })
- .then((data) => {
- console.log('Our getHistory data is:', data);
- setHistory(data);
- })
- .catch((error) => console.error(error));
- };
-
- useEffect(() => {
- console.log('GETTING HISTROY FROM SERVER');
- getHistory();
- }, []);
-
- const drills = history.map((drill, i) => {
- return Date: {drill.date}, id: {drill.exercise_id}, Weight: {drill.weight}, Sets: {drill.sets}, Reps: {drill.reps}, Rest: {drill.rest_interval}
- });
-
- return(
-
- );
-};
-
-export default HistoryDisplay;
diff --git a/parser_setup/__tests__/test_10/components/Login.jsx b/parser_setup/__tests__/test_10/components/Login.jsx
deleted file mode 100644
index 33446d6..0000000
--- a/parser_setup/__tests__/test_10/components/Login.jsx
+++ /dev/null
@@ -1,115 +0,0 @@
-import React, { useState } from 'react';
-import { Redirect, Link } from 'react-router-dom';
-
-// React element to render login form and submit login to server
-const Login = ({ setUserInfo }) => {
- const [formVals, setFormVals] = useState({ email: '', password: '' });
- const [loggedIn, setLoggedIn] = useState(false);
- const [errorMessage, setErrorMessage] = useState('');
-
- // Helper function to update state formVals on form change
- const updateFormVal = (key, val) => {
- setFormVals({ ...formVals, [key]: val });
- };
-
- // Function to submit signup form data to server, create new account
- const login = () => {
- console.log('logging in!', formVals);
-
- fetch('/api/login', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(formVals),
- })
- .then((response) => {
- // If login successful, set state for redirect
- console.log('LOGIN RESPONSE: ', response.status);
- if (response.status === 200 || response.status === 400) {
- return response.json();
- }
- throw new Error('Error when trying to login a user!');
- }).then((data) => {
- // If Error on Login display error message
- if (data.message) {
- setErrorMessage(data.message);
- return;
- }
- // Successful login, redirect to main page:
- setUserInfo(data);
- setLoggedIn(true);
- })
- .catch((err) => console.error(err));
- };
-
- const { email, password } = formVals;
-
- // If signed up correctly, redirect to main page
- if (loggedIn) {
- return ;
- }
-
- // If not logged in render login form
- if (!loggedIn) {
- return (
-
- );
- }
-};
-
-export default Login;
diff --git a/parser_setup/__tests__/test_10/components/Logout.jsx b/parser_setup/__tests__/test_10/components/Logout.jsx
deleted file mode 100644
index 56de830..0000000
--- a/parser_setup/__tests__/test_10/components/Logout.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import { Redirect } from 'react-router-dom';
-
-// React component that fakes logging out and returns user to login page
-const Logout = ({ setUserInfo }) => {
- setUserInfo({ name: '', email: '' });
-
- return ;
-};
-
-export default Logout;
diff --git a/parser_setup/__tests__/test_10/components/Nav.jsx b/parser_setup/__tests__/test_10/components/Nav.jsx
deleted file mode 100644
index 90b8229..0000000
--- a/parser_setup/__tests__/test_10/components/Nav.jsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React from 'react';
-import { Link } from 'react-router-dom';
-
-const Nav = ({ userInfo }) => {
- console.log('this is the navbar speaking', userInfo);
-
- // Navbar when not signed in:
- if (!userInfo.name) {
- return (
-
- Login
- Signup
-
- );
- }
-
- // Signed in Navbar:
- return (
-
- Home
- Create Exercise
- History
- Logout
-
- {userInfo.name
- ? (
-
- Logged in as:
- {userInfo.name}
- -
- {userInfo.email}
-
- )
- : null}
-
-
- );
-};
-
-export default Nav;
diff --git a/parser_setup/__tests__/test_10/components/Signup.jsx b/parser_setup/__tests__/test_10/components/Signup.jsx
deleted file mode 100644
index 8bc4b31..0000000
--- a/parser_setup/__tests__/test_10/components/Signup.jsx
+++ /dev/null
@@ -1,129 +0,0 @@
-import React, { useState } from 'react';
-import { Redirect, Link } from 'react-router-dom';
-
-// React component to render signup form and send form data to server
-const Signup = ({ setUserInfo }) => {
- const [formVals, setFormVals] = useState({ email: '', name: '', password: '' });
- const [loggedIn, setLoggedIn] = useState(false);
- const [errorMessage, setErrorMessage] = useState('');
-
- // Helper function to update state formVals on form change
- const updateFormVal = (key, val) => {
- setFormVals({ ...formVals, [key]: val });
- };
-
- // Function to submit signup form data to server, create new account
- const signup = () => {
- console.log('signing up!', formVals);
- fetch('/api/signup', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(formVals),
- })
- .then((response) => {
- // If signup successful, login
- console.log('SIGNUP RESPONSE: ', response.status);
- if (response.status === 201 || 400) {
- return response.json();
- }
- throw new Error('Error when trying to create new user!');
- })
- .then((data) => {
- if (data.message) {
- setErrorMessage(data.message);
- return;
- }
- setUserInfo(data);
- setLoggedIn(true);
- })
- .catch((err) => console.error(err));
- };
-
- const { email, name, password } = formVals;
-
- // If signed up correctly, redirect to main page
- if (loggedIn) {
- return ;
- }
-
- // If not logged in render signup form
- if (!loggedIn) {
- return (
-
- );
- }
-};
-
-export default Signup;
diff --git a/parser_setup/__tests__/test_10/index.jsx b/parser_setup/__tests__/test_10/index.jsx
deleted file mode 100644
index 59fe70b..0000000
--- a/parser_setup/__tests__/test_10/index.jsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import React from 'react';
-import { render } from 'react-dom';
-import { BrowserRouter as Router } from 'react-router-dom';
-
-// Import styles from SASS
-import styles from './scss/application.scss';
-
-// Import React Components
-import App from './components/App.jsx';
-
-// TEST 3 - Multi component application including react-router components
-
-render(
- ,
- document.getElementById('root'),
-);
diff --git a/parser_setup/__tests__/test_2/index.js b/parser_setup/__tests__/test_2/index.js
deleted file mode 100644
index 41e4698..0000000
--- a/parser_setup/__tests__/test_2/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import React from 'react';
-import { render } from 'react-dom';
-import { Switch, Route } from 'react-router-dom';
-
-// TEST 2 - Third Party Components, Destructuring Import
-
-render(
-
-
-
-
-
-
, document.getElementById('root'));
diff --git a/parser_setup/__tests__/test_3/components/App.jsx b/parser_setup/__tests__/test_3/components/App.jsx
deleted file mode 100644
index eb0feb6..0000000
--- a/parser_setup/__tests__/test_3/components/App.jsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import React, { useState } from 'react';
-import { Switch, Route, Redirect } from 'react-router-dom';
-
-// Import React Components
-import Nav from './Nav.jsx';
-import ExercisesDisplay from './ExercisesDisplay.jsx';
-import ExerciseCreator from './ExerciseCreator.jsx';
-import DrillCreator from './DrillCreator.jsx';
-import HistoryDisplay from './HistoryDisplay.jsx';
-import Signup from './Signup.jsx';
-import Login from './Login.jsx';
-import Logout from './Logout.jsx';
-
-// App Component
-const App = () => {
- const [userInfo, setUserInfo] = useState({ name: '', email: '' });
-
- return (
-
-
-
- {/* React Router Switches */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {/* If not logged in force redirect to login page */}
- {!userInfo.name ? : null}
-
-
- );
-};
-
-export default App;
diff --git a/parser_setup/__tests__/test_3/components/DrillCreator.jsx b/parser_setup/__tests__/test_3/components/DrillCreator.jsx
deleted file mode 100644
index 3955655..0000000
--- a/parser_setup/__tests__/test_3/components/DrillCreator.jsx
+++ /dev/null
@@ -1,204 +0,0 @@
-import React, { useState, useEffect } from 'react';
-import { useParams, Link, Redirect } from 'react-router-dom';
-
-const DrillCreator = () => {
- const { id } = useParams();
- const [drillData, setDrillData] = useState({});
- const [redirect, setRedirect] = useState(false);
- const [formVals, setFormVals] = useState({
- exercise_id: id,
- weight: '',
- sets: '',
- reps: '',
- rest_interval: '',
- });
-
- // Helper function to update state formVals on form change
- const updateFormVal = (key, val) => {
- setFormVals({ ...formVals, [key]: val });
- };
-
- // TODO MAKE REAL API CALL OR LIFT STATE TO APP
- // Is there a route for creating a drill? I only see createExercise
- const getExercise = () => {
- fetch(`/api/exercise/${id}`)
- .then((response) => {
- if (response.status === 200) {
- return response.json();
- }
- throw new Error('Error when trying to get exercise details');
- })
- .then((data) => {
- console.log('exercise drill data is', data);
- setDrillData(data);
- })
- .catch((error) => console.error(error));
- };
-
- // Get exercise data for drill info (CURRENTLY FAKE DATA)
- useEffect(() => {
- console.log('Getting data from server for drill');
- getExercise();
- }, []);
-
- // Function to submit drill form data to server, create new drill
- const createDrill = () => {
- console.log('trying to create new drill', formVals);
-
- fetch('/api/drill', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(formVals),
- })
- .then((response) => {
- console.log('drill create response', response.status);
- if (response.status === 201) {
- return response.json();
- }
- throw new Error('error when trying to create a drill');
- })
- .then((data) => {
- console.log('response is 201, data is', data);
- setRedirect(true);
- })
- .catch((error) => console.error(error));
- };
-
- const { weight, sets, reps, rest_interval } = formVals;
-
- // Redirect to home page if drill created successfully
- if (redirect === true) {
- return ;
- }
-
- return (
-
-
Create a new drill:
-
- Exercise Name: {drillData.name}
-
- Exercise Description: {drillData.description}
-
- Exercise Type: {drillData.type}
-
- Last Weight (LBs): {drillData.last_weight}
-
- Last Reps: {drillData.last_reps}
-
- Last Sets: {drillData.last_sets}
-
- Last Rest (Mins): {drillData.last_rest}
-
-
- {/* DRILL INPUT FORM */}
-
{
- e.preventDefault();
- createDrill();
- }}
- >
-
- {/* DRILL WEIGHT INPUT */}
-
-
- Today's Weight (LBs):
-
- {
- console.log('Updated formVals in DrillCreator: ', e.target.value);
- updateFormVal('weight', e.target.value);
- }}
- min={1}
- required
- />
-
-
-
- {/* DRILL SETS INPUT */}
-
-
- Today's Sets:
-
- {
- console.log('updated formVals in DrillCreator', e.target.value);
- updateFormVal('sets', e.target.value);
- }}
- min={1}
- required
- />
-
-
-
- {/* DRILL REPS INPUT */}
-
-
- Today's Reps:
-
- {
- console.log('updated formVals in DrillCreator', e.target.value);
- updateFormVal('reps', e.target.value);
- }}
- min={1}
- required
- />
-
-
-
- {/*DRILL REST INPUT */}
-
-
- Today's Rest Time (Mins):
-
- {
- console.log('updated formVals in DrillCreator', e.target.value);
- updateFormVal('rest_interval', e.target.value);
- }}
- min={1}
- required
- />
-
-
-
- {/* FORM SUBMIT BUTTON */}
-
- Submit
-
-
- {/* FORM CANCEL BUTTON */}
-
-
- Cancel
-
-
-
-
-
- );
-};
-
-export default DrillCreator;
diff --git a/parser_setup/__tests__/test_3/components/ExerciseCreator.jsx b/parser_setup/__tests__/test_3/components/ExerciseCreator.jsx
deleted file mode 100644
index 36a6a8e..0000000
--- a/parser_setup/__tests__/test_3/components/ExerciseCreator.jsx
+++ /dev/null
@@ -1,208 +0,0 @@
-import React, { useState } from 'react';
-import { Link, Redirect } from 'react-router-dom';
-
-// React element allowing users to create a new exercise via form
-const ExerciseCreator = () => {
- const [redirect, setRedirect] = useState(false);
- const [formVals, setFormVals] = useState({
- name: '',
- description: '',
- type_id: '1',
- init_weight: '',
- init_reps: '',
- init_sets: '',
- init_rest: '',
- });
-
- // Helper function to update state formVals on form change
- const updateFormVal = (key, val) => {
- setFormVals({ ...formVals, [key]: val });
- };
-
- // Function to submit new exercise form data to server for processing
- const createExercise = () => {
- console.log('Trying to create exercise: ', formVals);
- fetch('/api/exercise', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(formVals),
- })
- .then((response) => {
- // If creation successful, redirect to exercises
- console.log('CREATE RESPONSE: ', response.status);
- if (response.status === 200) {
- return response.json();
- }
- throw new Error('Error when trying to login a user!');
- }).then((data) => {
- console.log('Added new exercise: ', data);
- setRedirect(true);
- })
- .catch((err) => console.error(err));
- };
-
- const {
- name, description, type, init_weight, init_reps, init_sets, init_rest,
- } = formVals;
-
- // If successfully created new exercise, redirect to '/' route:
- if (redirect) {
- return ;
- }
-
- return (
-
- Create a new Exercise:
-
- {/* NEW EXERCISE FORM */}
- {
- e.preventDefault();
- createExercise();
- }}
- >
-
- {/* EXERCISE NAME INPUT */}
- Exercise Name:
- {
- console.log('Updated createEx formVals: ', e.target.value);
- updateFormVal('name', e.target.value);
- }}
- value={name}
- name="name"
- required
- />
-
-
- {/* EXERCISE TYPE INPUT */}
- Exercise Type:
- {
- console.log('Updated createEx formVals: ', e.target.value);
- updateFormVal('type_id', e.target.value);
- }}
- // options={[
- // { label: 'Arms', value: 1 },
- // { label: 'Legs', value: 2 },
- // { label: 'Core', value: 3 },
- // { label: 'Upper Body', value: 4 },
- // { label: 'Lower Body', value: 5 },
- // { label: 'Back', value: 6 },
- // ]}
- // defaultValue={{ label: 'Arms', value: 1 }}
- name="exerciseType"
- required
- >
- Arms
- Legs
- Core
- Upper Body
- Lower Body
- Back
-
-
-
- {/* EXERCISE DESCRIPTION INPUT */}
- Exercise Description:
- {
- console.log('Updated createEx formVals: ', e.target.value);
- updateFormVal('description', e.target.value);
- }}
- value={description}
- name="description"
- required
- />
-
-
- {/* EXERCISE WEIGHT INPUT */}
- Starting Weight (LBs):
- {
- console.log('Updated createEx formVals: ', e.target.value);
- updateFormVal('init_weight', e.target.value);
- }}
- value={init_weight}
- name="weight"
- min={1}
- />
-
-
- {/* EXERCISE SETS INPUT */}
- Starting Sets:
- {
- console.log('Updated createEx formVals: ', e.target.value);
- updateFormVal('init_sets', e.target.value);
- }}
- value={init_sets}
- name="sets"
- min={1}
- />
-
-
- {/* EXERCISE REPS INPUT */}
- Starting Reps:
- {
- console.log('Updated createEx formVals: ', e.target.value);
- updateFormVal('init_reps', e.target.value);
- }}
- value={init_reps}
- name="reps"
- min={1}
- />
-
-
- {/* EXERCISE REST INPUT */}
- Starting Rest Time:
- {
- console.log('Updated createEx formVals: ', e.target.value);
- updateFormVal('init_rest', e.target.value);
- }}
- value={init_rest}
- name="rest"
- min={1}
- />
-
-
- {/* FORM SUBMIT BUTTON */}
-
- Create Exercise
-
-
- {/* FORM CANCEL BUTTON */}
-
-
- Cancel
-
-
-
-
-
- );
-};
-
-export default ExerciseCreator;
diff --git a/parser_setup/__tests__/test_3/components/ExercisesDisplay.jsx b/parser_setup/__tests__/test_3/components/ExercisesDisplay.jsx
deleted file mode 100644
index 34cb6bc..0000000
--- a/parser_setup/__tests__/test_3/components/ExercisesDisplay.jsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import React, { useState, useEffect } from 'react';
-import { Link } from 'react-router-dom';
-
-const ExercisesDisplay = () => {
- const [exerciseData, setExerciseData] = useState([]);
-
- useEffect(() => {
- console.log('Getting data from server');
- // getExercises();
- fetch('/api/')
- .then((res) => res.json())
- .then((exercises) => {
- console.log('exercises are', exercises);
- setExerciseData(exercises);
- })
- .catch((error) => {
- console.log('error on ExercisesDisplay', error);
- });
- }, []);
-
- return (
-
-
Pick an Exercise:
- {exerciseData.map((exercise, i) => {
- console.log('makes all data exercises');
- return (
-
-
{exercise.name}
- Type: {exercise.typesname}
- Description: {exercise.description}
-
- Start Drill
-
-
-
- );
- })}
-
- );
-};
-
-export default ExercisesDisplay;
diff --git a/parser_setup/__tests__/test_3/components/HistoryDisplay.jsx b/parser_setup/__tests__/test_3/components/HistoryDisplay.jsx
deleted file mode 100644
index aca3e7e..0000000
--- a/parser_setup/__tests__/test_3/components/HistoryDisplay.jsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React, { useState, useEffect } from 'react';
-
-const HistoryDisplay = () => {
- const [history, setHistory] = useState([]);
-
- const getHistory = () => {
- fetch('/api/history')
- .then((res) => {
- if (res.status === 200) {
- return res.json();
- }
- throw new Error ('Error getting history from server.');
- })
- .then((data) => {
- console.log('Our getHistory data is:', data);
- setHistory(data);
- })
- .catch((error) => console.error(error));
- };
-
- useEffect(() => {
- console.log('GETTING HISTROY FROM SERVER');
- getHistory();
- }, []);
-
- const drills = history.map((drill, i) => {
- return Date: {drill.date}, id: {drill.exercise_id}, Weight: {drill.weight}, Sets: {drill.sets}, Reps: {drill.reps}, Rest: {drill.rest_interval}
- });
-
- return(
-
- );
-};
-
-export default HistoryDisplay;
diff --git a/parser_setup/__tests__/test_3/components/Login.jsx b/parser_setup/__tests__/test_3/components/Login.jsx
deleted file mode 100644
index 33446d6..0000000
--- a/parser_setup/__tests__/test_3/components/Login.jsx
+++ /dev/null
@@ -1,115 +0,0 @@
-import React, { useState } from 'react';
-import { Redirect, Link } from 'react-router-dom';
-
-// React element to render login form and submit login to server
-const Login = ({ setUserInfo }) => {
- const [formVals, setFormVals] = useState({ email: '', password: '' });
- const [loggedIn, setLoggedIn] = useState(false);
- const [errorMessage, setErrorMessage] = useState('');
-
- // Helper function to update state formVals on form change
- const updateFormVal = (key, val) => {
- setFormVals({ ...formVals, [key]: val });
- };
-
- // Function to submit signup form data to server, create new account
- const login = () => {
- console.log('logging in!', formVals);
-
- fetch('/api/login', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(formVals),
- })
- .then((response) => {
- // If login successful, set state for redirect
- console.log('LOGIN RESPONSE: ', response.status);
- if (response.status === 200 || response.status === 400) {
- return response.json();
- }
- throw new Error('Error when trying to login a user!');
- }).then((data) => {
- // If Error on Login display error message
- if (data.message) {
- setErrorMessage(data.message);
- return;
- }
- // Successful login, redirect to main page:
- setUserInfo(data);
- setLoggedIn(true);
- })
- .catch((err) => console.error(err));
- };
-
- const { email, password } = formVals;
-
- // If signed up correctly, redirect to main page
- if (loggedIn) {
- return ;
- }
-
- // If not logged in render login form
- if (!loggedIn) {
- return (
-
- );
- }
-};
-
-export default Login;
diff --git a/parser_setup/__tests__/test_3/components/Logout.jsx b/parser_setup/__tests__/test_3/components/Logout.jsx
deleted file mode 100644
index 56de830..0000000
--- a/parser_setup/__tests__/test_3/components/Logout.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import { Redirect } from 'react-router-dom';
-
-// React component that fakes logging out and returns user to login page
-const Logout = ({ setUserInfo }) => {
- setUserInfo({ name: '', email: '' });
-
- return ;
-};
-
-export default Logout;
diff --git a/parser_setup/__tests__/test_3/components/Nav.jsx b/parser_setup/__tests__/test_3/components/Nav.jsx
deleted file mode 100644
index 90b8229..0000000
--- a/parser_setup/__tests__/test_3/components/Nav.jsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React from 'react';
-import { Link } from 'react-router-dom';
-
-const Nav = ({ userInfo }) => {
- console.log('this is the navbar speaking', userInfo);
-
- // Navbar when not signed in:
- if (!userInfo.name) {
- return (
-
- Login
- Signup
-
- );
- }
-
- // Signed in Navbar:
- return (
-
- Home
- Create Exercise
- History
- Logout
-
- {userInfo.name
- ? (
-
- Logged in as:
- {userInfo.name}
- -
- {userInfo.email}
-
- )
- : null}
-
-
- );
-};
-
-export default Nav;
diff --git a/parser_setup/__tests__/test_3/components/Signup.jsx b/parser_setup/__tests__/test_3/components/Signup.jsx
deleted file mode 100644
index 8bc4b31..0000000
--- a/parser_setup/__tests__/test_3/components/Signup.jsx
+++ /dev/null
@@ -1,129 +0,0 @@
-import React, { useState } from 'react';
-import { Redirect, Link } from 'react-router-dom';
-
-// React component to render signup form and send form data to server
-const Signup = ({ setUserInfo }) => {
- const [formVals, setFormVals] = useState({ email: '', name: '', password: '' });
- const [loggedIn, setLoggedIn] = useState(false);
- const [errorMessage, setErrorMessage] = useState('');
-
- // Helper function to update state formVals on form change
- const updateFormVal = (key, val) => {
- setFormVals({ ...formVals, [key]: val });
- };
-
- // Function to submit signup form data to server, create new account
- const signup = () => {
- console.log('signing up!', formVals);
- fetch('/api/signup', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(formVals),
- })
- .then((response) => {
- // If signup successful, login
- console.log('SIGNUP RESPONSE: ', response.status);
- if (response.status === 201 || 400) {
- return response.json();
- }
- throw new Error('Error when trying to create new user!');
- })
- .then((data) => {
- if (data.message) {
- setErrorMessage(data.message);
- return;
- }
- setUserInfo(data);
- setLoggedIn(true);
- })
- .catch((err) => console.error(err));
- };
-
- const { email, name, password } = formVals;
-
- // If signed up correctly, redirect to main page
- if (loggedIn) {
- return ;
- }
-
- // If not logged in render signup form
- if (!loggedIn) {
- return (
-
- );
- }
-};
-
-export default Signup;
diff --git a/parser_setup/__tests__/test_3/index.jsx b/parser_setup/__tests__/test_3/index.jsx
deleted file mode 100644
index 3827277..0000000
--- a/parser_setup/__tests__/test_3/index.jsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import React from 'react';
-import { render } from 'react-dom';
-import { BrowserRouter as Router } from 'react-router-dom';
-
-// Import styles from SASS
-import styles from './scss/application.scss';
-
-// Import React Components
-import App from './components/App.jsx';
-
-// TEST 3 - Multi component application including react-router components
-
-render(
-
-
- ,
- document.getElementById('root'),
-);
diff --git a/parser_setup/__tests__/test_4/index.js b/parser_setup/__tests__/test_4/index.js
deleted file mode 100644
index c8bafb8..0000000
--- a/parser_setup/__tests__/test_4/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-import { render } from 'react-dom';
-import { Switch as S, Route as R } from 'react-router-dom';
-
-// TEST 4 - Third Party Components, Destructuring Import and Aliasing
-
-render(
-
-
-
-
-
, document.getElementById('root'));
diff --git a/parser_setup/__tests__/test_5/components/Container.js b/parser_setup/__tests__/test_5/components/Container.js
deleted file mode 100644
index 9fa92ac..0000000
--- a/parser_setup/__tests__/test_5/components/Container.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import React from 'react'
-
-const Container = () => {
- return (
- This is a container!
- )
-}
-
-export default Container
\ No newline at end of file
diff --git a/parser_setup/__tests__/test_5/components/JS.js b/parser_setup/__tests__/test_5/components/JS.js
deleted file mode 100644
index f84aa11..0000000
--- a/parser_setup/__tests__/test_5/components/JS.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import React, { Component } from 'react';
-
-import Container from './Container.js'
-
-class JS extends Component {
- render () {
- return (
-
- )
- }
-}
-
-export default JS;
diff --git a/parser_setup/__tests__/test_5/components/JSX.jsx b/parser_setup/__tests__/test_5/components/JSX.jsx
deleted file mode 100644
index 4d0a36c..0000000
--- a/parser_setup/__tests__/test_5/components/JSX.jsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import React, { Component } from 'react';
-
-import Container from './Container.js'
-
-class JSX extends Component {
- render () {
- return (
-
- )
- }
-}
-
-export default JSX;
diff --git a/parser_setup/__tests__/test_5/components/TS.ts b/parser_setup/__tests__/test_5/components/TS.ts
deleted file mode 100644
index 1f64261..0000000
--- a/parser_setup/__tests__/test_5/components/TS.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import React, { Component } from 'react';
-
-import Container from './Container.js'
-
-class TS extends Component {
- render () {
- return (
-
- )
- }
-}
-
-export default TS;
\ No newline at end of file
diff --git a/parser_setup/__tests__/test_5/components/TSX.tsx b/parser_setup/__tests__/test_5/components/TSX.tsx
deleted file mode 100644
index 5922dbe..0000000
--- a/parser_setup/__tests__/test_5/components/TSX.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import React, { Component } from 'react';
-
-import Container from './Container.js'
-
-class TSX extends Component {
- render () {
- return (
-
- )
- }
-}
-
-export default TSX;
\ No newline at end of file
diff --git a/parser_setup/__tests__/test_5/index.js b/parser_setup/__tests__/test_5/index.js
deleted file mode 100644
index 2b71b39..0000000
--- a/parser_setup/__tests__/test_5/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import React from 'react';
-import { render } from 'react-dom';
-import { Switch as S, Route as R } from 'react-router-dom';
-
-import JS from './components/JS'
-import JSX from './components/JSX'
-import TS from './components/TS'
-import TSX from './components/TSX'
-
-// TEST 5 - No file extensions for js, jsx, ts, tsx files
-
-render(
-
-
-
-
-
-
, document.getElementById('root'));
diff --git a/parser_setup/__tests__/test_6/App2.jsx b/parser_setup/__tests__/test_6/App2.jsx
deleted file mode 100644
index cc6c446..0000000
--- a/parser_setup/__tests__/test_6/App2.jsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React, { Component } from 'react';
-import App1 from './App1.jsx'
-
-class App2 extends Component {
- render () {
- return (
-
- )
- }
-}
-
-export default App2;
diff --git a/parser_setup/__tests__/test_6/components/App1.jsx b/parser_setup/__tests__/test_6/components/App1.jsx
deleted file mode 100644
index a58b2cd..0000000
--- a/parser_setup/__tests__/test_6/components/App1.jsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React, { Component } from 'react';
-import App2 from './App2.jsx'
-
-class App1 extends Component {
- render () {
- return (
-
- )
- }
-}
-
-export default App1;
diff --git a/parser_setup/__tests__/test_6/index.js b/parser_setup/__tests__/test_6/index.js
deleted file mode 100644
index 1efc995..0000000
--- a/parser_setup/__tests__/test_6/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import { render } from 'react-dom';
-
-import App1 from './components/App1.jsx'
-
-// TEST 6 - Bad import of App2 from App1 Component
-
-render(
- , document.getElementById('root'));
diff --git a/parser_setup/__tests__/test_7/components/App.jsx b/parser_setup/__tests__/test_7/components/App.jsx
deleted file mode 100644
index 5a7a410..0000000
--- a/parser_setup/__tests__/test_7/components/App.jsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import React, { Component } from 'react';
-
-import Main from './Main.jsx'
-
-class App extends Component {
- this is bad javascript
- render () {
- return (
-
- )
- }
-}
-
-export default App;
diff --git a/parser_setup/__tests__/test_7/components/Main.jsx b/parser_setup/__tests__/test_7/components/Main.jsx
deleted file mode 100644
index bb94263..0000000
--- a/parser_setup/__tests__/test_7/components/Main.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React, { Component } from 'react';
-
-class Main extends Component {
- render () {
- return (
- I am App.
- )
- }
-}
-
-export default Main;
diff --git a/parser_setup/__tests__/test_7/index.js b/parser_setup/__tests__/test_7/index.js
deleted file mode 100644
index bf28aaa..0000000
--- a/parser_setup/__tests__/test_7/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import { render } from 'react-dom';
-
-import App from './components/App.jsx'
-
-// TEST 7 - Invalid Javascript could crash babel parser
-
-render(
- , document.getElementById('root'));
diff --git a/parser_setup/__tests__/test_8/components/App.jsx b/parser_setup/__tests__/test_8/components/App.jsx
deleted file mode 100644
index 2dd1ecf..0000000
--- a/parser_setup/__tests__/test_8/components/App.jsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import React, { Component } from 'react';
-import Main from './Main';
-
-
-
-class App extends Component {
- render () {
- return (
-
-
-
-
- )
- }
-}
-
-export default App;
diff --git a/parser_setup/__tests__/test_8/components/Main.jsx b/parser_setup/__tests__/test_8/components/Main.jsx
deleted file mode 100644
index 2c0a624..0000000
--- a/parser_setup/__tests__/test_8/components/Main.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React, { Component } from 'react';
-
-const Main = (props) => {
-
- return (
- {props.prop1}
- )
-}
-
-
-export default Main;
diff --git a/parser_setup/__tests__/test_8/index.js b/parser_setup/__tests__/test_8/index.js
deleted file mode 100644
index dc5349b..0000000
--- a/parser_setup/__tests__/test_8/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import { prependOnceListener } from 'process';
-import React from 'react';
-import { render } from 'react-dom';
-
-// Import React Components
-import App from './components/App.jsx';
-
-// TEST 8 - Simple React App with two App Components and one prop
-
-render(
- , document.getElementById('root')
- );
\ No newline at end of file
diff --git a/parser_setup/__tests__/test_9/components/App.jsx b/parser_setup/__tests__/test_9/components/App.jsx
deleted file mode 100644
index f0bdb79..0000000
--- a/parser_setup/__tests__/test_9/components/App.jsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import React, { Component } from 'react';
-import Main from './Main';
-
-const string = 'This is a variable string'
-
-class App extends Component {
- render () {
- return (
-
-
-
-
-
- )
- }
-}
-
-export default App;
diff --git a/parser_setup/__tests__/test_9/components/Main.jsx b/parser_setup/__tests__/test_9/components/Main.jsx
deleted file mode 100644
index 2c0a624..0000000
--- a/parser_setup/__tests__/test_9/components/Main.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React, { Component } from 'react';
-
-const Main = (props) => {
-
- return (
- {props.prop1}
- )
-}
-
-
-export default Main;
diff --git a/parser_setup/__tests__/test_9/index.js b/parser_setup/__tests__/test_9/index.js
deleted file mode 100644
index ec8eb03..0000000
--- a/parser_setup/__tests__/test_9/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import { prependOnceListener } from 'process';
-import React from 'react';
-import { render } from 'react-dom';
-
-// Import React Components
-import App from './components/App.jsx';
-
-// TEST 9 - Simple React App with multiple Main components and different props passed in
-
-render(
- , document.getElementById('root')
- );
\ No newline at end of file
diff --git a/parser_setup/__tests__/thenosebleeds/OLD-index.js b/parser_setup/__tests__/thenosebleeds/OLD-index.js
deleted file mode 100644
index 96e50df..0000000
--- a/parser_setup/__tests__/thenosebleeds/OLD-index.js
+++ /dev/null
@@ -1,97 +0,0 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
-import { useHistory,
- BrowserRouter as Router,
- Link,
- Route,
- Switch
- } from 'react-router-dom';
-
-import HomePage from './components/homepage';
-import './styles/styles.css';
-
-let validUser = true;
-//let linkTo = '/';
-
-
-const App = () => {
- const signUp = (user, pass) => {
- console.log(user);
- fetch("/post", {
- method: 'POST',
- body: JSON.stringify(
- {username : user,
- password: pass}),
- headers: {
- 'Content-Type': 'application/json',
- }
- })
- .then(res => res.json())
- .then(result => {result}
- )};
-
- const Login = (user, pass) => {
- console.log(user);
- fetch("/login", {
- method: 'POST',
- body: JSON.stringify(
- {username : user,
- password: pass}),
- headers: {
- 'Content-Type': 'application/json',
- }
- })
- .then(res => res.json())
- .then(result => {
- if (result) {
- //linkTo = '/homepage';
- return validUser = true;
- } else {
- return validUser = false;
- }
- console.log(result)
- })
- };
-
- const getData = () =>{fetch('https://api.seatgeek.com/2/events?client_id=MjMwODQ2OTZ8MTYzMDA5MTEwMy4xMjAzNg&geoip=true&performers.slug=los-angeles-dodgers')
- .then(response => response.json())
- .then(data => console.log(data))}
-
-// const usernameTest = document.getElementById('username').value
-// console.log(usernameTest);
-// console.log('here')
-// if (validUser === true) {
-// console.log('on line 71')
-// linkTo = '/homepage';
-// } else {
-// linkTo = '/';
-// }
-validUser = Login()
-console.log()
- return(
- // console.log(linkTo)
-
-
-
- THE NOSEBLEEDS
-
-
-
- Login((document.getElementById('username').value), (document.getElementById('password').value))} type="button" className="buttons">Login
- signUp((document.getElementById('username').value), (document.getElementById('password').value))} type="button" className="buttons">Sign up
-
-
-
-
-
-
-
- )
-// return (
-//
-// if (/*logic returns true*)
-// )
-}
-
-ReactDOM.render( , document.getElementById("root"))
-
diff --git a/parser_setup/__tests__/thenosebleeds/actions/actions.js b/parser_setup/__tests__/thenosebleeds/actions/actions.js
deleted file mode 100644
index 5f0e4eb..0000000
--- a/parser_setup/__tests__/thenosebleeds/actions/actions.js
+++ /dev/null
@@ -1,165 +0,0 @@
-// import actionType constants
-import * as types from '../constants/actionTypes';
-
-// ## USER REDUCER ACTION TYPES ##
-export const updateLoginActionCreator = (field, value) => ({
- type: types.UPDATE_LOGIN,
- payload: { field, value },
-});
-
-export const sendLoginActionCreator = (email, password) => (
- (dispatch) => {
- fetch('/user/login', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- email: email,
- password: password
- }),
- }).then(response => {
- console.log('RESPONSE FROM SERVER AFTER LOGIN ATTEMPT: ', response.status);
- if (response.status === 200) {
- return response.json();
- }
- throw new Error('Bad response from server when trying to login: ', response.status)
- })
- .then((loginData) => {
- console.log('LOGIN DATA IS: ', loginData);
- dispatch({
- type: types.LOGIN_SUCCESSFUL,
- payload: loginData,
- });
- })
- .catch(err => console.log('sendLoginActionCreator ERR:', err));
- });
-
-export const updateSignupActionCreator = (field, value) => ({
- type: types.UPDATE_SIGNUP,
- payload: { field, value },
-});
-
-export const sendSignupActionCreator = (email, username, password) => (
- // Return a function handled by redux-thunk
- (dispatch) => {
- fetch('/user/signup', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- username: username,
- email: email,
- password: password
- }),
- }).then((response) => {
- console.log('RESPONSE FROM SERVER AFTER SIGNUP ATTEMPT: ', response.status);
- if (response.status === 200) {
- return response.json();
- }
- throw new Error('Bad response from server when trying to sign up: ', response.status);
- })
- .then((loginData) => {
- console.log('SIGNUP DATA IS: ', loginData);
- dispatch({
- type: types.LOGIN_SUCCESSFUL,
- payload: loginData,
- });
- })
- .catch((err) => console.error('sendLoginActionCreator ERR:', err));
- }
-);
-
-export const sendLogoutActionCreator = () => ({
- type: types.SEND_LOGOUT,
-});
-
-export const addWatchlistActionCreator = (event_id) => (
- (dispatch, getState) => {
- const { user_id } = getState().users;
- fetch('/user/watchlist', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- user_id, event_id,
- }),
- })
- .then((response) => {
- console.log('REQUEST TO ADD TO WATCHLIST, RESPONSE IS: ', response.status);
- if (response.status === 200) {
- return response.json();
- }
- throw new Error('Bad response from server when trying to sign up: ', response.status);
- })
- .then((addedData) => {
- console.log(addedData);
- })
- .catch((err) => console.error('sendLoginActionCreator ERR:', err));
- });
-
-export const getWatchlistActionCreator = () => (
- async (dispatch, getState) => {
- console.log('INSIDE GET WATCHLIST ACTION CREATOR');
- try {
- const { user_id } = getState().users;
- // Get all event_ids in watchlist
- const watchlist = await fetch(`/user/watchlist/${user_id}`).then(response => response.json());
- const apiStart = 'https://api.seatgeek.com/2/events/';
- const apiEnd = '?client_id=MjMwODQ2OTZ8MTYzMDA5MTEwMy4xMjAzNg';
- const watchListEvents = [];
- for (let i = 0; i < watchlist.length; i += 1) {
- console.log(watchlist[i].event_id);
- console.log(i);
- const event = await fetch(apiStart + watchlist[i].event_id + apiEnd).then(response => response.json());
- watchListEvents.push(event);
- }
- console.log('TRIED TO GET WATCHLIST, result: ', watchListEvents);
- dispatch({
- type: types.GET_WATCHLIST,
- payload: watchListEvents,
- });
- } catch(err) {
- console.log('ERROR WHEN GETTING watchlist: ', err);
- }
- });
-
-// ## TICKET REDUCER ACTION TYPES ##
-export const getEventsActionCreator = (dateRange) => (
- (dispatch) => {
- let endpoint = 'https://api.seatgeek.com/2/events?client_id=MjMwODQ2OTZ8MTYzMDA5MTEwMy4xMjAzNg&geoip=true&per_page=1000';
- const today = new Date().toISOString();
- let endDate = new Date();
- if (dateRange) {
- endDate.setDate(endDate.getDate() + parseInt(dateRange))
- endDate = endDate.toISOString();
- } else {
- endDate.setDate(endDate.getDate() + 1)
- endDate = endDate.toISOString();
- }
-
- endpoint += '&datetime_utc.gte=' + today + '&datetime_utc.lte=' + endDate;
-
- fetch(endpoint)
- .then(response => response.json())
- .then(data =>{
- dispatch({
- type: types.GET_EVENTS,
- payload: data.events,
- })
- });
- }
-);
-
-export const eventFilterActionCreator = (filterStr) => ({
- type: types.EVENT_FILTER,
- payload: filterStr,
-});
-
-
-// export const setDateRangeActionCreator = (dateRange) => ({
-// type: types.SET_DATE_RANGE,
-// payload: { dateRange },
-// });
diff --git a/parser_setup/__tests__/thenosebleeds/components/App.jsx b/parser_setup/__tests__/thenosebleeds/components/App.jsx
deleted file mode 100644
index 2e3be47..0000000
--- a/parser_setup/__tests__/thenosebleeds/components/App.jsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import React, { useState } from 'react';
-import { Switch, Route, Redirect } from 'react-router-dom';
-
-// Import Redux Related:
-import { connect } from 'react-redux';
-import * as actions from '../actions/actions';
-
-// Import React Components
-import NavBar from './NavBar.jsx';
-import Watchlist from './Watchlist.jsx';
-import Signup from './Signup.jsx';
-import Login from './Login.jsx';
-import Logout from './Logout.jsx';
-import Main from './Main.jsx';
-
-const mapStateToProps = ({ users }) => ({
- loginForm: users.loginForm,
- signupForm: users.signupForm,
- authUser: users.authUser,
- username: users.username,
- useremail: users.useremail,
- watchlist: users.watchlist,
-});
-
-const mapDispatchToProps = (dispatch) => ({
- updateLogin: (field, value) => {
- dispatch(actions.updateLoginActionCreator(field, value));
- },
- sendLogin: (email, password) => {
- dispatch(actions.sendLoginActionCreator(email, password));
- },
- updateSignup: (field, value) => {
- dispatch(actions.updateSignupActionCreator(field, value));
- },
- sendSignup: (username, email, password) => {
- dispatch(actions.sendSignupActionCreator(username, email, password));
- },
- sendLogout: () => {
- dispatch(actions.sendLogoutActionCreator());
- },
-});
-
-// App Component
-const App = ({
- authUser,
- username,
- useremail,
- updateSignup,
- signupForm,
- sendSignup,
- updateLogin,
- loginForm,
- sendLogin,
- sendLogout,
- watchlist
-}) => (
-
-
-
- {/* React Router Switches */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-);
-
-export default connect(mapStateToProps, mapDispatchToProps)(App);
diff --git a/parser_setup/__tests__/thenosebleeds/components/Login.jsx b/parser_setup/__tests__/thenosebleeds/components/Login.jsx
deleted file mode 100644
index 1741fe6..0000000
--- a/parser_setup/__tests__/thenosebleeds/components/Login.jsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import React from 'react';
-import { Link, Redirect } from 'react-router-dom';
-
-// Login Component
-const Login = ({ authUser, updateLogin, loginForm, sendLogin }) => {
- // If authorised redirec to root
- if (authUser) {
- return ;
- }
-
- // Otherwise display login page
- return (
-
-
LOGIN HERE !
-
-
- {/* LOGIN BUTTON */}
-
sendLogin(loginForm.email, loginForm.password)}
- >
- Log In
-
-
- No Account?
- Sign Up
-
-
- );
-};
-
-export default Login;
diff --git a/parser_setup/__tests__/thenosebleeds/components/Logout.jsx b/parser_setup/__tests__/thenosebleeds/components/Logout.jsx
deleted file mode 100644
index 19ee0a4..0000000
--- a/parser_setup/__tests__/thenosebleeds/components/Logout.jsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import React, { useEffect } from 'react';
-import { Redirect } from 'react-router-dom';
-
-// Login Component
-const Logout = ({ authUser, sendLogout }) => {
- // Logout user out when logout component renders:
- useEffect(() => {
- console.log('LOGOUT COMPONENT SIGNING OUT USER');
- sendLogout();
- }, []);
-
- if (authUser) {
- return Logging you out... ;
- };
-
- return ;
-};
-
-export default Logout;
diff --git a/parser_setup/__tests__/thenosebleeds/components/Main.jsx b/parser_setup/__tests__/thenosebleeds/components/Main.jsx
deleted file mode 100644
index da5b349..0000000
--- a/parser_setup/__tests__/thenosebleeds/components/Main.jsx
+++ /dev/null
@@ -1,143 +0,0 @@
-import React, { useEffect } from 'react';
-
-// Import Redux Related:
-import { connect } from 'react-redux';
-import * as actions from '../actions/actions';
-
-const mapStateToProps = ({ tickets }) => ({
- eventList: tickets.eventList,
-});
-
-const mapDispatchToProps = (dispatch) => ({
- getEvents: (dateRange) => {
- dispatch(actions.getEventsActionCreator(dateRange));
- },
- eventFilter: (filterStr) => {
- dispatch(actions.eventFilterActionCreator(filterStr));
- },
- addWatchlist: (event_id) => {
- dispatch(actions.addWatchlistActionCreator(event_id));
- },
-
-});
-
-// WatchList Component
-const Main = (props) => {
- // Get events when component mounts
- useEffect(() => {
- props.getEvents();
- }, []);
-
- console.log('THIS IS THE EVENTLIST: ', props.eventList, typeof props.eventList);
- const events = props.eventList.map((eventObj, i) => (
-
-
-
-
-
-
-
-
-
-
{eventObj.title}
-
{eventObj.datetime_local.slice(11)} - {eventObj.datetime_local.slice(0, 10)}
-
- {eventObj.stats.listing_count
- ? (
-
-
- Lowest Price: ${eventObj.stats.lowest_sg_base_price}
-
-
- Average Price: ${eventObj.stats.average_price}
-
-
- Num. Listings: {eventObj.stats.listing_count}
-
-
- )
- : (
-
- No tickets currently listed!
-
- )}
-
-
Book Tickets
- {props.authUser ? (
-
props.addWatchlist(eventObj.id)}
- >
- Add to Watchlist
-
- )
- : null }
-
-
-
-
-
-
- ));
-
- return (
-
-
Events Near You:
-
-
- Select Date Range:
- {
- console.log(e.target.value);
- props.getEvents(e.target.value);
- }
- }
- >
- Next 24 Hours
- Next 7 Days
- Next 30 Days
-
-
-
-
- Filter Events by type:
- {
- console.log('Changed event filter: ', e.target.value);
- props.eventFilter(e.target.value);
- }
- }
- >
- All Events
- Sporting Events
- Concerts
- Theater
- Comedy Shows
-
-
-
-
- {/*
props. > }
- >
- Find Events
- */}
-
-
{`${props.eventList.length} events found:`}
-
- {/* EVENT CARDS */}
-
- {events.length ? (events) :
No events found! }
-
-
-
- );
-};
-
-export default connect(mapStateToProps, mapDispatchToProps)(Main);
diff --git a/parser_setup/__tests__/thenosebleeds/components/NavBar.jsx b/parser_setup/__tests__/thenosebleeds/components/NavBar.jsx
deleted file mode 100644
index 8c4c55b..0000000
--- a/parser_setup/__tests__/thenosebleeds/components/NavBar.jsx
+++ /dev/null
@@ -1,65 +0,0 @@
-import React from 'react';
-import { Link } from 'react-router-dom';
-
-const NavBar = ({ authUser, username, useremail }) => {
- console.log('NAVBAR RENDERED');
-
- // Conditional navbar links depending on authentication:
- return (
-
-
- {/* {NAVBAR BRAND} */}
-
-
- nosebleeds
-
-
-
-
-
-
-
- {/* {NAVBAR LEFT} */}
-
-
- Home
-
- {authUser
- ? (
-
- Watchlist
-
- )
- : null}
-
-
- {/* {NAVBAR RIGHT} */}
-
- {authUser
- ? (
-
-
- Logged in as {username}
-
-
- Logout
-
-
- )
- : (
-
-
- Login
-
-
- Signup
-
-
- )}
-
-
-
- );
-};
-
-export default NavBar;
diff --git a/parser_setup/__tests__/thenosebleeds/components/Signup.jsx b/parser_setup/__tests__/thenosebleeds/components/Signup.jsx
deleted file mode 100644
index 57ac238..0000000
--- a/parser_setup/__tests__/thenosebleeds/components/Signup.jsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import React from 'react';
-import { Redirect, Link } from 'react-router-dom';
-
-// Login Component
-const Signup = ({ authUser, updateSignup, signupForm, sendSignup }) => {
- // If authorised redirect to root
- if (authUser) {
- return ;
- }
-
- // Otherwise display signup page
- return (
-
-
Create an Account:
-
-
{
- sendSignup(signupForm.email, signupForm.username, signupForm.password);
- }}
- >
- Signup
-
-
- Already have an account?
- Log in
-
-
- );
-};
-
-export default Signup;
diff --git a/parser_setup/__tests__/thenosebleeds/components/Watchlist.jsx b/parser_setup/__tests__/thenosebleeds/components/Watchlist.jsx
deleted file mode 100644
index 24c60ea..0000000
--- a/parser_setup/__tests__/thenosebleeds/components/Watchlist.jsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import React, { useEffect } from 'react';
-import { connect } from 'react-redux';
-import * as actions from '../actions/actions';
-
-// const mapStateToProps = ({ users }) => ({
-// watchlist: users.watchlist,
-// });
-
-const mapDispatchToProps = (dispatch) => ({
- getWatchlist: () => {
- dispatch(actions.getWatchlistActionCreator());
- },
-});
-
-// WatchList Component
-const Watchlist = (props) => {
- console.log(props.getWatchlist, 'watchlist: ', props.watchlist);
-
- useEffect(() => {
- console.log('USING EFFECT WHEN LOADING WATCHLIST');
- props.getWatchlist();
- }, []);
- console.log('WATCHLIST in WATCHLIST COMPONENT: ', props.watchlist);
- const events = props.watchlist.map((eventObj, i) => (
-
-
-
-
-
-
-
-
-
-
{eventObj.title}
-
{eventObj.datetime_local.slice(11)} - {eventObj.datetime_local.slice(0, 10)}
-
- {eventObj.stats.listing_count
- ? (
-
-
- Lowest Price: ${eventObj.stats.lowest_sg_base_price}
-
-
- Average Price: ${eventObj.stats.average_price}
-
-
- Num. Listings: {eventObj.stats.listing_count}
-
-
- )
- : (
-
- No tickets currently listed!
-
- )}
-
-
-
-
-
-
- ));
-
- return (
-
-
Events In Your Watchlist:
- {/* EVENT CARDS */}
-
- {events.length ? (events) :
No events found! }
-
-
- );
-};
-
-export default connect(null, mapDispatchToProps)(Watchlist);
diff --git a/parser_setup/__tests__/thenosebleeds/components/homepage.js b/parser_setup/__tests__/thenosebleeds/components/homepage.js
deleted file mode 100644
index f383c69..0000000
--- a/parser_setup/__tests__/thenosebleeds/components/homepage.js
+++ /dev/null
@@ -1,130 +0,0 @@
-import React, { Component } from 'react';
-class HomePage extends Component {
- constructor (props) {
- super(props)
- this.state = {
- lowestDodgerPrice: '',
- DodgerUrl: '',
- lowestAngelPrice: '',
- AngelUrl: '',
- lowestLafcPrice: '',
- lowestGalaxyPrice: '',
- lowestLakerTicket: '',
- lowestChargerTicket: '',
- lowestClipperTicket: '',
- lowestRamTicket: '',
- isUser: false,
- dodgerCardValue:'',
- }
- //this.handleDodgerPriceChange = this.handleDodgerPriceChange.bind(this);
- // this.handleGalaxyPriceChange = this.handleGalaxyPriceChange.bind(this);
- // this.handleAngelPriceChange = this.handleAngelPriceChange.bind(this);
- // this.handleLafcPriceChange = this.handleLafcPriceChange.bind(this);
- // this.handleLakerTicketChange = this.handleLakerTicketChange.bind(this);
- // this.handleClipperTicketChange = this.handleClipperTicketChange.bind(this);
- // this.handleRamTicketChange = this.handleRamTicketChange.bind(this);
- // this.lowestChargerTicket = this.lowestChargerTicket.bind(this)
- // this.handleOnClick = this.handleOnclick.bind(this);
- }
-
- // handleLakerClick(event) {
- // this.setState({lowestLakerTicket: event.target.value});
- // }
-
- // handleClipperClick(event) {
- // this.setState({lowestClipperTicket: event.target.value});
- // }
-
- // handleRamClick(event) {
- // this.setState({lowestRamTicket: event.target.value});
- // }
-
- // handleDodgerClick(event) {
- // this.setState({lowestDodgerPrice: event.target.value});
- // }
-
- // handleAngelClick(event) {
- // this.setState({lowestAngelPrice: event.target.value});
- // }
-
- // handleChargerClick(event) {
- // this.setState({lowestChargerTicket: event.target.value});
- // }
-
- // handleGalaxyClick(event) {
- // this.setState({lowestGalaxyPrice: event.target.value});
- // }
-
- // handleLafcClick(event) {
- // this.setState({lowestLafcPrice: event.target.value});
- // }
-
- // .stats.lowest_price_good_deals
- // .url
- filterData = (reference) => {
- const teamArr = ['los-angeles-dodgers', 'los-angeles-lakers', 'los-angeles-clippers', 'los-angeles-angels', 'los-angeles-chargers', 'los-angeles-rams', 'los-anageles-galaxy'];
- for (let i = 0; i < teamArr.length-1; i++){
- let teamApi = baseApi +teamArr[reference];
- this.getData(teamApi,reference)} let baseApi = 'https://api.seatgeek.com/2/events?client_id=MjMwODQ2OTZ8MTYzMDA5MTEwMy4xMjAzNg&geoip=true&performers.slug=';
-
- }
- getData = (teamApi, reference) =>{fetch(teamApi)
- .then(response => response.json())
- .then(data =>{
- let today = new Date();
- let date = today.getFullYear()+'-'+'0'+(today.getMonth()+1)+'-'+'0'+today.getDate();
- console.log(date);
- if (reference ===0)
- { this.setState({lowestDodgerPrice: "$" + data.events[0].stats.lowest_sg_base_price + " lowest Dodgers ticket price", DodgerUrl: data.events[0].url }) }
- else if (reference === 3)
- { this.setState({lowestAngelPrice: "$" + data.events[0].stats.lowest_sg_base_price + " lowest Angels ticket price", AngelUrl: data.events[0].url}) }
-
-
- // handleDodgerClick(event) {
- // this.setState({lowestDodgerPrice: data.events[0].stats.lowest_price_good_deals});
- // }
- // handleSubmit(event) {
- // this.setState({lowestDodgerPrice: data.events[0].stats.lowest_price_good_deals});
- // event.preventDefault();
- // }
-
- render () {
- //this.filterData();
- console.log('this is state', this.state);
- return (
-
-
-
-
-
CLICK ON A TEAM TO SEE THE LOWEST TICKET PRICE OF THE DAY
-
SEARCH
-
- LAKERS
- CLIPPERS
- RAMS
- {
- e.preventDefault();
- this.filterData(0)
- }}>DODGERS
- {
- e.preventDefault();
- this.filterData(3)
-
- }}>ANGELS
- LAFC
- GALAXY
- CHARGERS
-
-
-
-
-
- )
- }
-}
-
-export default HomePage;
\ No newline at end of file
diff --git a/parser_setup/__tests__/thenosebleeds/constants/actionTypes.js b/parser_setup/__tests__/thenosebleeds/constants/actionTypes.js
deleted file mode 100644
index 8e14678..0000000
--- a/parser_setup/__tests__/thenosebleeds/constants/actionTypes.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// Action types for Redux
-
-// ## USER REDUCER ACTION TYPES ##
-export const UPDATE_LOGIN = 'UPDATE_LOGIN';
-export const SEND_LOGIN = 'SEND_LOGIN';
-export const LOGIN_SUCCESSFUL = 'LOGIN_SUCCESSFUL';
-export const UPDATE_SIGNUP = 'UPDATE_SIGNUP';
-export const SEND_SIGNUP = 'SIGN_UP';
-export const SEND_LOGOUT = 'SEND_LOGOUT';
-export const ADD_WATCHLIST = 'ADD_WATCHLIST';
-export const GET_WATCHLIST = 'GET_WATCHLIST';
-
-// ## TICKET REDUCER ACTION TYPES ##
-export const GET_EVENTS = 'GET_EVENTS';
-export const SET_DATE_RANGE = 'SET_DATE_RANGE';
-export const EVENT_FILTER = 'EVENT_FILTER';
diff --git a/parser_setup/__tests__/thenosebleeds/index.html b/parser_setup/__tests__/thenosebleeds/index.html
deleted file mode 100644
index 3fdc143..0000000
--- a/parser_setup/__tests__/thenosebleeds/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
- NOSEBLEEDS
-
-
-
-
-
-
\ No newline at end of file
diff --git a/parser_setup/__tests__/thenosebleeds/index.js b/parser_setup/__tests__/thenosebleeds/index.js
deleted file mode 100644
index 0044f4f..0000000
--- a/parser_setup/__tests__/thenosebleeds/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import React from 'react';
-import { render } from 'react-dom';
-import { BrowserRouter as Router } from 'react-router-dom';
-
-import { Provider } from 'react-redux';
-import store from './store';
-
-// Import styles from SASS / BootStrap
-import bootstrap from 'bootstrap';
-import styles from './styles/application.scss';
-
-// Import React Components
-import App from './components/App.jsx';
-
-render(
-
-
-
-
- ,
- document.getElementById('root'),
-);
diff --git a/parser_setup/__tests__/thenosebleeds/reducers/index.js b/parser_setup/__tests__/thenosebleeds/reducers/index.js
deleted file mode 100644
index 3adc386..0000000
--- a/parser_setup/__tests__/thenosebleeds/reducers/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import { combineReducers } from 'redux';
-import userReducer from './userReducer';
-import ticketReducer from './ticketReducer';
-
-// Combine and export reducer
-export default combineReducers({
- users: userReducer,
- tickets: ticketReducer,
-});
diff --git a/parser_setup/__tests__/thenosebleeds/reducers/ticketReducer.js b/parser_setup/__tests__/thenosebleeds/reducers/ticketReducer.js
deleted file mode 100644
index 515ee83..0000000
--- a/parser_setup/__tests__/thenosebleeds/reducers/ticketReducer.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import * as types from '../constants/actionTypes';
-
-const initialState = {
- allEvents: [],
- eventList: [],
- eventFilter: '',
-};
-
-const ticketReducer = (state = initialState, action) => {
- let newEventList;
- let allEvents;
-
- switch (action.type) {
- case types.GET_EVENTS:
- allEvents = action.payload;
- // If filtering, show only specific events:
- if (state.eventFilter) {
- newEventList = allEvents.filter((event) => {
- for (let i = 0; i < event.taxonomies.length; i += 1) {
- console.log(event.taxonomies[i].name);
- if (event.taxonomies[i].name === state.eventFilter) {
- return true;
- }
- }
- return false;
- });
- } else {
- newEventList = action.payload.slice();
- }
- return {
- ...state,
- eventList: newEventList,
- allEvents,
- };
-
- case types.EVENT_FILTER:
- // If filtering, show only specific events:
- if (action.payload) {
- newEventList = state.allEvents.filter((event) => {
- for (let i = 0; i < event.taxonomies.length; i += 1) {
- console.log(event.taxonomies[i].name);
- if (event.taxonomies[i].name === action.payload) {
- return true;
- }
- }
- return false;
- });
- } else {
- newEventList = state.allEvents.slice();
- }
- return {
- ...state,
- eventList: newEventList,
- eventFilter: action.payload,
- };
-
- default:
- return state;
- }
-};
-
-export default ticketReducer;
diff --git a/parser_setup/__tests__/thenosebleeds/reducers/userReducer.js b/parser_setup/__tests__/thenosebleeds/reducers/userReducer.js
deleted file mode 100644
index 8affd6a..0000000
--- a/parser_setup/__tests__/thenosebleeds/reducers/userReducer.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import * as types from '../constants/actionTypes';
-
-// Reducer that handles user login, logout and authentication
-
-const initialState = {
- username: null,
- useremail: null,
- user_id: null,
- authUser: false,
- loginForm: { email: '', password: '' },
- signupForm: { email: '', username: '', password: '' },
- watchlist: [],
-};
-
-const userReducer = (state = initialState, action) => {
- switch (action.type) {
- case types.UPDATE_LOGIN:
- console.log('TYRING TO UPDATE LOGIN STATE FORM: ', action.payload.field, action.payload.value);
- return {
- ...state,
- loginForm: { ...state.loginForm, [action.payload.field]: action.payload.value },
- };
-
- case types.SEND_SIGNUP:
- console.log('TRYING TO SEND SIGNUP TO SERVER: ', action.payload.email, action.payload.username, action.payload.password);
- return state;
-
- case types.LOGIN_SUCCESSFUL:
- console.log('LOGGED IN SUCCESSFULLY!');
- const { user_id, email, username } = action.payload;
- return {
- ...state,
- authUser: true,
- user_id,
- username,
- useremail: email,
- };
-
- case types.SEND_LOGOUT:
- console.log('LOGGING OUT!');
- return {
- username: null,
- useremail: null,
- user_id: null,
- authUser: false,
- loginForm: { email: '', password: '' },
- signupForm: { email: '', username: '', password: '' },
- };
-
- case types.UPDATE_SIGNUP:
- console.log('TYRING TO UPDATE SIGNUP FORM: ', action.payload.field, action.payload.value);
- return {
- ...state,
- signupForm: { ...state.signupForm, [action.payload.field]: action.payload.value },
- };
-
- case types.GET_WATCHLIST:
- console.log('UPDATING WATCHLIST: ', action.payload);
- return {
- ...state,
- watchlist: action.payload,
- };
-
- default:
- return state;
- }
-};
-
-export default userReducer;
diff --git a/parser_setup/__tests__/thenosebleeds/store.js b/parser_setup/__tests__/thenosebleeds/store.js
deleted file mode 100644
index 7630298..0000000
--- a/parser_setup/__tests__/thenosebleeds/store.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { createStore, applyMiddleware } from 'redux';
-import { composeWithDevTools } from 'redux-devtools-extension';
-import thunk from 'redux-thunk';
-import reducers from './reducers/index';
-
-// we are adding composeWithDevTools here to get easy access to the Redux dev tools
-const store = createStore(
- reducers,
- composeWithDevTools(applyMiddleware(thunk)),
-);
-
-export default store;
diff --git a/parser_setup/__tests__/thenosebleeds/styles/OLDstyles.css b/parser_setup/__tests__/thenosebleeds/styles/OLDstyles.css
deleted file mode 100644
index ea364ab..0000000
--- a/parser_setup/__tests__/thenosebleeds/styles/OLDstyles.css
+++ /dev/null
@@ -1,116 +0,0 @@
-body {
- background-color: #FFF;
-}
-
-li {
- list-style-type: none;
-}
-/* #083C6B; */
-
-.buttons {
- color: rgb(0, 0, 0);
- background-color: rgb(235, 235, 235);
- font-weight: bold;
- border: 3px outset rgb(194, 194, 194);
- transition: 0.01s;
-}
-
-.buttons:hover {
- color: rgb(255, 255, 255);
- border: 3px inset rgb(122, 122, 122);
- background-color: rgb(185, 185, 185);
-}
-
-#login {
- display: flex;
- justify-content: center;
-}
-
-.priceLink {
- color: rgb(255, 255, 255);
- background-color: transparent;
- text-decoration: none;
- font-size: 100px;
-}
-
-.priceLink:hover {
- color: yellow;
-}
-
-.priceAndTicket {
- color: rgb(255, 0, 0);
-}
-
-
-.primary {
- display: flex;
- justify-content: center;
- color: #1e90ff;
- background-color: rgb(99, 99, 99);
- margin: 100px;
-}
-
-#profile {
- border: 3px groove #1e90ff;
- background-color:#1e90ff;
- background-size: 400px;
-
-}
-
-.search {
- border: 0.5rem solid rgb(95, 95, 95);
- margin: 0;
- border-radius: 10px;
- width: 282px;
- color: black;
-}
-
-#searchBar {
- width: 200px;
-
-}
-
-#searchButton {
- color:#1e90ff;
- background-color: rgb(71, 71, 71);
- border: solid rgb(46, 46, 46);
-}
-
-/* Style the tab */
-.tab {
- overflow: hidden;
- border: 3px solid #c4c4c4;
- background-color: #c4c4c4;
-}
-
-/* Style the buttons that are used to open the tab content */
-.tab button {
- color: #c41c1c;
- background-color: inherit;
- float: left;
- border: 4px solid #ffffff;
- outline: none;
- cursor: pointer;
- padding: 14px 16px;
- transition: 0.9s;
-}
-
-/* Change background color of buttons on hover */
-.tab button:hover {
- color: #c41c1c;
- background-color: #1e90ff;
- border: 4px solid #1e90ff;
-}
-
-/* Create an active/current tablink class */
-.tab button.active {
- background-color: #1e90ff;
-}
-
-/* Style the tab content */
-.tabcontent {
- display: none;
- padding: 6px 12px;
- border: 1px solid #ccc;
- border-top: none;
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/thenosebleeds/styles/_custom.scss b/parser_setup/__tests__/thenosebleeds/styles/_custom.scss
deleted file mode 100644
index 86ad502..0000000
--- a/parser_setup/__tests__/thenosebleeds/styles/_custom.scss
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ### CUSTOM STYLES ### */
-
-/* ### OVERALL STYLES ### */
-
-
-body {
- background-color: lightgray;
-}
-
-li {
- list-style-type: none;
-}
-
-.nav-bar {
- display: flex;
-
-}
-
-.nav-link {
- margin-right: 10px;
-}
-
-/* ### NAVBAR ### */
-
-.navbar.navbar-light.bg-light {
- background-color: dodgerblue !important;
- margin-bottom: 20px;
-
- .navbar-brand {
- font-size: 24px;
- font-weight: 600;
- color: #FFF;
- border: none;
- background-color: transparent;
- }
-
- .navbar-nav.ml-auto {
- margin-left: auto;
- }
-
- .nav-item {
- font-size: 16px;
- a {
- text-decoration: none;
- }
- .nav-link {
- border: none;
- background-color: transparent;
- }
- }
-}
-
-
-/* ### CARDS ### */
-
-.event-card.card {
- padding: 0 0;
-
- .card-body {
- .card-subtitle {
- margin-bottom: 16px;
- }
- .card-text {
- margin-bottom: 20px;
- font-size: 20px;
- span {
- margin-right: 28px;
- }
- }
- // .prices {
- // display: flex;
- // justify-content: space-between;
- // }
- .btn-group {
- margin-top: 28px;
- a {
- margin-right: 20px;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/parser_setup/__tests__/thenosebleeds/styles/application.scss b/parser_setup/__tests__/thenosebleeds/styles/application.scss
deleted file mode 100644
index 4816343..0000000
--- a/parser_setup/__tests__/thenosebleeds/styles/application.scss
+++ /dev/null
@@ -1,2 +0,0 @@
-@import 'custom';
-@import '~bootstrap/scss/bootstrap'
\ No newline at end of file
diff --git a/parser_setup/__tests__/thenosebleeds/styles/styles.css b/parser_setup/__tests__/thenosebleeds/styles/styles.css
deleted file mode 100644
index 287c70e..0000000
--- a/parser_setup/__tests__/thenosebleeds/styles/styles.css
+++ /dev/null
@@ -1,16 +0,0 @@
-body {
- background-color: lightgray;
-}
-
-li {
- list-style-type: none;
-}
-
-.nav-bar {
- display: flex;
-
-}
-
-.nav-link {
- margin-right: 10px;
-}
\ No newline at end of file
diff --git a/parser_setup/package-lock.json b/parser_setup/package-lock.json
deleted file mode 100644
index 3f0052a..0000000
--- a/parser_setup/package-lock.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "name": "parser_setup",
- "version": "1.0.0",
- "lockfileVersion": 1,
- "requires": true,
- "dependencies": {
- "@babel/helper-validator-identifier": {
- "version": "7.15.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz",
- "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==",
- "dev": true
- },
- "@babel/parser": {
- "version": "7.15.6",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.6.tgz",
- "integrity": "sha512-S/TSCcsRuCkmpUuoWijua0Snt+f3ewU/8spLo+4AXJCZfT0bVCzLD5MuOKdrx0mlAptbKzn5AdgEIIKXxXkz9Q==",
- "dev": true
- },
- "@babel/types": {
- "version": "7.15.6",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz",
- "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==",
- "dev": true,
- "requires": {
- "@babel/helper-validator-identifier": "^7.14.9",
- "to-fast-properties": "^2.0.0"
- }
- },
- "@types/node": {
- "version": "16.9.1",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz",
- "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==",
- "dev": true
- },
- "to-fast-properties": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
- "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
- "dev": true
- },
- "typescript": {
- "version": "4.4.3",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.3.tgz",
- "integrity": "sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==",
- "dev": true
- }
- }
-}
diff --git a/parser_setup/package.json b/parser_setup/package.json
deleted file mode 100644
index 3758a55..0000000
--- a/parser_setup/package.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "parser_setup",
- "version": "1.0.0",
- "description": "",
- "main": "parser.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "author": "",
- "license": "ISC",
- "devDependencies": {
- "@babel/parser": "^7.15.6",
- "@babel/types": "^7.15.6",
- "@types/node": "^16.9.1",
- "@types/react": "^17.0.21",
- "react": "^17.0.2",
- "typescript": "^4.4.3"
- }
-}
diff --git a/parser_setup/parser-class.ts b/parser_setup/parser-class.ts
deleted file mode 100644
index ea329be..0000000
--- a/parser_setup/parser-class.ts
+++ /dev/null
@@ -1,205 +0,0 @@
-import * as babelParser from '@babel/parser';
-import * as path from 'path';
-import * as fs from 'fs';
-
-// npx tsc --watch parser-class.ts to watch for changes in this file
-
-// React component tree is a nested data structure, children are Trees
-type Tree = {
- name: string,
- fileName: string,
- filePath: string,
- importPath: string,
- depth: number,
- count: number,
- thirdParty: boolean,
- reactRouter: boolean,
- children: Tree[],
- props: {[key: string]: boolean},
- error: string;
-};
-
-
-class SaplingParser {
- entryFile: string;
- tree: Tree | undefined;
- fileList: {[key: string] : boolean};
-
- constructor(filePath: string) {
- // Normalize filePath to posix
- console.log('Initial filepath: ', filePath);
- this.entryFile = path.resolve(filePath.split(path.win32.sep).join(path.posix.sep));
- console.log('Entryfile before slice: ', this.entryFile);
- // Temporary fix for wsl file system:
- if (this.entryFile.includes('/wsl$/')) {
- console.log(this.entryFile.split('/'));
- this.entryFile = '/' + this.entryFile.split('/').slice(3).join('/');
- }
- console.log('ENTRY FILE PATH: ', this.entryFile);
- this.tree = undefined; //this.parser(this.entryFile);
- // Break down and reasemble given filePath safely for any OS using path?
- }
-
-
- // Public method to generate component tree based on current entryFile
- public parse() : Tree {
- // Create root Tree node
- const root = {
- name: path.basename(this.entryFile).replace(/\.(t|j)sx?$/, ''),
- fileName: path.basename(this.entryFile),
- filePath : this.entryFile,
- importPath: this.entryFile,
- depth: 0,
- count: 1,
- thirdParty: false,
- reactRouter: false,
- children: [],
- props: {},
- error: ''
- };
-
- this.tree = root;
- this.parser(root);
- return this.tree;
- }
-
-
- // Recursively builds the React component tree structure starting from root node
- private parser(componentTree: Tree) : Tree {
- // If import is a node module, do not parse any deeper
- if (!['\\', '/', '.'].includes(componentTree.importPath[0])) {
- componentTree.thirdParty = true;
- if (componentTree.fileName === 'react-router-dom') componentTree.reactRouter = true;
- return;
- }
-
- // Check that file has valid fileName/Path, if not found, add error to node and halt
- const fileName = this.getFileName(componentTree);
- if (!fileName) {
- componentTree.error = 'File not found.'
- console.log('FILE NOT FOUND', componentTree);
- return;
- }
-
- // Create abstract syntax tree of current component tree file
- let ast;
- try {
- ast = babelParser.parse(fs.readFileSync(path.resolve(componentTree.filePath), 'utf-8'), {
- sourceType: 'module',
- tokens: true,
- plugins: [
- 'jsx'
- ]
- });
- } catch (err) {
- console.log('Error when trying to parse file');
- componentTree.error = 'Error while processing this file/node'
- return componentTree;
- }
-
- // Find imports in the current file, then find child components in the current file
- const imports = this.getImports(ast.program.body);
-
- // If current file imports React, get JSX Children:
- if (imports.React) {
- componentTree.children = this.getJSXChildren(ast.tokens, imports, componentTree);
- }
-
- // Recursively parse all child components
- componentTree.children.forEach(child => this.parser(child))
-
- return componentTree;
- }
-
-
- // Finds files where import string does not include a file extension
- private getFileName(componentTree: Tree) : string | undefined {
- const ext = path.extname(componentTree.filePath);
- let fileName = componentTree.fileName;
- if (!ext) {
- // Try and find file extension that exists in directory:
- const fileArray = fs.readdirSync(path.dirname(componentTree.filePath));
- const regEx = new RegExp(`${componentTree.fileName}.(j|t)sx?$`);
- fileName = fileArray.find(fileStr => fileStr.match(regEx));
- fileName ? componentTree.filePath += path.extname(fileName) : null;
- }
-
- return fileName;
- }
-
-
- // Extracts Imports from current file
- private getImports(body : {[key : string]: any}[])
- : {[key : string]: {importPath: string, importName: string}} {
- const bodyImports = body.filter(item => item.type === 'ImportDeclaration')
- return bodyImports.reduce((accum, curr) => {
- curr.specifiers.forEach( i => {
- accum[i.local.name] = {
- importPath: curr.source.value,
- importName: (i.imported)? i.imported.name : i.local.name
- }
- });
-
- // accum[curr.specifiers[0].local.name] = curr.source.value;
- return accum;
- }, {});
- }
-
-
- // Finds JSX React Components in current file
- private getJSXChildren(astTokens: [{[key: string]: any}],
- importsObj : {[key : string]: {importPath: string, importName: string}},
- parentNode: Tree) : Tree[] {
-
- const childNodes: {[key : string]: Tree} = {};
-
- for (let i = 0; i < astTokens.length; i++) {
- const token = astTokens[i + 1];
-
- if (astTokens[i].type.label === 'jsxTagStart'
- && token.type.label === 'jsxName'
- && importsObj[token.value]) {
- const props = this.getJSXProps(astTokens, i + 2);
-
- if (childNodes[token.value]) {
- childNodes[token.value].count += 1;
- childNodes[token.value].props = {...childNodes[token.value].props, ...props}
- } else {
- // Add tree node to childNodes if one does not exist
- childNodes[token.value] = {
- name: importsObj[token.value]['importName'],
- fileName: path.basename(importsObj[token.value]['importPath']),
- filePath: path.resolve(path.dirname(parentNode.filePath), importsObj[token.value]['importPath']),
- importPath: importsObj[token.value]['importPath'],
- depth: parentNode.depth + 1,
- thirdParty: false,
- reactRouter: false,
- count: 1,
- props: props,
- children: [],
- error: '',
- }
- }
- }
- }
- return Object.values(childNodes);
- }
-
- // Extracts prop names from a JSX element
- private getJSXProps(astTokens: {[key: string]: any}[], j : number) : {[key : string]: boolean} {
- const props = {};
- while (astTokens[j].type.label !== "jsxTagEnd") {
- if (astTokens[j].type.label === "jsxName" && astTokens[j + 1].value === "=") {
- props[astTokens[j].value] = true;
- }
- j += 1;
- }
- return props;
- }
-}
-
-// Test output of the class:
-const parser = new SaplingParser('./__tests__/test_3/index.jsx');
-const output = parser.parse();
-
-fs.writeFileSync('sapling-output.json', JSON.stringify(output));
\ No newline at end of file
diff --git a/parser_setup/parser-output.json b/parser_setup/parser-output.json
deleted file mode 100644
index f6a486e..0000000
--- a/parser_setup/parser-output.json
+++ /dev/null
@@ -1 +0,0 @@
-{"type":"File","start":0,"end":247,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":0}},"errors":[],"program":{"type":"Program","start":0,"end":247,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":0}},"sourceType":"module","interpreter":null,"body":[{"type":"ImportDeclaration","start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},"specifiers":[{"type":"ImportDefaultSpecifier","start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}},"local":{"type":"Identifier","start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12},"identifierName":"React"},"name":"React"}}],"source":{"type":"StringLiteral","start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25}},"extra":{"rawValue":"react","raw":"'react'"},"value":"react"}},{"type":"ImportDeclaration","start":27,"end":62,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":35}},"specifiers":[{"type":"ImportSpecifier","start":36,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}},"imported":{"type":"Identifier","start":36,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15},"identifierName":"render"},"name":"render"},"local":{"type":"Identifier","start":36,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15},"identifierName":"render"},"name":"render"}}],"source":{"type":"StringLiteral","start":50,"end":61,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":34}},"extra":{"rawValue":"react-dom","raw":"'react-dom'"},"value":"react-dom"}},{"type":"ImportDeclaration","start":63,"end":111,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":48}},"specifiers":[{"type":"ImportSpecifier","start":72,"end":78,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":15}},"imported":{"type":"Identifier","start":72,"end":78,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":15},"identifierName":"Switch"},"name":"Switch"},"local":{"type":"Identifier","start":72,"end":78,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":15},"identifierName":"Switch"},"name":"Switch"}},{"type":"ImportSpecifier","start":80,"end":85,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":22}},"imported":{"type":"Identifier","start":80,"end":85,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":22},"identifierName":"Route"},"name":"Route"},"local":{"type":"Identifier","start":80,"end":85,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":22},"identifierName":"Route"},"name":"Route"}}],"source":{"type":"StringLiteral","start":92,"end":110,"loc":{"start":{"line":3,"column":29},"end":{"line":3,"column":47}},"extra":{"rawValue":"react-router-dom","raw":"'react-router-dom'"},"value":"react-router-dom"}},{"type":"ExpressionStatement","start":114,"end":246,"loc":{"start":{"line":6,"column":0},"end":{"line":12,"column":43}},"expression":{"type":"CallExpression","start":114,"end":245,"loc":{"start":{"line":6,"column":0},"end":{"line":12,"column":42}},"callee":{"type":"Identifier","start":114,"end":120,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":6},"identifierName":"render"},"name":"render"},"arguments":[{"type":"JSXElement","start":124,"end":211,"loc":{"start":{"line":7,"column":2},"end":{"line":12,"column":8}},"openingElement":{"type":"JSXOpeningElement","start":124,"end":129,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":7}},"name":{"type":"JSXIdentifier","start":125,"end":128,"loc":{"start":{"line":7,"column":3},"end":{"line":7,"column":6}},"name":"div"},"attributes":[],"selfClosing":false},"closingElement":{"type":"JSXClosingElement","start":205,"end":211,"loc":{"start":{"line":12,"column":2},"end":{"line":12,"column":8}},"name":{"type":"JSXIdentifier","start":207,"end":210,"loc":{"start":{"line":12,"column":4},"end":{"line":12,"column":7}},"name":"div"}},"children":[{"type":"JSXText","start":129,"end":134,"loc":{"start":{"line":7,"column":7},"end":{"line":8,"column":4}},"extra":{"rawValue":"\n ","raw":"\n "},"value":"\n "},{"type":"JSXElement","start":134,"end":202,"loc":{"start":{"line":8,"column":4},"end":{"line":11,"column":13}},"openingElement":{"type":"JSXOpeningElement","start":134,"end":143,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":13}},"name":{"type":"JSXIdentifier","start":135,"end":141,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":11}},"name":"Switch"},"attributes":[],"selfClosing":false},"closingElement":{"type":"JSXClosingElement","start":193,"end":202,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":13}},"name":{"type":"JSXIdentifier","start":195,"end":201,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":12}},"name":"Switch"}},"children":[{"type":"JSXText","start":143,"end":150,"loc":{"start":{"line":8,"column":13},"end":{"line":9,"column":6}},"extra":{"rawValue":"\n ","raw":"\n "},"value":"\n "},{"type":"JSXElement","start":150,"end":188,"loc":{"start":{"line":9,"column":6},"end":{"line":10,"column":14}},"openingElement":{"type":"JSXOpeningElement","start":150,"end":173,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":29}},"name":{"type":"JSXIdentifier","start":151,"end":156,"loc":{"start":{"line":9,"column":7},"end":{"line":9,"column":12}},"name":"Route"},"attributes":[{"type":"JSXAttribute","start":157,"end":172,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":28}},"name":{"type":"JSXIdentifier","start":157,"end":166,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":22}},"name":"component"},"value":{"type":"JSXExpressionContainer","start":167,"end":172,"loc":{"start":{"line":9,"column":23},"end":{"line":9,"column":28}},"expression":{"type":"Identifier","start":168,"end":171,"loc":{"start":{"line":9,"column":24},"end":{"line":9,"column":27},"identifierName":"App"},"name":"App"}}}],"selfClosing":false},"closingElement":{"type":"JSXClosingElement","start":180,"end":188,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":14}},"name":{"type":"JSXIdentifier","start":182,"end":187,"loc":{"start":{"line":10,"column":8},"end":{"line":10,"column":13}},"name":"Route"}},"children":[{"type":"JSXText","start":173,"end":180,"loc":{"start":{"line":9,"column":29},"end":{"line":10,"column":6}},"extra":{"rawValue":"\n ","raw":"\n "},"value":"\n "}]},{"type":"JSXText","start":188,"end":193,"loc":{"start":{"line":10,"column":14},"end":{"line":11,"column":4}},"extra":{"rawValue":"\n ","raw":"\n "},"value":"\n "}]},{"type":"JSXText","start":202,"end":205,"loc":{"start":{"line":11,"column":13},"end":{"line":12,"column":2}},"extra":{"rawValue":"\n ","raw":"\n "},"value":"\n "}]},{"type":"CallExpression","start":213,"end":244,"loc":{"start":{"line":12,"column":10},"end":{"line":12,"column":41}},"callee":{"type":"MemberExpression","start":213,"end":236,"loc":{"start":{"line":12,"column":10},"end":{"line":12,"column":33}},"object":{"type":"Identifier","start":213,"end":221,"loc":{"start":{"line":12,"column":10},"end":{"line":12,"column":18},"identifierName":"document"},"name":"document"},"computed":false,"property":{"type":"Identifier","start":222,"end":236,"loc":{"start":{"line":12,"column":19},"end":{"line":12,"column":33},"identifierName":"getElementById"},"name":"getElementById"}},"arguments":[{"type":"StringLiteral","start":237,"end":243,"loc":{"start":{"line":12,"column":34},"end":{"line":12,"column":40}},"extra":{"rawValue":"root","raw":"'root'"},"value":"root"}]}]}}],"directives":[]},"comments":[],"tokens":[{"type":{"label":"import","keyword":"import","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"import","start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"React","start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"from","start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}},{"type":{"label":"string","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"react","start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25}}},{"type":{"label":";","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}},{"type":{"label":"import","keyword":"import","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"import","start":27,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}},{"type":{"label":"{","beforeExpr":true,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":34,"end":35,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"render","start":36,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}}},{"type":{"label":"}","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":43,"end":44,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"from","start":45,"end":49,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":22}}},{"type":{"label":"string","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"react-dom","start":50,"end":61,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":34}}},{"type":{"label":";","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":61,"end":62,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":35}}},{"type":{"label":"import","keyword":"import","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"import","start":63,"end":69,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":6}}},{"type":{"label":"{","beforeExpr":true,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":70,"end":71,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"Switch","start":72,"end":78,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":15}}},{"type":{"label":",","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":78,"end":79,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":16}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"Route","start":80,"end":85,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":22}}},{"type":{"label":"}","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":85,"end":86,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":23}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"from","start":87,"end":91,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":28}}},{"type":{"label":"string","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"react-router-dom","start":92,"end":110,"loc":{"start":{"line":3,"column":29},"end":{"line":3,"column":47}}},{"type":{"label":";","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":110,"end":111,"loc":{"start":{"line":3,"column":47},"end":{"line":3,"column":48}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"render","start":114,"end":120,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":6}}},{"type":{"label":"(","beforeExpr":true,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":120,"end":121,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":7}}},{"type":{"label":"jsxTagStart","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":124,"end":125,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3}}},{"type":{"label":"jsxName","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"div","start":125,"end":128,"loc":{"start":{"line":7,"column":3},"end":{"line":7,"column":6}}},{"type":{"label":"jsxTagEnd","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":128,"end":129,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":7}}},{"type":{"label":"jsxText","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"\n ","start":129,"end":134,"loc":{"start":{"line":7,"column":7},"end":{"line":8,"column":4}}},{"type":{"label":"jsxTagStart","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":134,"end":135,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":5}}},{"type":{"label":"jsxName","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"Switch","start":135,"end":141,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":11}}},{"type":{"label":"jsxTagEnd","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":142,"end":143,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":13}}},{"type":{"label":"jsxText","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"\n ","start":143,"end":150,"loc":{"start":{"line":8,"column":13},"end":{"line":9,"column":6}}},{"type":{"label":"jsxTagStart","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":150,"end":151,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":7}}},{"type":{"label":"jsxName","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"Route","start":151,"end":156,"loc":{"start":{"line":9,"column":7},"end":{"line":9,"column":12}}},{"type":{"label":"jsxName","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"component","start":157,"end":166,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":22}}},{"type":{"label":"=","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":true,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"=","start":166,"end":167,"loc":{"start":{"line":9,"column":22},"end":{"line":9,"column":23}}},{"type":{"label":"{","beforeExpr":true,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":167,"end":168,"loc":{"start":{"line":9,"column":23},"end":{"line":9,"column":24}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"App","start":168,"end":171,"loc":{"start":{"line":9,"column":24},"end":{"line":9,"column":27}}},{"type":{"label":"}","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":171,"end":172,"loc":{"start":{"line":9,"column":27},"end":{"line":9,"column":28}}},{"type":{"label":"jsxTagEnd","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":172,"end":173,"loc":{"start":{"line":9,"column":28},"end":{"line":9,"column":29}}},{"type":{"label":"jsxText","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"\n ","start":173,"end":180,"loc":{"start":{"line":9,"column":29},"end":{"line":10,"column":6}}},{"type":{"label":"jsxTagStart","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":180,"end":181,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":7}}},{"type":{"label":"/","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":10,"updateContext":null},"value":"/","start":181,"end":182,"loc":{"start":{"line":10,"column":7},"end":{"line":10,"column":8}}},{"type":{"label":"jsxName","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"Route","start":182,"end":187,"loc":{"start":{"line":10,"column":8},"end":{"line":10,"column":13}}},{"type":{"label":"jsxTagEnd","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":187,"end":188,"loc":{"start":{"line":10,"column":13},"end":{"line":10,"column":14}}},{"type":{"label":"jsxText","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"\n ","start":188,"end":193,"loc":{"start":{"line":10,"column":14},"end":{"line":11,"column":4}}},{"type":{"label":"jsxTagStart","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":193,"end":194,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":5}}},{"type":{"label":"/","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":10,"updateContext":null},"value":"/","start":194,"end":195,"loc":{"start":{"line":11,"column":5},"end":{"line":11,"column":6}}},{"type":{"label":"jsxName","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"Switch","start":195,"end":201,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":12}}},{"type":{"label":"jsxTagEnd","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":201,"end":202,"loc":{"start":{"line":11,"column":12},"end":{"line":11,"column":13}}},{"type":{"label":"jsxText","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"\n ","start":202,"end":205,"loc":{"start":{"line":11,"column":13},"end":{"line":12,"column":2}}},{"type":{"label":"jsxTagStart","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null},"start":205,"end":206,"loc":{"start":{"line":12,"column":2},"end":{"line":12,"column":3}}},{"type":{"label":"/","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":10,"updateContext":null},"value":"/","start":206,"end":207,"loc":{"start":{"line":12,"column":3},"end":{"line":12,"column":4}}},{"type":{"label":"jsxName","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"div","start":207,"end":210,"loc":{"start":{"line":12,"column":4},"end":{"line":12,"column":7}}},{"type":{"label":"jsxTagEnd","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":210,"end":211,"loc":{"start":{"line":12,"column":7},"end":{"line":12,"column":8}}},{"type":{"label":",","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":211,"end":212,"loc":{"start":{"line":12,"column":8},"end":{"line":12,"column":9}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"document","start":213,"end":221,"loc":{"start":{"line":12,"column":10},"end":{"line":12,"column":18}}},{"type":{"label":".","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":221,"end":222,"loc":{"start":{"line":12,"column":18},"end":{"line":12,"column":19}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"getElementById","start":222,"end":236,"loc":{"start":{"line":12,"column":19},"end":{"line":12,"column":33}}},{"type":{"label":"(","beforeExpr":true,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":236,"end":237,"loc":{"start":{"line":12,"column":33},"end":{"line":12,"column":34}}},{"type":{"label":"string","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"root","start":237,"end":243,"loc":{"start":{"line":12,"column":34},"end":{"line":12,"column":40}}},{"type":{"label":")","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":243,"end":244,"loc":{"start":{"line":12,"column":40},"end":{"line":12,"column":41}}},{"type":{"label":")","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":244,"end":245,"loc":{"start":{"line":12,"column":41},"end":{"line":12,"column":42}}},{"type":{"label":";","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":245,"end":246,"loc":{"start":{"line":12,"column":42},"end":{"line":12,"column":43}}},{"type":{"label":"eof","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":247,"end":247,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":0}}}]}
\ No newline at end of file
diff --git a/parser_setup/parser.js b/parser_setup/parser.js
deleted file mode 100644
index 8ad66b3..0000000
--- a/parser_setup/parser.js
+++ /dev/null
@@ -1,155 +0,0 @@
-"use strict";
-var __assign = (this && this.__assign) || function () {
- __assign = Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
- t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
-};
-exports.__esModule = true;
-exports.saplingParse = void 0;
-var parser = require('@babel/parser');
-var path = require('path');
-var fs = require('fs');
-function saplingParse(filePath, componentTree) {
- if (componentTree === void 0) { componentTree = {}; }
- // Edge case - no children or not related to React Components?
- // console.log('RUNNING SAPLING PARSER!!!', filePath);
- // If starting on entry point create component Tree root
- if (!Object.keys(componentTree).length) {
- componentTree = {
- name: path.basename(filePath).replace(/\.(t|j)sx?$/, ''),
- filename: path.basename(filePath),
- filePath: filePath,
- importPath: filePath,
- depth: 0,
- count: 1,
- thirdParty: false,
- reactRouter: false,
- children: [],
- props: {},
- error: ''
- };
- }
- // Parse current file using Babel parser
- // EDGE CASE - WHAT IF filePath does not exist?
- // Check for import type - is it a node module or not?
- if (!['\\', '/', '.'].includes(componentTree.importPath[0])) {
- componentTree.thirdParty = true;
- if (componentTree.filename === 'react-router-dom')
- componentTree.reactRouter = true;
- return;
- }
- // Need additional logic here to check for different extension types
- // if no extension is present -> .js .jsx .ts .tsx
- var ext = path.extname(filePath);
- if (!ext) {
- // Try and find file extension that exists in directory:
- var fileArray = fs.readdirSync(path.dirname(componentTree.filePath));
- var regEx_1 = new RegExp(componentTree.filename + ".(j|t)sx?$");
- var fileName = fileArray.find(function (fileStr) { return fileStr.match(regEx_1); });
- componentTree.filePath += path.extname(fileName);
- filePath = componentTree.filePath;
- }
- var ast;
- try {
- ast = parser.parse(fs.readFileSync(filePath, 'utf-8'), {
- sourceType: 'module',
- tokens: true,
- plugins: [
- 'jsx'
- ]
- });
- }
- catch (err) {
- componentTree.error = 'Error while processing this file/node';
- return componentTree;
- }
- fs.writeFileSync(componentTree.filename + "-parser-output.json", JSON.stringify(ast));
- // Determine if React is imported in file and JSX Children may be present
- function getImports(body) {
- var bodyImports = body.filter(function (item) { return item.type === 'ImportDeclaration'; });
- // EDGE CASE: Object Destructuring Import need to account for this
- return bodyImports.reduce(function (accum, curr) {
- // if object destructuring, need to grab each one
- // e.g. import {Switch as S, Route as R} from ...
- curr.specifiers.forEach(function (i) {
- accum[i.local.name] = {
- importPath: curr.source.value,
- importName: (i.imported) ? i.imported.name : i.local.name
- };
- });
- // accum[curr.specifiers[0].local.name] = curr.source.value;
- return accum;
- }, {});
- }
- // console.log(ast.program.body);
- var imports = getImports(ast.program.body);
- // console.log('IMPORTS ARE: ', imports);
- // Find child components via JSX Elements if React is imported
- function getChildren(astTokens, importsObj, parentNode) {
- // Check if React is imported inside file => JSX Children
- var childNodes = {};
- if (importsObj.React) {
- // Look for JSX elements
- for (var i = 0; i < astTokens.length - 1; i++) {
- // If we have opening JSX tag
- var token = astTokens[i + 1];
- // Check if current JSX component has been imported
- if (astTokens[i].type.label === "jsxTagStart" && token.type.label === 'jsxName' && importsObj[token.value]) {
- var props = getProps(astTokens, i + 2);
- if (childNodes[token.value]) {
- childNodes[token.value].count += 1;
- childNodes[token.value].props = __assign(__assign({}, childNodes[token.value].props), props);
- }
- else {
- // Add tree node to childNodes if one does not exist
- childNodes[token.value] = {
- name: importsObj[token.value]['importName'],
- filename: path.basename(importsObj[token.value]['importPath']),
- filePath: path.resolve(path.dirname(parentNode.filePath), importsObj[token.value]['importPath']),
- importPath: importsObj[token.value]['importPath'],
- depth: parentNode.depth + 1,
- thirdParty: false,
- reactRouter: false,
- count: 1,
- props: props,
- children: [],
- error: ''
- };
- }
- }
- }
- }
- return Object.values(childNodes);
- }
- // Helper functions to get props of React component
- function getProps(tokens, j) {
- // jsx invocations either end in /> or >
- // identify /> by label='/' and > by 'jsxTagEnd'
- var props = {};
- while (tokens[j].type.label !== "jsxTagEnd") {
- if (tokens[j].type.label === "jsxName" && tokens[j + 1].value === "=") {
- props[tokens[j].value] = true;
- }
- j += 1;
- }
- return props;
- }
- componentTree.children = getChildren(ast.tokens, imports, componentTree);
- function parseChildren(childNodeArray) {
- childNodeArray.forEach(function (child) { return saplingParse(child.filePath, child); });
- }
- parseChildren(componentTree.children);
- return componentTree;
-}
-exports.saplingParse = saplingParse;
-;
-var saplingoutput = saplingParse('./__tests__/test_9/index.js');
-// console.log(saplingoutput);
-fs.writeFileSync('sapling-output.json', JSON.stringify(saplingoutput));
-// global attributes: ['accessKey', 'className', 'contentEditable', 'data-*', 'dir', 'draggable', 'hidden', 'id', 'lang', 'key', 'spellCheck', 'style', 'tabIndex', 'title', 'translate']
diff --git a/parser_setup/parser.ts b/parser_setup/parser.ts
deleted file mode 100644
index aeb2c7d..0000000
--- a/parser_setup/parser.ts
+++ /dev/null
@@ -1,174 +0,0 @@
-const parser = require('@babel/parser');
-const path = require('path');
-const fs = require('fs');
-
-// npx tsc --watch parser.ts to watch for changes in this file
-
-// Tree Type is output of parser
-type Tree = {
- name: string,
- filename: string,
- filePath: string,
- importPath: string,
- depth: number,
- count: number,
- thirdParty: boolean,
- reactRouter: boolean,
- children: Tree[],
- props: {[key: string]: boolean},
- error: string;
-};
-
-
-export function saplingParse(filePath : string, componentTree = {} as Tree) {
- // Edge case - no children or not related to React Components?
- // console.log('RUNNING SAPLING PARSER!!!', filePath);
- // If starting on entry point create component Tree root
- if (!Object.keys(componentTree).length) {
- componentTree = {
- name: path.basename(filePath).replace(/\.(t|j)sx?$/, ''),
- filename: path.basename(filePath),
- filePath,
- importPath: filePath,
- depth: 0,
- count: 1,
- thirdParty: false,
- reactRouter: false,
- children: [],
- props: {},
- error: ''
- };
- }
-
- // Parse current file using Babel parser
- // EDGE CASE - WHAT IF filePath does not exist?
-
- // Check for import type - is it a node module or not?
- if (!['\\', '/', '.'].includes(componentTree.importPath[0])) {
- componentTree.thirdParty = true;
- if (componentTree.filename === 'react-router-dom') componentTree.reactRouter = true;
- return;
- }
-
- // Need additional logic here to check for different extension types
- // if no extension is present -> .js .jsx .ts .tsx
-
- const ext = path.extname(filePath);
- if (!ext) {
- // Try and find file extension that exists in directory:
- const fileArray = fs.readdirSync(path.dirname(componentTree.filePath));
- const regEx = new RegExp(`${componentTree.filename}.(j|t)sx?$`);
- const fileName = fileArray.find(fileStr => fileStr.match(regEx));
- componentTree.filePath += path.extname(fileName);
- filePath = componentTree.filePath;
- }
-
- let ast;
- try {
- ast = parser.parse(fs.readFileSync(filePath, 'utf-8'), {
- sourceType: 'module',
- tokens: true,
- plugins: [
- 'jsx'
- ]
- });
- } catch (err) {
- componentTree.error = 'Error while processing this file/node'
- return componentTree;
- }
-
- fs.writeFileSync(`${componentTree.filename}-parser-output.json`, JSON.stringify(ast));
-
- // Determine if React is imported in file and JSX Children may be present
- function getImports(body) {
- const bodyImports = body.filter(item => item.type === 'ImportDeclaration')
- // EDGE CASE: Object Destructuring Import need to account for this
- return bodyImports.reduce((accum, curr) => {
- // if object destructuring, need to grab each one
- // e.g. import {Switch as S, Route as R} from ...
- curr.specifiers.forEach( i => {
- accum[i.local.name] = {
- importPath: curr.source.value,
- importName: (i.imported)? i.imported.name : i.local.name
- }
- });
-
- // accum[curr.specifiers[0].local.name] = curr.source.value;
- return accum;
- }, {});
- }
-
- // console.log(ast.program.body);
- const imports = getImports(ast.program.body);
- // console.log('IMPORTS ARE: ', imports);
-
- // Find child components via JSX Elements if React is imported
- function getChildren(astTokens, importsObj, parentNode) {
- // Check if React is imported inside file => JSX Children
- const childNodes: {[key:string]: Tree} = {};
- if (importsObj.React) {
- // Look for JSX elements
- for (let i = 0; i < astTokens.length - 1; i++) {
- // If we have opening JSX tag
- const token = astTokens[i + 1];
- // Check if current JSX component has been imported
- if (astTokens[i].type.label === "jsxTagStart" && token.type.label === 'jsxName' && importsObj[token.value]) {
-
- const props = getProps(astTokens, i + 2);
-
- if (childNodes[token.value]) {
- childNodes[token.value].count += 1;
- childNodes[token.value].props = {...childNodes[token.value].props, ...props}
- } else {
- // Add tree node to childNodes if one does not exist
- childNodes[token.value] = {
- name: importsObj[token.value]['importName'],
- filename: path.basename(importsObj[token.value]['importPath']),
- filePath: path.resolve(path.dirname(parentNode.filePath), importsObj[token.value]['importPath']),
- importPath: importsObj[token.value]['importPath'],
- depth: parentNode.depth + 1,
- thirdParty: false,
- reactRouter: false,
- count: 1,
- props: props,
- children: [],
- error: '',
- }
- }
- }
- }
- }
- return Object.values(childNodes);
- }
-
- // Helper functions to get props of React component
- function getProps(tokens, j : number) : {[key : string]: boolean} {
- // jsx invocations either end in /> or >
- // identify /> by label='/' and > by 'jsxTagEnd'
- const props = {};
- while (tokens[j].type.label !== "jsxTagEnd") {
- if (tokens[j].type.label === "jsxName" && tokens[j + 1].value === "=") {
- props[tokens[j].value] = true;
- }
- j += 1;
- }
- return props;
- }
-
- componentTree.children = getChildren(ast.tokens, imports, componentTree);
-
- function parseChildren(childNodeArray) {
- childNodeArray.forEach(child => saplingParse(child.filePath, child));
- }
-
- parseChildren(componentTree.children)
-
- return componentTree;
-};
-
-const saplingoutput = saplingParse('./__tests__/test_0/index.js');
-// console.log(saplingoutput);
-
-fs.writeFileSync('sapling-output.json', JSON.stringify(saplingoutput));
-
-// global attributes: ['accessKey', 'className', 'contentEditable', 'data-*', 'dir', 'draggable', 'hidden', 'id', 'lang', 'key', 'spellCheck', 'style', 'tabIndex', 'title', 'translate']
\ No newline at end of file