Skip to content

Commit 43eb98b

Browse files
committed
Prettier 💖
1 parent 3c7361b commit 43eb98b

File tree

119 files changed

+3218
-2274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+3218
-2274
lines changed

‎.prettierrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
singleQuote: true
2+
semi: false

‎packages/news/lib/client/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from '../modules/index.js';
1+
export * from '../modules/index.js'
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
import React from 'react';
2-
import { Posts } from '../../modules/posts/index.js';
3-
import { Link } from 'react-router';
1+
import React from 'react'
2+
import { Posts } from '../../modules/posts/index.js'
3+
import { Link } from 'react-router'
44

5-
const AdminUsersPosts = ({ document: user }) =>
5+
const AdminUsersPosts = ({ document: user }) => (
66
<ul>
7-
{user.posts && user.posts.map(post =>
8-
<li key={post._id}><Link to={Posts.getLink(post)}>{post.title}</Link></li>
9-
)}
7+
{user.posts &&
8+
user.posts.map(post => (
9+
<li key={post._id}>
10+
<Link to={Posts.getLink(post)}>{post.title}</Link>
11+
</li>
12+
))}
1013
</ul>
14+
)
1115

12-
export default AdminUsersPosts;
16+
export default AdminUsersPosts
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
import React from 'react';
2-
import PropTypes from 'prop-types';
3-
import { intlShape } from 'meteor/vulcan:i18n';
4-
import { Components, registerComponent, getFragment, withMessages } from 'meteor/vulcan:core';
5-
import { Categories } from '../../modules/categories/index.js';
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
import { intlShape } from 'meteor/vulcan:i18n'
4+
import {
5+
Components,
6+
registerComponent,
7+
getFragment,
8+
withMessages
9+
} from 'meteor/vulcan:core'
10+
import { Categories } from '../../modules/categories/index.js'
611

712
const CategoriesEditForm = (props, context) => {
8-
913
return (
1014
<div className="categories-edit-form">
1115
<div className="categories-edit-form-admin">
@@ -16,28 +20,40 @@ const CategoriesEditForm = (props, context) => {
1620
documentId={props.category._id}
1721
mutationFragment={getFragment('CategoriesList')}
1822
successCallback={category => {
19-
props.closeModal();
20-
props.flash(context.intl.formatMessage({ id: 'categories.edit_success' }, { name: category.name }), 'success');
23+
props.closeModal()
24+
props.flash(
25+
context.intl.formatMessage(
26+
{ id: 'categories.edit_success' },
27+
{ name: category.name }
28+
),
29+
'success'
30+
)
2131
}}
2232
removeSuccessCallback={({ documentId, documentTitle }) => {
23-
props.closeModal();
24-
props.flash(context.intl.formatMessage({ id: 'categories.delete_success' }, { name: documentTitle }), 'success');
33+
props.closeModal()
34+
props.flash(
35+
context.intl.formatMessage(
36+
{ id: 'categories.delete_success' },
37+
{ name: documentTitle }
38+
),
39+
'success'
40+
)
2541
// context.events.track("category deleted", {_id: documentId});
2642
}}
2743
showRemove={true}
2844
/>
2945
</div>
30-
);
31-
};
46+
)
47+
}
3248

3349
CategoriesEditForm.propTypes = {
3450
category: PropTypes.object.isRequired,
3551
closeModal: PropTypes.func,
36-
flash: PropTypes.func,
37-
};
52+
flash: PropTypes.func
53+
}
3854

3955
CategoriesEditForm.contextTypes = {
40-
intl: intlShape,
41-
};
56+
intl: intlShape
57+
}
4258

43-
registerComponent('CategoriesEditForm', CategoriesEditForm, withMessages);
59+
registerComponent('CategoriesEditForm', CategoriesEditForm, withMessages)
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,163 @@
1-
import { ModalTrigger, Components, registerComponent, withList, Utils } from "meteor/vulcan:core";
2-
import React, { PureComponent } from 'react';
3-
import PropTypes from 'prop-types';
4-
import { FormattedMessage } from 'meteor/vulcan:i18n';
5-
import Button from 'react-bootstrap/lib/Button';
6-
import DropdownButton from 'react-bootstrap/lib/DropdownButton';
7-
import MenuItem from 'react-bootstrap/lib/MenuItem';
1+
import {
2+
ModalTrigger,
3+
Components,
4+
registerComponent,
5+
withList,
6+
Utils
7+
} from 'meteor/vulcan:core'
8+
import React, { PureComponent } from 'react'
9+
import PropTypes from 'prop-types'
10+
import { FormattedMessage } from 'meteor/vulcan:i18n'
11+
import Button from 'react-bootstrap/lib/Button'
12+
import DropdownButton from 'react-bootstrap/lib/DropdownButton'
13+
import MenuItem from 'react-bootstrap/lib/MenuItem'
814
import { withRouter } from 'react-router'
9-
import { LinkContainer } from 'react-router-bootstrap';
10-
import { Categories } from '../../modules/categories/index.js';
11-
import { withApollo } from 'react-apollo';
15+
import { LinkContainer } from 'react-router-bootstrap'
16+
import { Categories } from '../../modules/categories/index.js'
17+
import { withApollo } from 'react-apollo'
1218

