From 8570d7f296db9096445217fca7c3e48b0062d948 Mon Sep 17 00:00:00 2001 From: dpaun Date: Thu, 8 Mar 2018 11:58:47 +0100 Subject: [PATCH] SWIK-1958 added a service and a store --- actions/user/userprofile/chooseAction.js | 17 ++++++++++++++--- app.js | 6 ++++-- components/User/UserProfile/CategoryBox.js | 2 +- components/User/UserProfile/UserProfile.js | 21 +++++++++++++++++++++ server.js | 1 + 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/actions/user/userprofile/chooseAction.js b/actions/user/userprofile/chooseAction.js index 0787b9853..38e774354 100644 --- a/actions/user/userprofile/chooseAction.js +++ b/actions/user/userprofile/chooseAction.js @@ -3,14 +3,17 @@ import fetchUser from './fetchUser'; import { fetchUserDecks } from './fetchUserDecks'; import notFoundError from '../../error/notFoundError'; const log = require('../../log/clog'); -import loadUserCollections from '../../collections/loadUserCollections'; +import loadUserCollections from '../../collections/loadUserCollections'; +// import loadUserRecommendations from '../../recommendations/loadUserRecommendations'; +import loadUserPerformancePredictions from '../../analytics/loadUserPerformancePredictions'; import { shortTitle } from '../../../configs/general'; import UserProfileStore from '../../../stores/UserProfileStore'; export const categories = { //Do NOT alter the order of these items! Just add your items. Used in UserProfile and CategoryBox components - categories: ['settings', 'groups', 'collections'], + categories: ['settings', 'groups', 'collections', 'recommendations', 'analytics'], settings: ['profile', 'account', 'integrations'], - groups: ['overview', 'edit'] + groups: ['overview', 'edit'], + analytics: ['performanceprediction'] }; export function chooseAction(context, payload, done) { @@ -71,6 +74,14 @@ export function chooseAction(context, payload, done) { context.dispatch('USER_CATEGORY', {category: payload.params.category, item: payload.params.item}); context.executeAction(loadUserCollections, {}, callback); break; + case categories.categories[3]: + context.dispatch('USER_CATEGORY', {category: payload.params.category, item: payload.params.item}); + context.executeAction(loadUserRecommendations, {}, callback); + break; + case categories.categories[4]: + context.dispatch('USER_CATEGORY', {category: payload.params.category, item: payload.params.item}); + context.executeAction(loadUserPerformancePredictions, {}, callback); + break; case undefined: context.executeAction(fetchUserDecks, {params: {username: payload.params.username}}, callback); break; diff --git a/app.js b/app.js index c64eb00fc..5390665db 100644 --- a/app.js +++ b/app.js @@ -47,6 +47,7 @@ import MediaStore from './stores/MediaStore'; import UserReviewStore from './stores/UserReviewStore'; import DeckCollectionStore from './stores/DeckCollectionStore'; import SSOStore from './stores/SSOStore'; +import UserPerformancePredictionsStore from './stores/UserPerformancePredictionsStore'; // create new fluxible instance & register all stores const app = new Fluxible({ @@ -94,9 +95,10 @@ const app = new Fluxible({ ContentLikeStore, DeckFamilyStore, UserReviewStore, - MediaStore, + MediaStore, DeckCollectionStore, - SSOStore + SSOStore, + UserPerformancePredictionsStore ] }); diff --git a/components/User/UserProfile/CategoryBox.js b/components/User/UserProfile/CategoryBox.js index 234c26ec6..d602c482c 100644 --- a/components/User/UserProfile/CategoryBox.js +++ b/components/User/UserProfile/CategoryBox.js @@ -82,7 +82,7 @@ class CategoryBox extends React.Component {

- + {switch(this.props.UserProfileStore.categoryItem){ + case categories.analytics[0]: + return this.displayPerformancePredictions(); + break; + default: + return this.notImplemented(); + }}); default: return this.displayUserProfile(); }; @@ -221,6 +230,18 @@ class UserProfile extends React.Component { return (); } + + + + + + + displayPerformancePredictions() { + return ( + + ); + } + notImplemented() { return (