Skip to content

Commit 4bc59a3

Browse files
prettier lint
1 parent 57ed8ea commit 4bc59a3

File tree

1 file changed

+28
-46
lines changed

1 file changed

+28
-46
lines changed

src/containers/AdminCampaignList.jsx

Lines changed: 28 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ import LoadingIndicator from "../components/LoadingIndicator";
1818
import { dataTest } from "../lib/attributes";
1919
import loadData from "./hoc/load-data";
2020
import theme from "../styles/theme";
21-
import SortBy, {
22-
ID_DESC_SORT
23-
} from "../components/AdminCampaignList/SortBy";
21+
import SortBy, { ID_DESC_SORT } from "../components/AdminCampaignList/SortBy";
2422
import Search from "../components/Search";
2523
import CampaignTable from "../components/AdminCampaignList/CampaignTable";
2624

@@ -36,13 +34,7 @@ const styles = StyleSheet.create({
3634
const INITIAL_SORT_BY = ID_DESC_SORT.value;
3735

3836
// Exported for testing
39-
export const AdminCampaignList = ({
40-
params,
41-
mutations,
42-
router,
43-
data
44-
}) => {
45-
37+
export const AdminCampaignList = ({ params, mutations, router, data }) => {
4638
const [state, setState] = useState({
4739
pageSize: 50,
4840
page: 0,
@@ -60,9 +52,9 @@ export const AdminCampaignList = ({
6052

6153
const handleClickNewButton = async () => {
6254
const { organizationId } = params;
63-
setState({
55+
setState({
6456
...state,
65-
isLoading: true
57+
isLoading: true
6658
});
6759
const newCampaign = await mutations.createCampaign({
6860
title: "New Campaign",
@@ -87,9 +79,9 @@ export const AdminCampaignList = ({
8779

8880
const handleClickArchiveMultipleButton = async keys => {
8981
if (keys.length) {
90-
setState({
82+
setState({
9183
...state,
92-
isLoading: true
84+
isLoading: true
9385
});
9486
await mutations.archiveCampaigns(keys);
9587
await data.refetch();
@@ -173,16 +165,16 @@ export const AdminCampaignList = ({
173165

174166
const handleMenuClick = event => {
175167
console.log("event.target", event.target);
176-
setState({
168+
setState({
177169
...state,
178-
menuAnchorEl: event.target
170+
menuAnchorEl: event.target
179171
});
180172
};
181173

182174
const handleMenuClose = () => {
183-
setState({
175+
setState({
184176
...state,
185-
menuAnchorEl: null
177+
menuAnchorEl: null
186178
});
187179
};
188180

@@ -208,10 +200,7 @@ export const AdminCampaignList = ({
208200
return (
209201
<React.Fragment>
210202
{iconButton}
211-
<Menu
212-
open={state.archiveMultipleMenu}
213-
anchorEl={state.menuAnchorEl}
214-
>
203+
<Menu open={state.archiveMultipleMenu} anchorEl={state.menuAnchorEl}>
215204
{state.archiveMultiple ? (
216205
<MenuItem
217206
onClick={() => {
@@ -240,14 +229,10 @@ export const AdminCampaignList = ({
240229
</Menu>
241230
</React.Fragment>
242231
);
243-
}
232+
};
244233

245234
const changePage = (pageDelta, pageSize) => {
246-
const {
247-
limit,
248-
offset,
249-
total
250-
} = data.organization.campaigns.pageInfo;
235+
const { limit, offset, total } = data.organization.campaigns.pageInfo;
251236
const currentPage = Math.floor(offset / limit);
252237
const pageSizeAdjustedCurrentPage = Math.floor(
253238
(currentPage * limit) / pageSize
@@ -279,10 +264,10 @@ export const AdminCampaignList = ({
279264
await data.refetch({
280265
campaignsFilter: newFilter
281266
});
282-
setState({
267+
setState({
283268
...state,
284269
campaignsFilter: newFilter,
285-
isLoading: false
270+
isLoading: false
286271
});
287272
};
288273

@@ -295,7 +280,7 @@ export const AdminCampaignList = ({
295280
await data.refetch({
296281
sortBy: newSort
297282
});
298-
setState({
283+
setState({
299284
...state,
300285
isLoading: false,
301286
sortBy: newSort
@@ -322,9 +307,9 @@ export const AdminCampaignList = ({
322307
const changeCampaignStatus = async (campaignId, changeFn) => {
323308
setState({
324309
...state,
325-
campaignsWithChangingStatus: state.campaignsWithChangingStatus.concat(
326-
[campaignId]
327-
)
310+
campaignsWithChangingStatus: state.campaignsWithChangingStatus.concat([
311+
campaignId
312+
])
328313
});
329314
await changeFn(campaignId);
330315
await data.refetch();
@@ -343,10 +328,7 @@ export const AdminCampaignList = ({
343328
};
344329

345330
const handleUnarchiveCampaign = async campaignId => {
346-
await changeCampaignStatus(
347-
campaignId,
348-
mutations.unarchiveCampaign
349-
);
331+
await changeCampaignStatus(campaignId, mutations.unarchiveCampaign);
350332
};
351333

352334
const renderActionButton = () => {
@@ -374,7 +356,7 @@ export const AdminCampaignList = ({
374356
<AddIcon />
375357
</Fab>
376358
);
377-
}
359+
};
378360
// don't think this is right
379361
return (
380362
<div>
@@ -402,7 +384,7 @@ export const AdminCampaignList = ({
402384
{params.adminPerms && renderActionButton()}
403385
</div>
404386
);
405-
}
387+
};
406388

407389
const campaignInfoFragment = `
408390
id
@@ -543,13 +525,13 @@ const mutations = {
543525

544526
AdminCampaignList.propTypes = {
545527
params: PropTypes.object,
546-
mutations: PropTypes.exact({
547-
createCampaign: PropTypes.func,
548-
archiveCampaigns: PropTypes.func,
549-
unarchiveCampaign: PropTypes.func
550-
}),
528+
mutations: PropTypes.exact({
529+
createCampaign: PropTypes.func,
530+
archiveCampaigns: PropTypes.func,
531+
unarchiveCampaign: PropTypes.func
532+
}),
551533
data: PropTypes.object,
552534
router: PropTypes.object
553-
}
535+
};
554536

555537
export default loadData({ queries, mutations })(withRouter(AdminCampaignList));

0 commit comments

Comments
 (0)