1319
class CategoriesList extends PureComponent {
14-
1520
constructor() {
16-
super();
17-
this.getCurrentCategoriesArray = this.getCurrentCategoriesArray.bind(this);
18-
this.getCategoryLink = this.getCategoryLink.bind(this);
21+
super()
22+
this.getCurrentCategoriesArray = this.getCurrentCategoriesArray.bind(this)
23+
this.getCategoryLink = this.getCategoryLink.bind(this)
1924
}
2025

2126
getCurrentCategoriesArray() {
22-
const currentCategories = _.clone(this.props.location.query.cat);
27+
const currentCategories = _.clone(this.props.location.query.cat)
2328
if (currentCategories) {
24-
return Array.isArray(currentCategories) ? currentCategories : [currentCategories]
29+
return Array.isArray(currentCategories)
30+
? currentCategories
31+
: [currentCategories]
2532
} else {
26-
return [];
33+
return []
2734
}
2835
}
2936

3037
getCategoryLink(slug) {
31-
const categories = this.getCurrentCategoriesArray();
38+
const categories = this.getCurrentCategoriesArray()
3239
return {
3340
pathname: Utils.getRoutePath('posts.list'),
3441
query: {
3542
...this.props.location.query,
36-
cat: categories.includes(slug) ? _.without(categories, slug) : categories.concat([slug])
43+
cat: categories.includes(slug)
44+
? _.without(categories, slug)
45+
: categories.concat([slug])
3746
}
3847
}
3948
}
4049

4150
getNestedCategories() {
42-
const categories = this.props.results;
51+
const categories = this.props.results
4352

4453
// check if a category is currently active in the route
45-
const currentCategorySlug = this.props.router.location.query && this.props.router.location.query.cat;
46-
const currentCategory = Categories.findOneInStore(this.props.client.store, {slug: currentCategorySlug});
47-
const parentCategories = Categories.getParents(currentCategory, this.props.client.store);
54+
const currentCategorySlug =
55+
this.props.router.location.query && this.props.router.location.query.cat
56+
const currentCategory = Categories.findOneInStore(this.props.client.store, {
57+
slug: currentCategorySlug
58+
})
59+
const parentCategories = Categories.getParents(
60+
currentCategory,
61+
this.props.client.store
62+
)
4863

4964
// decorate categories with active and expanded properties
5065
const categoriesClone = _.map(categories, category => {
5166
return {
5267
...category, // we don't want to modify the objects we got from props
53-
active: currentCategory && category.slug === currentCategory.slug,
54-
expanded: parentCategories && _.contains(_.pluck(parentCategories, 'slug'), category.slug)
55-
};
56-
});
68+
active: currentCategory && category.slug === currentCategory.slug,
69+
expanded:
70+
parentCategories &&
71+
_.contains(_.pluck(parentCategories, 'slug'), category.slug)
72+
}
73+
})
5774

58-
const nestedCategories = Utils.unflatten(categoriesClone, {idProperty: '_id', parentIdProperty: 'parentId'});
75+
const nestedCategories = Utils.unflatten(categoriesClone, {
76+
idProperty: '_id',
77+
parentIdProperty: 'parentId'
78+
})
5979

60-
return nestedCategories;
80+
return nestedCategories
6181
}
6282

