💄 omit creation date on sketch and collection list

This commit is contained in:
ghalestrilo 2020-08-04 10:55:16 -03:00
parent 6e323fd683
commit e9ad261c95
6 changed files with 51 additions and 17 deletions

View file

@ -34,7 +34,10 @@ class App extends React.Component {
render() { render() {
return ( return (
<div className="app"> <div className="app">
{this.state.isMounted && !window.devToolsExtension && getConfig('NODE_ENV') === 'development' && <DevTools />} <div style={{ display: 'none' }}>
{this.state.isMounted && !window.devToolsExtension && getConfig('NODE_ENV') === 'development' && <DevTools />}
</div>
{this.props.children} {this.props.children}
</div> </div>
); );

View file

@ -127,6 +127,7 @@ class CollectionList extends React.Component {
render() { render() {
const username = this.props.username !== undefined ? this.props.username : this.props.user.username; const username = this.props.username !== undefined ? this.props.username : this.props.user.username;
const { mobile } = this.props;
return ( return (
<article className="sketches-table-container"> <article className="sketches-table-container">
@ -141,8 +142,8 @@ class CollectionList extends React.Component {
<thead> <thead>
<tr> <tr>
{this._renderFieldHeader('name', 'Name')} {this._renderFieldHeader('name', 'Name')}
{this._renderFieldHeader('createdAt', 'Date Created')} {(!mobile) && this._renderFieldHeader('createdAt', 'Date Created')}
{this._renderFieldHeader('updatedAt', 'Date Updated')} {(!mobile) && this._renderFieldHeader('updatedAt', 'Date Updated')}
{this._renderFieldHeader('numItems', '# sketches')} {this._renderFieldHeader('numItems', '# sketches')}
<th scope="col"></th> <th scope="col"></th>
</tr> </tr>
@ -150,6 +151,7 @@ class CollectionList extends React.Component {
<tbody> <tbody>
{this.props.collections.map(collection => {this.props.collections.map(collection =>
(<CollectionListRow (<CollectionListRow
mobile={mobile}
key={collection.id} key={collection.id}
collection={collection} collection={collection}
user={this.props.user} user={this.props.user}
@ -209,7 +211,8 @@ CollectionList.propTypes = {
owner: PropTypes.shape({ owner: PropTypes.shape({
id: PropTypes.string id: PropTypes.string
}) })
}) }),
mobile: PropTypes.bool,
}; };
CollectionList.defaultProps = { CollectionList.defaultProps = {
@ -218,7 +221,8 @@ CollectionList.defaultProps = {
id: undefined, id: undefined,
owner: undefined owner: undefined
}, },
username: undefined username: undefined,
mobile: false
}; };
function mapStateToProps(state, ownProps) { function mapStateToProps(state, ownProps) {

View file

@ -199,7 +199,7 @@ class CollectionListRowBase extends React.Component {
} }
render() { render() {
const { collection } = this.props; const { collection, mobile } = this.props;
return ( return (
<tr <tr
@ -211,8 +211,8 @@ class CollectionListRowBase extends React.Component {
{this.renderCollectionName()} {this.renderCollectionName()}
</span> </span>
</th> </th>
<td>{format(new Date(collection.createdAt), 'MMM D, YYYY')}</td> {(!mobile) && <td>{format(new Date(collection.createdAt), 'MMM D, YYYY')}</td>}
<td>{format(new Date(collection.updatedAt), 'MMM D, YYYY')}</td> {(!mobile) && <td>{format(new Date(collection.updatedAt), 'MMM D, YYYY')}</td>}
<td>{(collection.items || []).length}</td> <td>{(collection.items || []).length}</td>
<td className="sketch-list__dropdown-column"> <td className="sketch-list__dropdown-column">
{this.renderActions()} {this.renderActions()}
@ -245,6 +245,11 @@ CollectionListRowBase.propTypes = {
deleteCollection: PropTypes.func.isRequired, deleteCollection: PropTypes.func.isRequired,
editCollection: PropTypes.func.isRequired, editCollection: PropTypes.func.isRequired,
onAddSketches: PropTypes.func.isRequired, onAddSketches: PropTypes.func.isRequired,
mobile: PropTypes.bool,
};
CollectionListRowBase.defaultProps = {
mobile: false,
}; };
function mapDispatchToPropsSketchListRow(dispatch) { function mapDispatchToPropsSketchListRow(dispatch) {

View file

@ -251,6 +251,7 @@ class SketchListRowBase extends React.Component {
const { const {
sketch, sketch,
username, username,
mobile
} = this.props; } = this.props;
const { renameOpen, renameValue } = this.state; const { renameOpen, renameValue } = this.state;
let url = `/${username}/sketches/${sketch.id}`; let url = `/${username}/sketches/${sketch.id}`;
@ -287,7 +288,7 @@ class SketchListRowBase extends React.Component {
<th scope="row"> <th scope="row">
{name} {name}
</th> </th>
<td>{format(new Date(sketch.createdAt), 'MMM D, YYYY h:mm A')}</td> {(!mobile) && <td>{format(new Date(sketch.createdAt), 'MMM D, YYYY h:mm A')}</td>}
<td>{format(new Date(sketch.updatedAt), 'MMM D, YYYY h:mm A')}</td> <td>{format(new Date(sketch.updatedAt), 'MMM D, YYYY h:mm A')}</td>
{this.renderDropdown()} {this.renderDropdown()}
</tr> </tr>
@ -312,7 +313,12 @@ SketchListRowBase.propTypes = {
cloneProject: PropTypes.func.isRequired, cloneProject: PropTypes.func.isRequired,
exportProjectAsZip: PropTypes.func.isRequired, exportProjectAsZip: PropTypes.func.isRequired,
changeProjectName: PropTypes.func.isRequired, changeProjectName: PropTypes.func.isRequired,
onAddToCollection: PropTypes.func.isRequired onAddToCollection: PropTypes.func.isRequired,
mobile: PropTypes.bool
};
SketchListRowBase.defaultProps = {
mobile: false
}; };
function mapDispatchToPropsSketchListRow(dispatch) { function mapDispatchToPropsSketchListRow(dispatch) {
@ -413,6 +419,7 @@ class SketchList extends React.Component {
render() { render() {
const username = this.props.username !== undefined ? this.props.username : this.props.user.username; const username = this.props.username !== undefined ? this.props.username : this.props.user.username;
const { mobile } = this.props;
return ( return (
<article className="sketches-table-container"> <article className="sketches-table-container">
<Helmet> <Helmet>
@ -425,7 +432,7 @@ class SketchList extends React.Component {
<thead> <thead>
<tr> <tr>
{this._renderFieldHeader('name', 'Sketch')} {this._renderFieldHeader('name', 'Sketch')}
{this._renderFieldHeader('createdAt', 'Date Created')} {(!mobile) && this._renderFieldHeader('createdAt', 'Date Created')}
{this._renderFieldHeader('updatedAt', 'Date Updated')} {this._renderFieldHeader('updatedAt', 'Date Updated')}
<th scope="col"></th> <th scope="col"></th>
</tr> </tr>
@ -433,6 +440,7 @@ class SketchList extends React.Component {
<tbody> <tbody>
{this.props.sketches.map(sketch => {this.props.sketches.map(sketch =>
(<SketchListRow (<SketchListRow
mobile={mobile}
key={sketch.id} key={sketch.id}
sketch={sketch} sketch={sketch}
user={this.props.user} user={this.props.user}
@ -482,10 +490,12 @@ SketchList.propTypes = {
field: PropTypes.string.isRequired, field: PropTypes.string.isRequired,
direction: PropTypes.string.isRequired direction: PropTypes.string.isRequired
}).isRequired, }).isRequired,
mobile: PropTypes.bool,
}; };
SketchList.defaultProps = { SketchList.defaultProps = {
username: undefined username: undefined,
mobile: false,
}; };
function mapStateToProps(state) { function mapStateToProps(state) {

View file

@ -72,7 +72,7 @@ const getCreatePathname = (panel, username) => (CreatePathname[panel] || '#').re
const isOwner = (user, params) => user && params && user.username === params.username; const isOwner = (user, params) => user && params && user.username === params.username;
const renderPanel = (name, props) => (Component => (Component && <Component {...props} />))(Panels[name]); const renderPanel = (name, props) => (Component => (Component && <Component {...props} mobile />))(Panels[name]);
const MobileDashboard = ({ params, location }) => { const MobileDashboard = ({ params, location }) => {
const user = useSelector(state => state.user); const user = useSelector(state => state.user);

View file

@ -4,22 +4,34 @@ import { remSize } from '../../theme';
export default styled.div` export default styled.div`
/* Dashboard Styles */
z-index: 0; z-index: 0;
margin-top: ${props => remSize(props.slimheader ? 50 : 68)}; margin-top: ${props => remSize(props.slimheader ? 50 : 68)};
.sketch-list__sort-button { padding: 0 }
/* Dashboard Styles */
td { td {
font-size: ${remSize(10)}; font-size: ${remSize(10)};
min-width: ${remSize(72)}; min-width: ${remSize(72)};
}; };
tbody th { tbody th {
flex-direction: row;
font-size: ${remSize(14)}; font-size: ${remSize(14)};
/* font-weight: bold; */ /* font-weight: bold; */
/* width: 100%; */ width: 100%;
max-width: ${remSize(140)}; /* max-width: ${remSize(280)}; */
}; };
.sketch-list__sort-button { padding: 0 }
.sketches-table__row {
height: ${remSize(48)};
}
.sketches-table-container { padding-bottom: ${remSize(160)} }
td.sketch-list__dropdown-column { min-width: unset; } td.sketch-list__dropdown-column { min-width: unset; }
`; `;