fix bugs in sketch list view
This commit is contained in:
parent
7cafe490df
commit
d7a6773995
3 changed files with 22 additions and 8 deletions
|
@ -29,21 +29,21 @@ class Sidebar extends React.Component {
|
||||||
<button
|
<button
|
||||||
aria-label="add file"
|
aria-label="add file"
|
||||||
className="sidebar__add"
|
className="sidebar__add"
|
||||||
onClick={props.newFile}
|
onClick={this.props.newFile}
|
||||||
>
|
>
|
||||||
+
|
+
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
aria-label="collapse file navigation"
|
aria-label="collapse file navigation"
|
||||||
className="sidebar__contract"
|
className="sidebar__contract"
|
||||||
onClick={props.collapseSidebar}
|
onClick={this.props.collapseSidebar}
|
||||||
>
|
>
|
||||||
<InlineSVG src={leftArrowUrl} />
|
<InlineSVG src={leftArrowUrl} />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
aria-label="expand file navigation"
|
aria-label="expand file navigation"
|
||||||
className="sidebar__expand"
|
className="sidebar__expand"
|
||||||
onClick={props.expandSidebar}
|
onClick={this.props.expandSidebar}
|
||||||
>
|
>
|
||||||
<InlineSVG src={rightArrowUrl} />
|
<InlineSVG src={rightArrowUrl} />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -19,9 +19,17 @@ class IDEView extends React.Component {
|
||||||
if (this.props.params.project_id) {
|
if (this.props.params.project_id) {
|
||||||
const id = this.props.params.project_id;
|
const id = this.props.params.project_id;
|
||||||
this.props.getProject(id);
|
this.props.getProject(id);
|
||||||
|
|
||||||
|
// if autosave is enabled
|
||||||
|
this.autosaveInterval = setInterval(this.props.saveProject, 30000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
clearInterval(this.autosaveInterval);
|
||||||
|
this.autosaveInterval = null;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="ide">
|
<div className="ide">
|
||||||
|
|
|
@ -19,16 +19,20 @@ class SketchListView extends React.Component {
|
||||||
user={this.props.user}
|
user={this.props.user}
|
||||||
createProject={this.props.createProject}
|
createProject={this.props.createProject}
|
||||||
saveProject={this.props.saveProject}
|
saveProject={this.props.saveProject}
|
||||||
|
exportProjectAsZip={this.props.exportProjectAsZip}
|
||||||
|
cloneProject={this.props.cloneProject}
|
||||||
/>
|
/>
|
||||||
<table className="sketches-table" summary="table containing all saved projects">
|
<table className="sketches-table" summary="table containing all saved projects">
|
||||||
<thead>
|
<thead>
|
||||||
|
<tr>
|
||||||
<th scope="col">Name</th>
|
<th scope="col">Name</th>
|
||||||
<th scope="col">Created</th>
|
<th scope="col">Created</th>
|
||||||
<th scope="col">Last Updated</th>
|
<th scope="col">Last Updated</th>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{this.props.sketches.map(sketch =>
|
{this.props.sketches.map(sketch =>
|
||||||
<tr className="sketches-table__row">
|
<tr className="sketches-table__row" key={sketch.id}>
|
||||||
<td scope="row"><Link to={`/projects/${sketch._id}`}>{sketch.name}</Link></td>
|
<td scope="row"><Link to={`/projects/${sketch._id}`}>{sketch.name}</Link></td>
|
||||||
<td>{moment(sketch.createdAt).format('MMM D, YYYY')}</td>
|
<td>{moment(sketch.createdAt).format('MMM D, YYYY')}</td>
|
||||||
<td>{moment(sketch.updatedAt).format('MMM D, YYYY')}</td>
|
<td>{moment(sketch.updatedAt).format('MMM D, YYYY')}</td>
|
||||||
|
@ -46,7 +50,9 @@ SketchListView.propTypes = {
|
||||||
createProject: PropTypes.func.isRequired,
|
createProject: PropTypes.func.isRequired,
|
||||||
saveProject: PropTypes.func.isRequired,
|
saveProject: PropTypes.func.isRequired,
|
||||||
getProjects: PropTypes.func.isRequired,
|
getProjects: PropTypes.func.isRequired,
|
||||||
sketches: PropTypes.array.isRequired
|
sketches: PropTypes.array.isRequired,
|
||||||
|
exportProjectAsZip: PropTypes.func.isRequired,
|
||||||
|
cloneProject: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
|
|
Loading…
Reference in a new issue