diff --git a/src/actions/projects.js b/src/actions/projects.js
index dfc6bf9b..89b1f6b5 100644
--- a/src/actions/projects.js
+++ b/src/actions/projects.js
@@ -52,7 +52,7 @@ function _loadProjects (projectNameOrIdFilter = '', paramFilters = {}) {
if (!isNaN(projectNameOrIdFilter)) { // if it is number
filters['id'] = parseInt(projectNameOrIdFilter, 10)
} else { // text search
- filters['keyword'] = decodeURIComponent(projectNameOrIdFilter)
+ filters['keyword'] = `"${decodeURIComponent(projectNameOrIdFilter)}"`
}
}
diff --git a/src/actions/users.js b/src/actions/users.js
index 31a65ab2..d1c51ec4 100644
--- a/src/actions/users.js
+++ b/src/actions/users.js
@@ -82,7 +82,7 @@ export function searchUserProjects (isAdmin = true, keyword) {
sort: 'updatedAt desc',
perPage: 20,
page: 1,
- keyword
+ keyword: `"${keyword}"`
}
if (!isAdmin) {
filters['memberOnly'] = true
diff --git a/src/components/Buttons/OutlineButton/index.js b/src/components/Buttons/OutlineButton/index.js
index 9d5f6914..5bc8140e 100644
--- a/src/components/Buttons/OutlineButton/index.js
+++ b/src/components/Buttons/OutlineButton/index.js
@@ -22,7 +22,7 @@ const OutlineButton = ({ type, text, link, onClick, url, className, submit, disa
if (!_.isEmpty(link)) {
return (
-
+
{text}
)
@@ -38,7 +38,7 @@ const OutlineButton = ({ type, text, link, onClick, url, className, submit, disa
OutlineButton.propTypes = {
type: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
- link: PropTypes.string,
+ link: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
url: PropTypes.string,
className: PropTypes.string,
onClick: PropTypes.func,
diff --git a/src/components/ChallengesComponent/index.js b/src/components/ChallengesComponent/index.js
index b9181c20..af5a36ea 100644
--- a/src/components/ChallengesComponent/index.js
+++ b/src/components/ChallengesComponent/index.js
@@ -91,6 +91,16 @@ const ChallengesComponent = ({
{activeProject && activeProject.id && !isReadOnly ? (
+
{isAdminOrCopilot && (
* {
- width: 125px;
+ width: max-content;
}
}
diff --git a/src/components/Users/index.js b/src/components/Users/index.js
index cfbe5671..2164338b 100644
--- a/src/components/Users/index.js
+++ b/src/components/Users/index.js
@@ -44,6 +44,14 @@ class Users extends Component {
this.debouncedOnInputChange = _.debounce(this.onInputChange, AUTOCOMPLETE_DEBOUNCE_TIME_MS)
}
+ componentDidMount () {
+ if (this.props.initialProject && this.props.initialProject.id) {
+ this.setProjectOption({
+ value: this.props.initialProject.id,
+ label: this.props.initialProject.name
+ })
+ }
+ }
setProjectOption (projectOption) {
this.setState({ projectOption })
@@ -165,7 +173,8 @@ class Users extends Component {
isLoadingProject
} = this.props
const {
- searchKey
+ searchKey,
+ projectOption
} = this.state
const projectOptions = ((searchKey ? resultSearchUserProjects : projects) || []).map(p => {
return {
@@ -204,20 +213,28 @@ class Users extends Component {
- {
- showAddUser && (
-
-
this.onAddUserClick()} />
- this.onInviteUserClick()} />
-
- )
- }
+
+ {
+ showAddUser && (
+ <>
+
this.onAddUserClick()} />
+ this.onInviteUserClick()} />
+ >
+ )
+ }
+ {projectOption && (
+
+ )}
+
{
this.state.showAddUserModal && (
`https://${FILE_PICKER_CONTAINER_NAME}.s3.amazonaws.com/${key}`
diff --git a/src/containers/Projects/styles.module.scss b/src/containers/Projects/styles.module.scss
index ef18461d..3fdceafb 100644
--- a/src/containers/Projects/styles.module.scss
+++ b/src/containers/Projects/styles.module.scss
@@ -51,6 +51,10 @@
border-radius: 3px;
border: 1px solid $light-gray;
background-color: $lighter-gray;
+
+ > div {
+ width: 100%;
+ }
}
.tcCheckbox {
diff --git a/src/containers/Users/index.js b/src/containers/Users/index.js
index ab6b39f6..6f1cef67 100644
--- a/src/containers/Users/index.js
+++ b/src/containers/Users/index.js
@@ -2,6 +2,7 @@ import React, { Component } from 'react'
import { connect } from 'react-redux'
import _ from 'lodash'
import PT from 'prop-types'
+import { withRouter } from 'react-router-dom'
import UsersComponent from '../../components/Users'
import { PROJECT_ROLES } from '../../config/constants'
import { fetchInviteMembers, fetchProjectById } from '../../services/projects'
@@ -22,7 +23,11 @@ class Users extends Component {
projectMembers: null,
invitedMembers: null,
isAdmin: false,
- isLoadingProject: false
+ isLoadingProject: false,
+ project: props.location.state && props.location.state.projectId ? {
+ id: props.location.state && props.location.state.projectId,
+ name: props.location.state && props.location.state.projectName
+ } : null
}
this.loadProject = this.loadProject.bind(this)
this.updateProjectMember = this.updateProjectMember.bind(this)
@@ -33,7 +38,7 @@ class Users extends Component {
}
componentDidMount () {
- const { token, isLoading, loadAllUserProjects, page } = this.props
+ const { token, isLoading, loadAllUserProjects, page, location } = this.props
if (!isLoading) {
const isAdmin = checkAdmin(token)
const isManager = checkManager(token)
@@ -44,6 +49,10 @@ class Users extends Component {
this.setState({
isAdmin
})
+
+ if (location.state && location.state.projectId) {
+ this.loadProject(location.state.projectId)
+ }
}
}
@@ -157,6 +166,7 @@ class Users extends Component {
isSearchingUserProjects
} = this.props
const {
+ project,
projectMembers,
invitedMembers,
isAdmin,
@@ -164,6 +174,7 @@ class Users extends Component {
} = this.state
return (
{
}
Users.propTypes = {
+ location: PT.object.isRequired,
projects: PT.arrayOf(PT.object),
resultSearchUserProjects: PT.arrayOf(PT.object),
auth: PT.object,
@@ -220,4 +232,4 @@ const mapDispatchToProps = {
loadNextProjects
}
-export default connect(mapStateToProps, mapDispatchToProps)(Users)
+export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Users))