Skip to content

Commit

Permalink
Merge branch 'main' into instructionsLengthEnvironmentVariable
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak authored Jan 28, 2024
2 parents d364bba + 7ddf207 commit 51f4cb0
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 73 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,8 @@ REACT_APP_DISABLE_TASK_CLUSTERS=''
# Disable User Leaderboard configurations
REACT_APP_DISABLE_USER_LEADERBOARD_CONFIGS=''

#Disable Country Leaderboard Configuration
REACT_APP_DISABLE_COUNTRY_LEADERBOARD_CONFIG=''

# For setting the minimum character count for challenge instructions
REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH=150
32 changes: 24 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,27 @@ The format is based on
This project adheres to
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [v3.14.6] - 2023-1-17
Released with [maproulette-backend_v4.4.13](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.13)

## What's Changed
* Fix task map property list on task markers by @CollinBeczak in (https://github.com/maproulette/maproulette3/pull/2236)

**Full Changelog**: https://github.com/maproulette/maproulette3/compare/v3.14.5...v3.14.6

## [v3.14.5] - 2023-1-14
Released with [maproulette-backend_v4.4.13](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.13)

## What's Changed
* Add environment variable to disable country leaderboard filter selctor by @CollinBeczak in (https://github.com/maproulette/maproulette3/pull/2237)
* fix data drop issue in WithLeaderboard component and restore leaderboards initial data sorted by "All Time" by @CollinBeczak in (https://github.com/maproulette/maproulette3/pull/2235)

**Full Changelog**: https://github.com/maproulette/maproulette3/compare/v3.14.4...v3.14.5

## [v3.14.4] - 2023-1-9
Realease with [maproulette-backend_v4.4.13](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.13)
Released with [maproulette-backend_v4.4.13](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.13)

## What's Changed
* General documentation updates and fixes by @jschwarz2030 in (https://github.com/maproulette/docs/pull/30)
* Add setState to prevent submitting twice before character count is reset by @CollinBeczak in (https://github.com/maproulette/maproulette3/pull/2215)
* Add grouping for challenge comment notifications by @CollinBeczak in (https://github.com/maproulette/maproulette3/pull/2216)
* Remove conflicting validation requirements by @CollinBeczak in (https://github.com/maproulette/maproulette3/pull/2219)
Expand All @@ -25,7 +41,7 @@ Realease with [maproulette-backend_v4.4.13](https://github.com/maproulette/mapro
**Full Changelog**: https://github.com/maproulette/maproulette3/compare/v3.14.3...v3.14.4

## [v3.14.3] - 2023-12-20
Realease with [maproulette-backend_v4.4.12](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.12)
Released with [maproulette-backend_v4.4.12](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.12)

## What's Changed
* move comments to request body for meta review by @CollinBeczak in (https://github.com/maproulette/maproulette3/pull/2209)
Expand All @@ -35,7 +51,7 @@ Realease with [maproulette-backend_v4.4.12](https://github.com/maproulette/mapro
**Full Changelog**: https://github.com/maproulette/maproulette3/compare/v3.14.2...v3.14.3

## [v3.14.2] - 2023-12-12
Realease with [maproulette-backend_v4.4.11](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.11)
Released with [maproulette-backend_v4.4.11](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.11)

## What's Changed
* change default lat/lon default and make the order of lat/lon its own user setting in location widget by @CollinBeczak in https://github.com/maproulette/maproulette3/pull/2172
Expand All @@ -59,7 +75,7 @@ Realease with [maproulette-backend_v4.4.11](https://github.com/maproulette/mapro
**Full Changelog**: https://github.com/maproulette/maproulette3/compare/v3.14.1...v3.14.2

## [v3.14.1] - 2023-11-24
Realease with [maproulette-backend_v4.4.10](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.10)
Released with [maproulette-backend_v4.4.10](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.10)

## What's Changed
* call backend service for system notices by @jschwarz2030 in https://github.com/maproulette/maproulette3/pull/2179
Expand All @@ -68,7 +84,7 @@ Realease with [maproulette-backend_v4.4.10](https://github.com/maproulette/mapro
**Full Changelog**: https://github.com/maproulette/maproulette3/compare/v3.14.0...v3.14.1

## [v3.14.0] - 2023-11-14
Realease with [maproulette-backend_v4.4.9](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.9)
Released with [maproulette-backend_v4.4.9](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.9)

### Features
- Add lasso and virtual challenge creation functionality to challenge dashboard map - @CollinBeczak
Expand Down Expand Up @@ -98,7 +114,7 @@ an empty JSON object when not present. - @ljdelight
- update and migrate transifex config - @jschwarz2030

## [v3.13.2] - 2023-10-17
Realease with [maproulette-backend_v4.4.8](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.8)
Released with [maproulette-backend_v4.4.8](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.8)

### Features
- Add lasso and virtual challenge creation functionality to challenge dashboard map - @CollinBeczak
Expand All @@ -119,7 +135,7 @@ Realease with [maproulette-backend_v4.4.8](https://github.com/maproulette/maprou
- Add Stringified widget layout JSON to challenge table - @CollinBeczak

## [v3.13.1] - 2023-9-12
Realease with [maproulette-backend_v4.4.7](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.7)
Released with [maproulette-backend_v4.4.7](https://github.com/maproulette/maproulette-backend/releases/tag/v4.4.7)

### Features
- Add columns to Review Table - @CollinBeczak
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maproulette3",
"version": "3.14.4",
"version": "3.14.6",
"private": true,
"dependencies": {
"@apollo/client": "^3.5.4",
Expand Down
9 changes: 9 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#23395B">
<meta name="title" content="MapRoulette" />
<meta name="description" content="Be an instant contributor to the world’s maps." />
<meta property="og:image" content="https://openstreetmap.us/img/pages/maproulette/sign.png" />
<meta property="og:type" content="website" />
<meta property="og:title" content="MapRoulette" />
<meta property="og:description" content="Be an instant contributor to the world’s maps." />
<meta property="twitter:title" content="MapRoulette" />
<meta property="twitter:description" content="Be an instant contributor to the world’s maps." />
<meta property="twitter:image" content="https://openstreetmap.us/img/pages/maproulette/sign.png" />
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
Expand Down
1 change: 0 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export const CachedRoute = ({ component: Component, ...rest }) => {
<HeadTitle />
<Component {...props} />
</>

)
}} />
)
Expand Down
1 change: 0 additions & 1 deletion src/components/AdminPane/AdminPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export const CustomRoute = ({ component: Component, ...rest }) => {
<HeadTitle />
<Component {...props} />
</>

)
}} />
)
Expand Down
88 changes: 46 additions & 42 deletions src/components/AutosuggestTextBox/AutosuggestTextBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,64 +95,68 @@ export default class AutosuggestTextBox extends Component {
*/
dropdownItems(getItemProps) {
const isChecked = (result) => {
if (result.id === FILTER_SEARCH_ALL && this.props.multiselect?.includes(FILTER_SEARCH_ALL)) {
return true
const isAllOption = result.id === FILTER_SEARCH_ALL

if (this.props.multiselect) {
const isItemSelected = this.props.multiselect.includes(result.id)
return this.props.multiselect.length === 0 ? isAllOption : isItemSelected
}

if (this.props.multiselect?.includes(result.id)) {
return true
}

return false

return isAllOption
}

const generateResult = (result, className = "", index) => {
if (this.state.highlightResult === index) {
className += this.props.highlightClassName
}

if (!_isEmpty(result)) {
return (
<a
{...getItemProps({
key: this.props.resultKey(result),
item: result,
className: classNames(
className,
(this.props.resultClassName ? this.props.resultClassName(result) : null)
),
})}
>
<div className="mr-flex mr-items-center">
{this.props.multiselect && result.id !== FILTER_SEARCH_TEXT
? <input
type="checkbox"
className="mr-checkbox-toggle mr-mr-2"
id={result.id}
name={result.id}
checked={isChecked(result)}
readOnly
/>
: null
}
{this.props.resultLabel(result)}
</div>
</a>
)
}
else return null

return !_isEmpty(result) ? (
<a
{...getItemProps({
key: this.props.resultKey(result),
item: result,
className: classNames(
className,
this.props.resultClassName ? this.props.resultClassName(result) : null
),
})}
>
<div className="mr-flex mr-items-center">
{this.props.multiselect && result.id !== FILTER_SEARCH_TEXT && (
<input
type="checkbox"
className="mr-checkbox-toggle mr-mr-2"
id={result.id}
name={result.id}
checked={isChecked(result)}
readOnly
/>
)}
{this.props.resultLabel(result)}
</div>
</a>
) : null
}

let items = []
const searchResults = this.getSearchResults()
const preferredResults = this.getPreferredResults()

const reorderedSearchResults = searchResults.sort((a, b) => {
if (a.id === FILTER_SEARCH_ALL) return -1
if (b.id === FILTER_SEARCH_ALL) return 1
if (a.name === this.props.inputValue) return -1
if (b.name === this.props.inputValue) return 1
return isChecked(b) - isChecked(a)
})

if (!_isEmpty(preferredResults)) {
let className = "mr-font-medium"
items = items.concat(_map(preferredResults,
items = items.concat(_map(reorderedSearchResults,
(result, index) => {
// Add a border bottom to the last entry if there are more
// search results.
if (index === preferredResults.length - 1 && searchResults.length > 0) {
if (index === reorderedSearchResults.length - 1 && reorderedSearchResults.length > 0) {
className += " mr-border-b-2 mr-border-white-50 mr-mb-2 mr-pb-2"
}

Expand Down
15 changes: 12 additions & 3 deletions src/components/EnhancedMap/TaskFeatureLayer/TaskFeatureLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import PropertyList from '../PropertyList/PropertyList'
import resolveConfig from 'tailwindcss/resolveConfig'
import tailwindConfig from '../../../tailwind.config.js'
import layerMessages from '../LayerToggle/Messages'
import { IntlProvider } from 'react-intl'

const colors = resolveConfig(tailwindConfig).theme.colors
const HIGHLIGHT_SIMPLESTYLE = {
Expand All @@ -33,7 +34,13 @@ const TaskFeatureLayer = props => {
const propertyList = (featureProperties, onBack) => {
const contentElement = document.createElement('div')
ReactDOM.render(
<PropertyList featureProperties={featureProperties} onBack={onBack} />,
<IntlProvider key={props.intl.locale}
locale={props.intl.locale}
messages={props.intl.messages}
textComponent="span"
>
<PropertyList featureProperties={featureProperties} onBack={onBack} />
</IntlProvider>,
contentElement
)
return contentElement
Expand Down Expand Up @@ -73,8 +80,10 @@ const TaskFeatureLayer = props => {
Object.assign(styleableFeature.markerSimplestyles(layer), HIGHLIGHT_SIMPLESTYLE)
)
popup.on('remove', function() {
// Restore original styling when popup closes
styleableFeature.popLeafletLayerSimpleStyles(layer)
if (layer && layer._leaflet_events) {
// Restore original styling when popup closes
styleableFeature.popLeafletLayerSimpleStyles(layer)
}
})
popup.openOn(map)
})
Expand Down
13 changes: 4 additions & 9 deletions src/components/HOCs/WithLeaderboard/WithLeaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { fetchLeaderboard, fetchLeaderboardForUser, fetchReviewerLeaderboard,
*
* @author [Neil Rotstan](https://github.com/nrotstan)
*/
const WithCurrentLeaderboard = function(WrappedComponent, initialMonthsPast=1, initialOptions={}) {
class WithCurrentLeaderboardClass extends Component {
const WithLeaderboard = function(WrappedComponent, initialMonthsPast=1, initialOptions={}) {
return class extends Component {
state = {
leaderboard: null,
leaderboardLoading: false,
Expand Down Expand Up @@ -226,14 +226,9 @@ const WithCurrentLeaderboard = function(WrappedComponent, initialMonthsPast=1, i
{...this.props} />
}
}
return WithCurrentLeaderboardClass;
}

const mapDispatchToProps = (dispatch) => bindActionCreators({ fetchLeaderboard, fetchLeaderboardForUser, fetchReviewerLeaderboard }, dispatch)


const WithLeaderboard = (WrappedComponent) =>
connect(null, mapDispatchToProps)(WithCurrentLeaderboard(WrappedComponent))

export default WithLeaderboard

export default (WrappedComponent, initialMonthsPast, initialOptions) =>
connect(null, mapDispatchToProps)(WithLeaderboard(WrappedComponent, initialMonthsPast, initialOptions))
5 changes: 4 additions & 1 deletion src/components/Head/Head.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export const formatTitle = (props) => {
return capitalize(param)
}
})
const newTitle = _isEmpty(pathArr) ? REACT_APP_TITLE : REACT_APP_TITLE + ' - ' + pathArr.join(' - ')

pathArr.reverse();

const newTitle = _isEmpty(pathArr) ? REACT_APP_TITLE : pathArr.join(' - ') + ' - ' + REACT_APP_TITLE
return newTitle
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Head/Head.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ describe("formatTitle", () => {
}
}
});
expect(title).toBe(REACT_APP_TITLE + ' - Foo - Bar - Project Name - 3 - User - 2 - 5');
expect(title).toBe('5 - 2 - User - 3 - Project Name - Bar - Foo - ' + REACT_APP_TITLE);
});
});
6 changes: 4 additions & 2 deletions src/components/TaskAnalysisTable/TaskAnalysisTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import _reverse from 'lodash/reverse'
import _keys from 'lodash/keys'
import _concat from 'lodash/concat'
import _filter from 'lodash/filter'
import _cloneDeep from 'lodash/cloneDeep'
import _split from 'lodash/split'
import _isEmpty from 'lodash/isEmpty'
import _merge from 'lodash/merge'
import _pick from 'lodash/pick'
import parse from 'date-fns/parse'
import differenceInSeconds from 'date-fns/difference_in_seconds'
import { messagesByStatus,
Expand Down Expand Up @@ -104,7 +104,9 @@ export class TaskAnalysisTableInternal extends Component {
boundingBox: this.props.boundingBox,
includeTags: !!_get(this.props.addedColumns, 'tags')})

this.setState({lastTableState: _cloneDeep(tableState)})
// Use pick instead of cloneDeep, as cloning the entire tableState seems to cause an error
// when any column with a "makeInvertable" header is present.
this.setState({lastTableState: _pick(tableState, ["sorted", "filtered", "page"])})
}

configureColumns() {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Inbox/HeaderNotifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ class HeaderNotifications extends Component {
<li className="mr-text-white">
<input
type="checkbox"

className="mr-checkbox-toggle mr-mr-1"
checked={this.props.groupByTask}
onChange={this.props.toggleGroupByTask}
/> <FormattedMessage {...messages.groupByTaskLabel} />
</li>
<li className="mr-mb-4">
<li className="mr-mb-4 mr-text-grey-light">
<FormattedMessage {...messages.challengeGroupingNotice} />
</li>
<li>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Leaderboard/Leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Leaderboard extends Component {
customStartDate={this.props.startDate ? new Date(this.props.startDate) : null}
customEndDate={this.props.endDate ? new Date(this.props.endDate) : null}
/>
{!this.props.suppressCountrySelection &&
{!this.props.suppressCountrySelection && !process.env.REACT_APP_DISABLE_COUNTRY_LEADERBOARD_CONFIG &&
<CountrySelector
className="mr-button"
currentCountryCode={this.props.countryCode}
Expand Down
Loading

0 comments on commit 51f4cb0

Please sign in to comment.