Skip to content

Commit 3b7c9b2

Browse files
author
Parth Shah
committed
Merge branch 'dev'
2 parents 4163e9d + fe691bb commit 3b7c9b2

30 files changed

+183
-101
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"react-s-alert": "^1.1.4",
5858
"react-scroll": "^1.2.0",
5959
"react-stickynode": "^1.2.1",
60+
"react-text-truncate": "^0.8.3",
6061
"recompose": "^0.20.2",
6162
"redux": "^3.5.2",
6263
"redux-promise-middleware": "^4.0.0",

src/components/App/App.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ body {
66
}
77

88
.ReactModal__Body--open {
9-
overflow: hidden;
9+
overflow: hidden;
1010
}
11+
12+
.ReactModal__Content--after-open {
13+
outline: none;
14+
}

src/components/FileList/AddFiles.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ const AddFiles = props => {
1414
buttonText: 'Add File',
1515
buttonClass: 'tc-btn tc-btn-secondary tc-btn-sm',
1616
dragText: 'Drag and drop your files here',
17-
// dragClass: '',
1817
language: 'en',
19-
storeLocation: 's3',
18+
location: 's3',
2019
storeContainer: FILE_PICKER_SUBMISSION_CONTAINER_NAME,
21-
storePath,
20+
path: storePath,
2221
multiple: 'true',
23-
services: 'COMPUTER,GOOGLE_DRIVE,BOX,DROPBOX,SKYDRIVE'
22+
services: ['COMPUTER', 'GOOGLE_DRIVE', 'BOX', 'DROPBOX', 'SKYDRIVE']
2423
}
2524

