File tree Expand file tree Collapse file tree 8 files changed +87
-146
lines changed Expand file tree Collapse file tree 8 files changed +87
-146
lines changed Original file line number Diff line number Diff line change @@ -8,43 +8,43 @@ import notify from '../../lib/notifier';
8
8
9
9
import withLayout from '../../lib/withLayout' ;
10
10
import withAuth from '../../lib/withAuth' ;
11
- import {
12
- getBookList ,
13
- } from '../../lib/api/admin' ;
11
+ import { getBookList } from '../../lib/api/admin' ;
14
12
15
-
16
- const Index = ( {
17
- books,
18
- } ) => (
13
+ const Index = ( { books } ) => (
19
14
< div style = { { padding : '10px 45px' } } >
20
15
< div >
21
- < h2 > Books</ h2 >
16
+ < h2 >
17
+ Books
18
+ </ h2 >
22
19
< Link href = "/admin/add-book" >
23
- < Button variant = "contained" > Add book</ Button >
20
+ < Button variant = "contained" >
21
+ Add book
22
+ </ Button >
24
23
</ Link >
25
24
< p />
26
25
< ul >
27
- { books . map ( b => (
26
+ { books . map ( ( b ) => (
28
27
< li key = { b . _id } >
29
- < Link
30
- as = { `/admin/book-detail/${ b . slug } ` }
31
- href = { `/admin/book-detail?slug=${ b . slug } ` }
32
- >
33
- < a > { b . name } </ a >
28
+ < Link as = { `/admin/book-detail/${ b . slug } ` } href = { `/admin/book-detail?slug=${ b . slug } ` } >
29
+ < a >
30
+ { b . name }
31
+ </ a >
34
32
</ Link >
35
33
</ li >
36
- ) ) }
34
+ ) ) }
37
35
</ ul >
38
36
< br />
39
37
</ div >
40
38
</ div >
41
39
) ;
42
40
43
41
Index . propTypes = {
44
- books : PropTypes . arrayOf ( PropTypes . shape ( {
45
- name : PropTypes . string . isRequired ,
46
- slug : PropTypes . string . isRequired ,
47
- } ) ) . isRequired ,
42
+ books : PropTypes . arrayOf (
43
+ PropTypes . shape ( {
44
+ name : PropTypes . string . isRequired ,
45
+ slug : PropTypes . string . isRequired ,
46
+ } ) ,
47
+ ) . isRequired ,
48
48
} ;
49
49
50
50
class IndexWithData extends React . Component {
@@ -62,11 +62,7 @@ class IndexWithData extends React.Component {
62
62
}
63
63
64
64
render ( ) {
65
- return (
66
- < Index
67
- { ...this . state }
68
- />
69
- ) ;
65
+ return < Index { ...this . state } /> ;
70
66
}
71
67
}
72
68
Original file line number Diff line number Diff line change @@ -8,14 +8,9 @@ import notify from '../../lib/notifier';
8
8
9
9
import withLayout from '../../lib/withLayout' ;
10
10
import withAuth from '../../lib/withAuth' ;
11
- import {
12
- getBookList ,
13
- } from '../../lib/api/admin' ;
11
+ import { getBookList } from '../../lib/api/admin' ;
14
12
15
-
16
- const Index = ( {
17
- books,
18
- } ) => (
13
+ const Index = ( { books } ) => (
19
14
< div style = { { padding : '10px 45px' } } >
20
15
< div >
21
16
< h2 > Books</ h2 >
@@ -24,27 +19,26 @@ const Index = ({
24
19
</ Link >
25
20
< p />
26
21
< ul >
27
- { books . map ( b => (
22
+ { books . map ( ( b ) => (
28
23
< li key = { b . _id } >
29
- < Link
30
- as = { `/admin/book-detail/${ b . slug } ` }
31
- href = { `/admin/book-detail?slug=${ b . slug } ` }
32
- >
24
+ < Link as = { `/admin/book-detail/${ b . slug } ` } href = { `/admin/book-detail?slug=${ b . slug } ` } >
33
25
< a > { b . name } </ a >
34
26
</ Link >
35
27
</ li >
36
- ) ) }
28
+ ) ) }
37
29
</ ul >
38
30
< br />
39
31
</ div >
40
32
</ div >
41
33
) ;
42
34
43
35
Index . propTypes = {
44
- books : PropTypes . arrayOf ( PropTypes . shape ( {
45
- name : PropTypes . string . isRequired ,
46
- slug : PropTypes . string . isRequired ,
47
- } ) ) . isRequired ,
36
+ books : PropTypes . arrayOf (
37
+ PropTypes . shape ( {
38
+ name : PropTypes . string . isRequired ,
39
+ slug : PropTypes . string . isRequired ,
40
+ } ) ,
41
+ ) . isRequired ,
48
42
} ;
49
43
50
44
class IndexWithData extends React . Component {
@@ -62,11 +56,7 @@ class IndexWithData extends React.Component {
62
56
}
63
57
64
58
render ( ) {
65
- return (
66
- < Index
67
- { ...this . state }
68
- />
69
- ) ;
59
+ return < Index { ...this . state } /> ;
70
60
}
71
61
}
72
62
Original file line number Diff line number Diff line change @@ -10,10 +10,7 @@ import withLayout from '../../lib/withLayout';
10
10
import withAuth from '../../lib/withAuth' ;
11
11
import { getBookList } from '../../lib/api/admin' ;
12
12
13
-
14
- const Index = ( {
15
- books,
16
- } ) => (
13
+ const Index = ( { books } ) => (
17
14
< div style = { { padding : '10px 45px' } } >
18
15
< div >
19
16
< h2 > Books</ h2 >
@@ -22,27 +19,26 @@ const Index = ({
22
19
</ Link >
23
20
< p />
24
21
< ul >
25
- { books . map ( b => (
22
+ { books . map ( ( b ) => (
26
23
< li key = { b . _id } >
27
- < Link
28
- as = { `/admin/book-detail/${ b . slug } ` }
29
- href = { `/admin/book-detail?slug=${ b . slug } ` }
30
- >
24
+ < Link as = { `/admin/book-detail/${ b . slug } ` } href = { `/admin/book-detail?slug=${ b . slug } ` } >
31
25
< a > { b . name } </ a >
32
26
</ Link >
33
27
</ li >
34
- ) ) }
28
+ ) ) }
35
29
</ ul >
36
30
< br />
37
31
</ div >
38
32
</ div >
39
33
) ;
40
34
41
35
Index . propTypes = {
42
- books : PropTypes . arrayOf ( PropTypes . shape ( {
43
- name : PropTypes . string . isRequired ,
44
- slug : PropTypes . string . isRequired ,
45
- } ) ) . isRequired ,
36
+ books : PropTypes . arrayOf (
37
+ PropTypes . shape ( {
38
+ name : PropTypes . string . isRequired ,
39
+ slug : PropTypes . string . isRequired ,
40
+ } ) ,
41
+ ) . isRequired ,
46
42
} ;
47
43
48
44
class IndexWithData extends React . Component {
@@ -60,12 +56,8 @@ class IndexWithData extends React.Component {
60
56
}
61
57
62
58
render ( ) {
63
- return (
64
- < Index
65
- { ...this . state }
66
- />
67
- ) ;
59
+ return < Index { ...this . state } /> ;
68
60
}
69
61
}
70
62
71
- export default withAuth ( withLayout ( IndexWithData ) ) ;
63
+ export default withAuth ( withLayout ( IndexWithData ) , { adminRequired : true } ) ;
Original file line number Diff line number Diff line change @@ -8,14 +8,9 @@ import notify from '../../lib/notifier';
8
8
9
9
import withLayout from '../../lib/withLayout' ;
10
10
import withAuth from '../../lib/withAuth' ;
11
- import {
12
- getBookList ,
13
- } from '../../lib/api/admin' ;
11
+ import { getBookList } from '../../lib/api/admin' ;
14
12
15
-
16
- const Index = ( {
17
- books,
18
- } ) => (
13
+ const Index = ( { books } ) => (
19
14
< div style = { { padding : '10px 45px' } } >
20
15
< div >
21
16
< h2 > Books</ h2 >
@@ -24,27 +19,26 @@ const Index = ({
24
19
</ Link >
25
20
< p />
26
21
< ul >
27
- { books . map ( b => (
22
+ { books . map ( ( b ) => (
28
23
< li key = { b . _id } >
29
- < Link
30
- as = { `/admin/book-detail/${ b . slug } ` }
31
- href = { `/admin/book-detail?slug=${ b . slug } ` }
32
- >
24
+ < Link as = { `/admin/book-detail/${ b . slug } ` } href = { `/admin/book-detail?slug=${ b . slug } ` } >
33
25
< a > { b . name } </ a >
34
26
</ Link >
35
27
</ li >
36
- ) ) }
28
+ ) ) }
37
29
</ ul >
38
30
< br />
39
31
</ div >
40
32
</ div >
41
33
) ;
42
34
43
35
Index . propTypes = {
44
- books : PropTypes . arrayOf ( PropTypes . shape ( {
45
- name : PropTypes . string . isRequired ,
46
- slug : PropTypes . string . isRequired ,
47
- } ) ) . isRequired ,
36
+ books : PropTypes . arrayOf (
37
+ PropTypes . shape ( {
38
+ name : PropTypes . string . isRequired ,
39
+ slug : PropTypes . string . isRequired ,
40
+ } ) ,
41
+ ) . isRequired ,
48
42
} ;
49
43
50
44
class IndexWithData extends React . Component {
@@ -62,11 +56,7 @@ class IndexWithData extends React.Component {
62
56
}
63
57
64
58
render ( ) {
65
- return (
66
- < Index
67
- { ...this . state }
68
- />
69
- ) ;
59
+ return < Index { ...this . state } /> ;
70
60
}
71
61
}
72
62
Original file line number Diff line number Diff line change @@ -8,14 +8,9 @@ import notify from '../../lib/notifier';
8
8
9
9
import withLayout from '../../lib/withLayout' ;
10
10
import withAuth from '../../lib/withAuth' ;
11
- import {
12
- getBookList ,
13
- } from '../../lib/api/admin' ;
11
+ import { getBookList } from '../../lib/api/admin' ;
14
12
15
-
16
- const Index = ( {
17
- books,
18
- } ) => (
13
+ const Index = ( { books } ) => (
19
14
< div style = { { padding : '10px 45px' } } >
20
15
< div >
21
16
< h2 > Books</ h2 >
@@ -24,27 +19,26 @@ const Index = ({
24
19
</ Link >
25
20
< p />
26
21
< ul >
27
- { books . map ( b => (
22
+ { books . map ( ( b ) => (
28
23
< li key = { b . _id } >
29
- < Link
30
- as = { `/admin/book-detail/${ b . slug } ` }
31
- href = { `/admin/book-detail?slug=${ b . slug } ` }
32
- >
24
+ < Link as = { `/admin/book-detail/${ b . slug } ` } href = { `/admin/book-detail?slug=${ b . slug } ` } >
33
25
< a > { b . name } </ a >
34
26
</ Link >
35
27
</ li >
36
- ) ) }
28
+ ) ) }
37
29
</ ul >
38
30
< br />
39
31
</ div >
40
32
</ div >
41
33
) ;
42
34
43
35
Index . propTypes = {
44
- books : PropTypes . arrayOf ( PropTypes . shape ( {
45
- name : PropTypes . string . isRequired ,
46
- slug : PropTypes . string . isRequired ,
47
- } ) ) . isRequired ,
36
+ books : PropTypes . arrayOf (
37
+ PropTypes . shape ( {
38
+ name : PropTypes . string . isRequired ,
39
+ slug : PropTypes . string . isRequired ,
40
+ } ) ,
41
+ ) . isRequired ,
48
42
} ;
49
43
50
44
class IndexWithData extends React . Component {
@@ -62,11 +56,7 @@ class IndexWithData extends React.Component {
62
56
}
63
57
64
58
render ( ) {
65
- return (
66
- < Index
67
- { ...this . state }
68
- />
69
- ) ;
59
+ return < Index { ...this . state } /> ;
70
60
}
71
61
}
72
62
Original file line number Diff line number Diff line change @@ -5,32 +5,28 @@ import Head from 'next/head';
5
5
import withAuth from '../lib/withAuth' ;
6
6
import withLayout from '../lib/withLayout' ;
7
7
8
-
9
8
class Index extends React . Component {
10
9
static propTypes = {
11
10
user : PropTypes . shape ( {
12
11
displayName : PropTypes . string ,
13
12
email : PropTypes . string . isRequired ,
14
13
} ) ,
15
- }
14
+ } ;
16
15
17
16
static defaultProps = {
18
17
user : null ,
19
- }
18
+ } ;
20
19
21
20
render ( ) {
22
21
const { user } = this . props ;
23
22
return (
24
23
< div style = { { padding : '10px 45px' } } >
25
24
< Head >
26
25
< title > Settings</ title >
27
- < meta
28
- name = "description"
29
- content = "List of purchased books."
30
- />
26
+ < meta name = "description" content = "List of purchased books." />
31
27
</ Head >
32
28
< p > List of purchased books</ p >
33
- < p > Email: { user . email } </ p >
29
+ < p > Email: { user . email } </ p >
34
30
</ div >
35
31
) ;
36
32
}
You can’t perform that action at this time.
0 commit comments