Skip to content

Commit 7b27738

Browse files
authored
Merge pull request #617 from osmlab/develop
v3.1.3 release preparation
2 parents f1040d1 + fbf5d90 commit 7b27738

File tree

79 files changed

+13041
-678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+13041
-678
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"react-dropzone": "^4.2.3",
4242
"react-grid-layout": "^0.16.6",
4343
"react-intl": "^2.3.0",
44+
"react-intl-formatted-duration": "^3.0.0",
4445
"react-jsonschema-form": "1.0.3",
4546
"react-jsonschema-form-async": "^0.2.0",
4647
"react-leaflet": "^1.8.0",

src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import UserProfile from './components/UserProfile/UserProfile'
2222
import Leaderboard from './components/Leaderboard/Leaderboard'
2323
import ChallengeLeaderboard from './components/ChallengeLeaderboard/ChallengeLeaderboard'
2424
import ProjectLeaderboard from './components/ProjectLeaderboard/ProjectLeaderboard'
25+
import CountryLeaderboard from './components/CountryLeaderboard/CountryLeaderboard'
2526
import ErrorModal from './components/ErrorModal/ErrorModal'
2627
import Sprites from './components/Sprites/Sprites'
2728
import MobileNotSupported
@@ -89,6 +90,7 @@ export class App extends Component {
8990
<CachedRoute path='/leaderboard' component={Leaderboard} />
9091
<CachedRoute path='/challenge/:challengeId/leaderboard' component={ChallengeLeaderboard} />
9192
<CachedRoute path='/project/:projectId/leaderboard' component={ProjectLeaderboard} />
93+
<CachedRoute path='/country/:countryCode/leaderboard' component={CountryLeaderboard} />
9294
<CachedRoute path='/admin' component={AdminPane} />
9395
<CachedRoute path='/error' component={ErrorPane} />
9496
<Route component={PageNotFound} />

src/components/AdminPane/Manage/ChallengeDashboard/ChallengeDashboard.scss

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
@import 'mixins.scss';
22

33
.admin__manage.challenge-dashboard {
4-
.admin__manage__primary-content {
5-
padding-top: 0;
6-
7-
.challenge-tasks-status {
4+
.challenge-tasks-status {
5+
&__building-header {
86
display: flex;
9-
flex-direction: column;
10-
justify-content: flex-start;
7+
justify-content: space-between;
118
align-items: center;
9+
margin-bottom: 20px;
10+
}
1211

13-
h3 {
14-
font-size: $size-3;
15-
margin-bottom: 20px;
12+
h3 {
13+
font-size: $size-3;
14+
color: $primary;
1615

17-
&.is-danger {
18-
color: $coral;
19-
}
16+
&.is-danger {
17+
color: $coral;
2018
}
19+
}
2120

22-
&__status-message {
23-
font-size: $size-6;
24-
white-space: pre-wrap;
25-
max-width: 100%;
26-
border-radius: $radius-medium;
27-
}
21+
&__status-message {
22+
font-size: $size-6;
23+
white-space: pre-wrap;
24+
max-width: 100%;
25+
border-radius: $radius-medium;
26+
}
27+
28+
&__build-status {
29+
font-size: $size-5;
2830
}
2931
}
3032

src/components/AdminPane/Manage/ManageChallenges/EditChallenge/Step1Schema.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ export const uiSchema = (intl, user, challengeData) => {
153153
description: {
154154
"ui:field": "markdown",
155155
},
156+
blurb: {
157+
"ui:emptyValue": "",
158+
},
156159
instruction: {
157160
"ui:field": "markdown",
158161
},
@@ -165,6 +168,9 @@ export const uiSchema = (intl, user, challengeData) => {
165168
additionalKeywords: {
166169
"ui:field": "tags",
167170
},
171+
checkinComment: {
172+
"ui:emptyValue": "",
173+
},
168174
includeCheckinHashtag: {
169175
"ui:widget": "radio",
170176
},

src/components/AdminPane/Manage/ViewChallengeTasks/Messages.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ export default defineMessages({
2121

2222
tasksCreatedCount: {
2323
id: "Admin.Challenge.tasksCreatedCount",
24-
defaultMessage: "{count, number} tasks created",
24+
defaultMessage: "{count, number} tasks created so far",
2525
},
2626

27-
asOf: {
28-
id: "Admin.Challenge.status.asOf.label",
29-
defaultMessage: "as of",
27+
totalElapsedTime: {
28+
id: "Admin.Challenge.totalCreationTime",
29+
defaultMessage: "Total elapsed time:",
3030
},
3131

3232
refreshStatusLabel: {
3333
id: "Admin.Challenge.controls.refreshStatus.label",
34-
defaultMessage: "Refresh Status",
34+
defaultMessage: "Refreshing status in",
3535
},
3636

3737
tasksHeader: {

src/components/AdminPane/Manage/ViewChallengeTasks/TaskBuildProgress.js

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react'
2-
import { FormattedMessage,
3-
FormattedRelative } from 'react-intl'
2+
import { FormattedMessage } from 'react-intl'
3+
import FormattedDuration, { TIMER_FORMAT } from 'react-intl-formatted-duration'
4+
import parse from 'date-fns/parse'
45
import _get from 'lodash/get'
56
import { ChallengeStatus }
67
from '../../../../services/Challenge/ChallengeStatus/ChallengeStatus'
@@ -18,17 +19,42 @@ const TIMER_INTERVAL = 10000 // 10 seconds
1819
export default class TaskBuildProgress extends Component {
1920
timerHandle = null
2021

22+
state = {
23+
startTime: new Date(),
24+
}
25+
2126
clearTimer = () => {
2227
if (this.timerHandle !== null) {
2328
clearInterval(this.timerHandle)
2429
this.timerHandle = null
2530
}
2631
}
2732

33+
/**
34+
* Returns the total elapsed seconds since the start time (usually the challenge
35+
* modification date)
36+
*/
37+
totalElapsedSeconds = () => {
38+
return (Date.now() - this.state.startTime) / 1000
39+
}
40+
41+
/**
42+
* Returns the number of seconds until the next status update
43+
*/
44+
nextUpdateSeconds = () => {
45+
return (
46+
new Date(this.props.challenge._meta.fetchedAt + TIMER_INTERVAL).getTime() - Date.now()
47+
) / 1000
48+
}
49+
2850
componentDidMount() {
2951
this.clearTimer()
3052
this.timerHandle =
3153
setInterval(this.props.refreshChallenge, TIMER_INTERVAL)
54+
55+
if (this.props.challenge.modified) {
56+
this.setState({startTime: parse(this.props.challenge.modified)})
57+
}
3258
}
3359

3460
componentWillUnmount() {
@@ -43,21 +69,37 @@ export default class TaskBuildProgress extends Component {
4369
return (
4470
<div>
4571
<div className="challenge-tasks-status">
46-
<h3><FormattedMessage {...messages.tasksBuilding} /></h3>
47-
48-
<div className="since-when">
49-
<FormattedMessage {...messages.tasksCreatedCount}
50-
values={{count: _get(this.props.challenge,
51-
'actions.total', 0)}}
52-
/> <FormattedMessage {...messages.asOf}
53-
/> <FormattedRelative
54-
value={new Date(this.props.challenge._meta.fetchedAt)}
55-
updateInterval={1000} />
72+
<div className="challenge-tasks-status__building-header">
73+
<h3>
74+
<FormattedMessage
75+
{...messages.tasksBuilding}
76+
/> <BusySpinner className="inline" />
77+
</h3>
5678

57-
<div className="pane-loading">
58-
<BusySpinner />
79+
<div>
80+
<FormattedMessage
81+
{...messages.totalElapsedTime}
82+
/> <FormattedDuration seconds={this.totalElapsedSeconds()} format={TIMER_FORMAT} />
5983
</div>
6084
</div>
85+
86+
<div className="challenge-tasks-status__build-status">
87+
<p>
88+
<FormattedMessage
89+
{...messages.tasksCreatedCount}
90+
values={{count: _get(this.props.challenge, 'actions.total', 0)}}
91+
/>
92+
</p>
93+
94+
<p>
95+
<FormattedMessage
96+
{...messages.refreshStatusLabel}
97+
/> <FormattedDuration
98+
seconds={this.nextUpdateSeconds()}
99+
format={TIMER_FORMAT}
100+
/>
101+
</p>
102+
</div>
61103
</div>
62104
</div>
63105
)

src/components/AdminPane/Manage/ViewChallengeTasks/ViewChallengeTasks.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import TriStateCheckbox from '../../../Bulma/TriStateCheckbox'
2727
import ConfirmAction from '../../../ConfirmAction/ConfirmAction'
2828
import SvgSymbol from '../../../SvgSymbol/SvgSymbol'
2929
import BusySpinner from '../../../BusySpinner/BusySpinner'
30+
import IntervalRender from '../../../IntervalRender/IntervalRender'
3031
import WithDeactivateOnOutsideClick
3132
from '../../../HOCs/WithDeactivateOnOutsideClick/WithDeactivateOnOutsideClick'
3233
import ChallengeTaskMap from '../ChallengeTaskMap/ChallengeTaskMap'
@@ -99,7 +100,7 @@ export class ViewChallengeTasks extends Component {
99100

100101
render() {
101102
if (this.props.challenge.status === ChallengeStatus.building) {
102-
return <TaskBuildProgress {...this.props} />
103+
return <IntervalRender><TaskBuildProgress {...this.props} /></IntervalRender>
103104
}
104105

105106
if (this.props.challenge.status === ChallengeStatus.failed) {

src/components/ChallengePane/ChallengeFilterSubnav/__snapshots__/ChallengeFilterSubnav.test.js.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ ShallowWrapper {
228228
}
229229
/>
230230
</MediaQuery>
231-
<Component
231+
<Connect(Component)
232232
challenges={
233233
Array [
234234
Object {
@@ -448,7 +448,7 @@ ShallowWrapper {
448448
}
449449
/>
450450
</MediaQuery>
451-
<Component
451+
<Connect(Component)
452452
challenges={
453453
Array [
454454
Object {
@@ -665,7 +665,7 @@ ShallowWrapper {
665665
}
666666
/>
667667
</MediaQuery>,
668-
<Component
668+
<Connect(Component)
669669
challenges={
670670
Array [
671671
Object {
@@ -1286,7 +1286,7 @@ ShallowWrapper {
12861286
}
12871287
/>
12881288
</MediaQuery>
1289-
<Component
1289+
<Connect(Component)
12901290
challenges={
12911291
Array [
12921292
Object {
@@ -1506,7 +1506,7 @@ ShallowWrapper {
15061506
}
15071507
/>
15081508
</MediaQuery>
1509-
<Component
1509+
<Connect(Component)
15101510
challenges={
15111511
Array [
15121512
Object {
@@ -1723,7 +1723,7 @@ ShallowWrapper {
17231723
}
17241724
/>
17251725
</MediaQuery>,
1726-
<Component
1726+
<Connect(Component)
17271727
challenges={
17281728
Array [
17291729
Object {

src/components/ChallengePane/ChallengeResultList/ChallengeResultList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import WithSortedChallenges from '../../HOCs/WithSortedChallenges/WithSortedChal
1212
import WithPagedChallenges from '../../HOCs/WithPagedChallenges/WithPagedChallenges'
1313
import ChallengeResultItem from '../ChallengeResultItem/ChallengeResultItem'
1414
import SortChallengesSelector from './SortChallengesSelector'
15-
import LoadMoreButton from './LoadMoreButton'
15+
import PageResultsButton from './PageResultsButton'
1616
import SvgSymbol from '../../SvgSymbol/SvgSymbol'
1717
import BusySpinner from '../../BusySpinner/BusySpinner'
1818
import StartVirtualChallenge from './StartVirtualChallenge'
@@ -123,7 +123,7 @@ export class ChallengeResultList extends Component {
123123
{results}
124124

125125
<div className="after-results">
126-
<LoadMoreButton {...this.props} />
126+
<PageResultsButton {...this.props} />
127127
</div>
128128
</div>
129129
)

src/components/ChallengePane/ChallengeResultList/LoadMoreButton.scss

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)