Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 1584a18

Browse files
authored
Merge pull request #1050 from appirio-tech/dev
Latest listings and some bug bash updates
2 parents f4e0306 + 0e67f88 commit 1584a18

13 files changed

+74
-18
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ In order to test a logged in user, you must make an entry in your `/etc/hosts` f
2020
- To create the build: `npm run build`
2121
- To run code linting: `npm run lint`
2222
- To run the tests: `npm test`
23+
24+
## Running against Production backend
25+
To run this App against the production backend, you should configure your system in a way that a call to `local.topcoder.com` redirects to `localhost:3000` where the App is running. Then you just `npm run start-prod`, go to `local.topcoder.com` and use your credentials for the production web site (and, sure, be careful with what you are doing, it all will go through the production TopCoder API).
26+
27+
To make the mentioned configuration on Ubuntu 16.04 you:
28+
- Add `127.0.0.1 local.topcoder.com` to your `/etc/hosts`
29+
- `$ sudo apt install libcap2-bin`
30+
- `$ which node` to figure out your `path/to/node`
31+
- `$ sudo setcap cap_net_bind_service=+ep /path/to/node`
32+
- Now run the App.
33+
34+
*Disclaimer: I have no idea, what setcap does here, and how safe it is, but it does the job. Feel free to add your comments / modify this section, if you know more about it. Also, if you know how to make such configuration on other OS, please add it here.*
2335

2436
## Test Users
2537
- general member user accounts:

app/index.jade

+12-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ html
1717
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
1818
})(document);
1919

20+
script.
21+
(function() {
22+
var s = document.createElement("script");
23+
s.type = "text/javascript";
24+
s.async = true;
25+
s.src = '//api.usersnap.com/load/'+
26+
'3e7c8f0c-6cf6-41b6-9f2c-e8e4e60dfc59.js';
27+
var x = document.getElementsByTagName('script')[0];
28+
x.parentNode.insertBefore(s, x);
29+
})();
30+
2031
include ../assets/scripts/google.analytics.jade
2132
include ../assets/scripts/zendesk-widget.jade
2233
include ../assets/scripts/raven-js.jade
@@ -38,4 +49,4 @@ html
3849

3950
div(ui-view="footer")
4051

41-
#chart-tooltip
52+
#chart-tooltip

app/listings/listings.controller.js

+24-8
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import { loadUser } from '../services/userv3.service.js'
77

88
angular.module('tc.listings').controller('ListingsCtrl', ListingsCtrl)
99