2625
return (

src/components/FileList/AddFiles.scss

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@
22

33
.add-file {
44
position: relative;
5-
& div div {
6-
@include roboto-medium;
7-
display: block !important;
8-
width: 100%;
9-
height: 130px;
10-
padding: $base-unit*4 !important;
11-
margin: 0 !important;
12-
background: $tc-gray-neutral-light;
13-
font-size: 15px !important;
14-
color: $tc-gray-80 !important;
15-
text-align: center;
16-
}
175

186
.tc-btn {
197
position: absolute;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React, {PropTypes} from 'react'
2+
3+
const FileDeletionConfirmModal = ({ fileName, onCancel, onConfirm}) => {
4+
return (
5+
<div className="modal delete-file-modal">
6+
<div className="modal-title danger">
7+
You're about to delete the file '{fileName}'
8+
</div>
9+
<div className="modal-body">
10+
<p className="message">
11+
Are you sure you want to delete this file? You will not be able to undo this action.
12+
</p>
13+
14+
<div className="button-area flex center">
15+
<button className="tc-btn tc-btn-default tc-btn-sm btn-cancel" onClick={onCancel}>Cancel</button>
16+
<button className="tc-btn tc-btn-warning tc-btn-sm" onClick={onConfirm}>Delete File</button>
17+
</div>
18+
</div>
19+
</div>
20+
)
21+
}
22+
23+
FileDeletionConfirmModal.propTypes = {
24+
onCancel: PropTypes.func.isRequired,
25+
onConfirm: PropTypes.func.isRequired
26+
}
27+
28+
export default FileDeletionConfirmModal
Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,42 @@
11
import React, {PropTypes} from 'react'
2+
import Panel from '../Panel/Panel'
23
import FileListItem from './FileListItem'
4+
import cn from 'classnames'
5+
import uncontrollable from 'uncontrollable'
6+
import FileDeletionConfirmModal from './FileDeletionConfirmModal'
37
import './FileList.scss'
48

5-
const FileList = ({children}) => (
6-
<div className="file-list">
7-
{children}
8-
</div>
9+
const FileList = ({files, onDelete, onSave, deletingFile, onDeleteIntent}) => (
10+
<Panel className={cn('file-list', {'modal-active': deletingFile})}>
11+
{deletingFile && <div className="modal-overlay" />}
12+
{
13+
files.map((file, i) => {
14+
const _onConfirmDelete = () => {
15+
onDelete(file.id)
16+
onDeleteIntent(null)
17+
}
18+
const _onFileDeleteCancel = () => onDeleteIntent(null)
19+
if (deletingFile === file.id) {
20+
return (
21+
<FileDeletionConfirmModal
22+
key={i}
23+
fileName={ file.title }
24+
onConfirm={ _onConfirmDelete }
25+
onCancel={ _onFileDeleteCancel }
26+
/>
27+
)
28+
}
29+
return (
30+
<FileList.Item
31+
{...file}
32+
key={i}
33+
onDelete={ onDeleteIntent }
34+
onSave={ onSave }
35+
/>
36+
)
37+
})
38+
}
39+
</Panel>
940
)
1041

1142
FileList.propTypes = {
@@ -14,4 +45,6 @@ FileList.propTypes = {
1445

1546
FileList.Item = FileListItem
1647

17-
export default FileList
48+
export default uncontrollable(FileList, {
49+
deletingFile: 'onDeleteIntent'
50+
})

src/components/FileList/FileList.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
@import 'tc-includes';
22

33
.file-list {
4+
// reset styles of panel class, we need panel class to activate the modal-overlay
5+
border: none;
6+
box-shadow: none;
47
> h4 {
58

69
@include roboto-medium;
@@ -48,6 +51,9 @@
4851
}
4952
.edit-icons {
5053
margin-left: 5px;
54+
i {
55+
cursor: pointer;
56+
}
5157
}
5258
.title-edit {
5359
display: flex;
@@ -91,4 +97,8 @@
9197
.icon-close {
9298
margin-right: 10px;
9399
}
100+
}
101+
102+
.delete-file-modal {
103+
94104
}

src/components/FileList/FileListItem.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ export default class FileListItem extends React.Component {
5656
const title = this.refs.title.value
5757
if (!title || title.trim().length === 0) {
5858
errors['title'] = 'The file name cannot be blank.'
59+
} else {
60+
delete errors['title']
5961
}
6062
}
6163

6264
onTitleChange() {
6365
const errors = this.state.errors || {}
6466
this.validateTitle(errors)
65-
if (!_.isEmpty(errors)) {
66-
this.setState({ errors })
67-
}
67+
this.setState({ errors })
6868
}
6969

7070
renderEditing() {
@@ -88,26 +88,26 @@ export default class FileListItem extends React.Component {
8888
}
8989

9090
renderReadOnly() {
91-
const {title, description, size, isEditable} = this.props
91+
const {title, downloadUrl, description, size, isEditable} = this.props
9292
return (
9393
<div>
9494
<div className="title">
95-
<h4>{title}</h4>
95+
<h4><a href={downloadUrl} target="_blank" rel="noopener noreferrer">{title}</a></h4>
9696
<div className="size">
9797
{filesize(size)}
9898
</div>
9999
{isEditable && <div className="edit-icons">
100-
<a href="javascript:" className="icon-edit" onClick={this.startEdit}><EditIcon /></a>
101-
<a href="javascript:" className="icon-trash" onClick={this.onDelete}><TrashIcon /></a>
100+
<i className="icon-edit" onClick={this.startEdit}><EditIcon /></i>
101+
<i className="icon-trash" onClick={this.onDelete}><TrashIcon /></i>
102102
</div>}
103103
</div>
104104
<p>{description}</p>
105105
</div>
106106
)
107107
}
108-
108+
109109
render() {
110-
const {isEditing} = this.state
110+
const { isEditing } = this.state
111111
let iconPath
112112
try {
113113
iconPath = require('./images/' + this.props.contentType.split('/')[1] +'.svg')

src/components/Home/Home.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Home extends React.Component {
1212

1313
componentWillMount() {
1414
// redirect to project list if user is logged in.
15+
document.title = 'Connect - Topcoder'
1516
if (this.props.isLoggedIn)
1617
this.props.router.push('/projects')
1718
}
@@ -46,4 +47,4 @@ const mapStateToProps = ({loadUser}) => {
4647
}
4748
}
4849

49-
export default withRouter(connect(mapStateToProps)(Home))
50+
export default withRouter(connect(mapStateToProps)(Home))

src/components/LinksMenu/DeleteLinkModal.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ import React, {PropTypes} from 'react'
33
const DeleteLinkModal = ({ onCancel, onConfirm}) => {
44
return (
55
<div className="modal">
6-
<div className="modal-title danger flex center">
6+
<div className="modal-title danger">
77
You're about to delete a link
88
</div>
99
<div className="modal-body">
10-
<p className="message center">
10+
<p className="message">
1111
Your team might need this link, are you sure you want to delete it? This action can't be undone.
1212
</p>
1313

1414
<div className="button-area flex center">
1515
<button className="tc-btn tc-btn-default tc-btn-sm btn-cancel" onClick={onCancel}>Cancel</button>
16-
{' '}
1716
<button className="tc-btn tc-btn-warning tc-btn-sm" onClick={onConfirm}>Delete link</button>
1817
</div>
1918
</div>

0 commit comments

Comments
 (0)