6383
render() {
64-
65-
const allCategoriesQuery = _.clone(this.props.router.location.query);
66-
delete allCategoriesQuery.cat;
67-
const nestedCategories = this.getNestedCategories();
84+
const allCategoriesQuery = _.clone(this.props.router.location.query)
85+
delete allCategoriesQuery.cat
86+
const nestedCategories = this.getNestedCategories()
6887

6988
return (
7089
<div>
7190
<DropdownButton
7291
bsStyle="default"
7392
className="categories-list btn-secondary"
74-
title={<FormattedMessage id="categories"/>}
93+
title={<FormattedMessage id="categories" />}
7594
id="categories-dropdown"
7695
>
7796
<div className="category-menu-item category-menu-item-all dropdown-item">
78-
<LinkContainer className="category-menu-item-title" to={{pathname:"/", query: allCategoriesQuery}}>
97+
<LinkContainer
98+
className="category-menu-item-title"
99+
to={{ pathname: '/', query: allCategoriesQuery }}
100+
>
79101
<MenuItem eventKey={0}>
80-
<FormattedMessage id="categories.all"/>
102+
<FormattedMessage id="categories.all" />
81103
</MenuItem>
82104
</LinkContainer>
83105
</div>
84-
{
85-
// categories data are loaded
86-
!this.props.loading ?
87-
// there are currently categories
88-
nestedCategories && nestedCategories.length > 0 ?
89-
nestedCategories.map((category, index) => <Components.CategoriesNode key={index} category={category} index={index} openModal={this.openCategoryEditModal}/>)
90-
// not any category found
91-
: null
106+
{// categories data are loaded
107+
!this.props.loading ? (
108+
// there are currently categories
109+
nestedCategories && nestedCategories.length > 0 ? (
110+
nestedCategories.map((category, index) => (
111+
<Components.CategoriesNode
112+
key={index}
113+
category={category}
114+
index={index}
115+
openModal={this.openCategoryEditModal}
116+
/>
117+
))
118+
) : // not any category found
119+
null
120+
) : (
92121
// categories are loading
93-
: <div className="dropdown-item"><MenuItem><Components.Loading /></MenuItem></div>
94-
}
122+
<div className="dropdown-item">
123+
<MenuItem>
124+
<Components.Loading />
125+
</MenuItem>
126+
</div>
127+
)}
95128
<Components.ShowIf check={Categories.options.mutations.new.check}>
96129
<div className="categories-new-button category-menu-item dropdown-item">
97-
<ModalTrigger title={<FormattedMessage id="categories.new"/>} component={<Button bsStyle="primary"><FormattedMessage id="categories.new"/></Button>}>
98-
<Components.CategoriesNewForm/>
130+
<ModalTrigger
131+
title={<FormattedMessage id="categories.new" />}
132+
component={
133+
<Button bsStyle="primary">
134+
<FormattedMessage id="categories.new" />
135+
</Button>
136+
}
137+
>
138+
<Components.CategoriesNewForm />
99139
</ModalTrigger>
100140
</div>
101141
</Components.ShowIf>
102142
</DropdownButton>
103-
104143
</div>
105144
)
106-
107145
}
108146
}
109147

110148
CategoriesList.propTypes = {
111-
results: PropTypes.array,
112-
};
113-
149+
results: PropTypes.array
150+
}
114151

115152
const options = {
116153
collection: Categories,
117154
queryName: 'categoriesListQuery',
118155
fragmentName: 'CategoriesList',
119156
limit: 0,
120-
pollInterval: 0,
121-
};
157+
pollInterval: 0
158+
}
122159

123-
registerComponent('CategoriesList', CategoriesList, withRouter, withApollo, [withList, options]);
160+
registerComponent('CategoriesList', CategoriesList, withRouter, withApollo, [
161+
withList,
162+
options
163+
])
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
1-
import React from 'react';
2-
import PropTypes from 'prop-types';
3-
import { intlShape } from 'meteor/vulcan:i18n';
4-
import { Components, registerComponent, getFragment, withMessages } from 'meteor/vulcan:core';
5-
import { Categories } from '../../modules/categories/index.js';
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
import { intlShape } from 'meteor/vulcan:i18n'
4+
import {
5+
Components,
6+
registerComponent,
7+
getFragment,
8+
withMessages
9+
} from 'meteor/vulcan:core'
10+
import { Categories } from '../../modules/categories/index.js'
611

712
const CategoriesNewForm = (props, context) => {
8-
913
return (
1014
<div className="categories-new-form">
11-
<Components.SmartForm
15+
<Components.SmartForm
1216
collection={Categories}
1317
mutationFragment={getFragment('CategoriesList')}
1418
successCallback={category => {
15-
props.closeModal();
16-
props.flash(context.intl.formatMessage({id: 'categories.new_success'}, {name: category.name}), "success");
19+
props.closeModal()
20+
props.flash(
21+
context.intl.formatMessage(
22+
{ id: 'categories.new_success' },
23+
{ name: category.name }
24+
),
25+
'success'
26+
)
1727
}}
1828
/>
1929
</div>
2030
)
2131
}
2232

23-
CategoriesNewForm.displayName = "CategoriesNewForm";
33+
CategoriesNewForm.displayName = 'CategoriesNewForm'
2434

2535
CategoriesNewForm.propTypes = {
2636
closeCallback: PropTypes.func,
27-
flash: PropTypes.func,
28-
};
37+
flash: PropTypes.func
38+
}
2939

3040
CategoriesNewForm.contextTypes = {
31-
intl: intlShape,
32-
};
41+
intl: intlShape
42+
}
3343

34-
registerComponent('CategoriesNewForm', CategoriesNewForm, withMessages);
44+
registerComponent('CategoriesNewForm', CategoriesNewForm, withMessages)

0 commit comments

Comments
 (0)