10-
ListingsCtrl.$inject = ['CONSTANTS', 'logger', '$q','TcAuthService', 'UserService',
11-
'UserStatsService', 'ProfileService', 'ChallengeService',
12-
'ExternalAccountService', 'ngDialog', '$anchorScroll', '$scope'
10+
ListingsCtrl.$inject = ['$location', '$scope', 'CONSTANTS', 'logger', '$q',
11+
'TcAuthService', 'UserService', 'UserStatsService', 'ProfileService', 'ChallengeService', 'ExternalAccountService',
12+
'ngDialog', '$anchorScroll'
1313
]
14-
15-
function ListingsCtrl(CONSTANTS, logger, $q, TcAuthService, UserService, UserStatsService, ProfileService,
16-
ChallengeService, ExternalAccountService, ngDialog, $anchorScroll, $scope) {
14+
15+
function ListingsCtrl($location, $scope, CONSTANTS, logger, $q, TcAuthService,
16+
UserService, UserStatsService,ProfileService, ChallengeService, ExternalAccountService, ngDialog, $anchorScroll) {
1717
var vm = this
1818
var handle
1919
vm.neverParticipated = false
@@ -25,7 +25,15 @@ import { loadUser } from '../services/userv3.service.js'
2525

2626
function activate() {
2727
$scope.myChallenges = []
28-
$scope.userProps = { isAuth: false, myChallenges: [] }
28+
$scope.reactProps = {
29+
config: CONSTANTS,
30+
filterFromUrl: $location.hash(),
31+
isAuth: false,
32+
myChallenges: [],
33+
onSaveFilterToUrl: function(filter) {
34+
$location.hash(filter)
35+
}
36+
}
2937
logger.debug('Calling ListingsController activate()')
3038
vm.myChallenges = []
3139
loadUser().then(function(token) {
@@ -75,7 +83,15 @@ import { loadUser } from '../services/userv3.service.js'
7583
vm.myChallenges = userChallenges.reverse().slice(0, 8)
7684

7785
// update myChallenges
78-
$scope.userProps = { isAuth: true, myChallenges: vm.myChallenges }
86+
$scope.reactProps = {
87+
config: CONSTANTS,
88+
filterFromUrl: $location.hash(),
89+
isAuth: true,
90+
myChallenges: vm.myChallenges,
91+
onSaveFilterToUrl: function(filter) {
92+
$location.hash(filter)
93+
}
94+
}
7995

8096
vm.userHasChallenges = true
8197
vm.loading = false

app/listings/listings.jade

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
2-
<react-component name="ChallengeFiltersExample" props="userProps" watch-depth="reference"/>
1+
react-component.listings(name="ChallengeFiltersExample" props="reactProps" watch-depth="reference")

app/listings/listings.routes.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import angular from 'angular'
2121
'listings': {
2222
parent: 'root',
2323
url: '/listings/',
24-
template: require('./listings')(),
25-
controller: 'ListingsCtrl as vm',
2624
resolve: {
2725
userHandle: ['$stateParams', function($stateParams) {
2826
return $stateParams.userHandle
@@ -31,6 +29,12 @@ import angular from 'angular'
3129
data: {
3230
authRequired: false,
3331
title: 'Listings'
32+
},
33+
views: {
34+
'container@': {
35+
controller: 'ListingsCtrl as vm',
36+
template: require('./listings')()
37+
}
3438
}
3539
}
3640
}

app/my-dashboard/my-dashboard.jade

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@
2424
.programs(id="community", ui-view="programs")
2525

2626
.community-updates(ui-view="community-updates")
27+

app/services/blog.service.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import X2JS from 'xml2js'
1919

2020
// fetch blog rss feed
2121
$http.get(CONSTANTS.BLOG_LOCATION)
22-
.then(function(data) {
22+
.then(function(response) {
23+
var data = response.data
2324
// parse the blog rss feed using x2js
2425
var parseString = X2JS.parseString
2526
parseString(data.trim(), function (err, res) {

app/services/jwtInterceptor.service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { isTokenExpired, getFreshToken } from 'tc-accounts'
3838

3939
function getToken(config) {
4040
// skip token for .html
41-
if (config.url.indexOf('.html') > -1)
41+
if (config.url.indexOf('.html') > -1 || config.url === CONSTANTS.BLOG_LOCATION)
4242
return null
4343

4444
var haveItAddItEndpoints = [

assets/css/directives/challenge-tile.scss

+7
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ challenge-tile .challenge.tile-view {
111111
flex-direction: column;
112112
align-items: center;
113113
justify-content: center;
114+
padding: 12px 0;
114115
flex: 2;
115116
}
116117

@@ -280,6 +281,12 @@ challenge-tile .challenge.tile-view {
280281
}
281282

282283

284+
@media only screen and (max-width: 768px) {
285+
.active-challenge {
286+
height: auto;
287+
margin: auto;
288+
}
289+
}
283290
.completed-challenge {
284291
height: 390px;
285292
display: flex;

assets/css/layout/footer.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ footer {
88
.bottom-footer {
99
background-color: $gray-darkest;
1010
padding: 1px 20px 30px 20px;
11+
margin-bottom: -20px;
1112
}
1213

1314
.bottom-footer .menu-item .menu-link {
@@ -125,7 +126,7 @@ footer {
125126
// removed fold-pusher from the rule to remove white space
126127
.bottom-footer, .fold-pusher {
127128
// .bottom-footer {
128-
height: 200px;
129+
height: auto;
129130
}
130131
.bottom-footer {
131132
padding-top: 40px;

assets/css/layout/header.scss

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
}
184184

185185
.user-menu {
186+
max-height: 54px;
186187
.user-avatar {
187188
height: 31px;
188189
width: 31px;

assets/css/my-dashboard/my-challenges.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@
131131
}
132132

133133
.challenges {
134-
@include horizontal-scroll;
134+
display: flex;
135+
flex-direction: column;
136+
justify-content: center;
137+
margin-left: 0;
135138

136139
&.tile-view, &.list-view {
137140
@media only screen and (min-width: 768px) {
@@ -168,7 +171,6 @@
168171
margin-bottom: 15px;
169172
@media only screen and (max-width: 767px) {
170173
display: inline-block;
171-
margin-left: 15px;
172174

173175
&:first-child {
174176
margin-left: 0;

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"scripts": {
55
"build": "webpack --bail --progress --build --tc",
66
"start": "webpack-dev-server --history-api-fallback --host 0.0.0.0 --dev --tc --inline --progress --port 3000",
7+
"start-prod": "webpack-dev-server --history-api-fallback --host local.topcoder.com --prod --tc --inline --progress --port 80",
78
"lint": "eslint .",
89
"test": "karma start --tc --test"
910
},

0 commit comments

Comments
 (0)