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';
88
99import withLayout from '../../lib/withLayout' ;
1010import withAuth from '../../lib/withAuth' ;
11- import {
12- getBookList ,
13- } from '../../lib/api/admin' ;
11+ import { getBookList } from '../../lib/api/admin' ;
1412
15-
16- const Index = ( {
17- books,
18- } ) => (
13+ const Index = ( { books } ) => (
1914 < div style = { { padding : '10px 45px' } } >
2015 < div >
21- < h2 > Books</ h2 >
16+ < h2 >
17+ Books
18+ </ h2 >
2219 < Link href = "/admin/add-book" >
23- < Button variant = "contained" > Add book</ Button >
20+ < Button variant = "contained" >
21+ Add book
22+ </ Button >
2423 </ Link >
2524 < p />
2625 < ul >
27- { books . map ( b => (
26+ { books . map ( ( b ) => (
2827 < 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 >
3432 </ Link >
3533 </ li >
36- ) ) }
34+ ) ) }
3735 </ ul >
3836 < br />
3937 </ div >
4038 </ div >
4139) ;
4240
4341Index . 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 ,
4848} ;
4949
5050class IndexWithData extends React . Component {
@@ -62,11 +62,7 @@ class IndexWithData extends React.Component {
6262 }
6363
6464 render ( ) {
65- return (
66- < Index
67- { ...this . state }
68- />
69- ) ;
65+ return < Index { ...this . state } /> ;
7066 }
7167}
7268
Original file line number Diff line number Diff line change @@ -8,14 +8,9 @@ import notify from '../../lib/notifier';
88
99import withLayout from '../../lib/withLayout' ;
1010import withAuth from '../../lib/withAuth' ;
11- import {
12- getBookList ,
13- } from '../../lib/api/admin' ;
11+ import { getBookList } from '../../lib/api/admin' ;
1412
15-
16- const Index = ( {
17- books,
18- } ) => (
13+ const Index = ( { books } ) => (
1914 < div style = { { padding : '10px 45px' } } >
2015 < div >
2116 < h2 > Books</ h2 >
@@ -24,27 +19,26 @@ const Index = ({
2419 </ Link >
2520 < p />
2621 < ul >
27- { books . map ( b => (
22+ { books . map ( ( b ) => (
2823 < 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 } ` } >
3325 < a > { b . name } </ a >
3426 </ Link >
3527 </ li >
36- ) ) }
28+ ) ) }
3729 </ ul >
3830 < br />
3931 </ div >
4032 </ div >
4133) ;
4234
4335Index . 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 ,
4842} ;
4943
5044class IndexWithData extends React . Component {
@@ -62,11 +56,7 @@ class IndexWithData extends React.Component {
6256 }
6357
6458 render ( ) {
65- return (
66- < Index
67- { ...this . state }
68- />
69- ) ;
59+ return < Index { ...this . state } /> ;
7060 }
7161}
7262
Original file line number Diff line number Diff line change @@ -10,10 +10,7 @@ import withLayout from '../../lib/withLayout';
1010import withAuth from '../../lib/withAuth' ;
1111import { getBookList } from '../../lib/api/admin' ;
1212
13-
14- const Index = ( {
15- books,
16- } ) => (
13+ const Index = ( { books } ) => (
1714 < div style = { { padding : '10px 45px' } } >
1815 < div >
1916 < h2 > Books</ h2 >
@@ -22,27 +19,26 @@ const Index = ({
2219 </ Link >
2320 < p />
2421 < ul >
25- { books . map ( b => (
22+ { books . map ( ( b ) => (
2623 < 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 } ` } >
3125 < a > { b . name } </ a >
3226 </ Link >
3327 </ li >
34- ) ) }
28+ ) ) }
3529 </ ul >
3630 < br />
3731 </ div >
3832 </ div >
3933) ;
4034
4135Index . 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 ,
4642} ;
4743
4844class IndexWithData extends React . Component {
@@ -60,12 +56,8 @@ class IndexWithData extends React.Component {
6056 }
6157
6258 render ( ) {
63- return (
64- < Index
65- { ...this . state }
66- />
67- ) ;
59+ return < Index { ...this . state } /> ;
6860 }
6961}
7062
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';
88
99import withLayout from '../../lib/withLayout' ;
1010import withAuth from '../../lib/withAuth' ;
11- import {
12- getBookList ,
13- } from '../../lib/api/admin' ;
11+ import { getBookList } from '../../lib/api/admin' ;
1412
15-
16- const Index = ( {
17- books,
18- } ) => (
13+ const Index = ( { books } ) => (
1914 < div style = { { padding : '10px 45px' } } >
2015 < div >
2116 < h2 > Books</ h2 >
@@ -24,27 +19,26 @@ const Index = ({
2419 </ Link >
2520 < p />
2621 < ul >
27- { books . map ( b => (
22+ { books . map ( ( b ) => (
2823 < 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 } ` } >
3325 < a > { b . name } </ a >
3426 </ Link >
3527 </ li >
36- ) ) }
28+ ) ) }
3729 </ ul >
3830 < br />
3931 </ div >
4032 </ div >
4133) ;
4234
4335Index . 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 ,
4842} ;
4943
5044class IndexWithData extends React . Component {
@@ -62,11 +56,7 @@ class IndexWithData extends React.Component {
6256 }
6357
6458 render ( ) {
65- return (
66- < Index
67- { ...this . state }
68- />
69- ) ;
59+ return < Index { ...this . state } /> ;
7060 }
7161}
7262
Original file line number Diff line number Diff line change @@ -8,14 +8,9 @@ import notify from '../../lib/notifier';
88
99import withLayout from '../../lib/withLayout' ;
1010import withAuth from '../../lib/withAuth' ;
11- import {
12- getBookList ,
13- } from '../../lib/api/admin' ;
11+ import { getBookList } from '../../lib/api/admin' ;
1412
15-
16- const Index = ( {
17- books,
18- } ) => (
13+ const Index = ( { books } ) => (
1914 < div style = { { padding : '10px 45px' } } >
2015 < div >
2116 < h2 > Books</ h2 >
@@ -24,27 +19,26 @@ const Index = ({
2419 </ Link >
2520 < p />
2621 < ul >
27- { books . map ( b => (
22+ { books . map ( ( b ) => (
2823 < 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 } ` } >
3325 < a > { b . name } </ a >
3426 </ Link >
3527 </ li >
36- ) ) }
28+ ) ) }
3729 </ ul >
3830 < br />
3931 </ div >
4032 </ div >
4133) ;
4234
4335Index . 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 ,
4842} ;
4943
5044class IndexWithData extends React . Component {
@@ -62,11 +56,7 @@ class IndexWithData extends React.Component {
6256 }
6357
6458 render ( ) {
65- return (
66- < Index
67- { ...this . state }
68- />
69- ) ;
59+ return < Index { ...this . state } /> ;
7060 }
7161}
7262
Original file line number Diff line number Diff line change @@ -5,32 +5,28 @@ import Head from 'next/head';
55import withAuth from '../lib/withAuth' ;
66import withLayout from '../lib/withLayout' ;
77
8-
98class Index extends React . Component {
109 static propTypes = {
1110 user : PropTypes . shape ( {
1211 displayName : PropTypes . string ,
1312 email : PropTypes . string . isRequired ,
1413 } ) ,
15- }
14+ } ;
1615
1716 static defaultProps = {
1817 user : null ,
19- }
18+ } ;
2019
2120 render ( ) {
2221 const { user } = this . props ;
2322 return (
2423 < div style = { { padding : '10px 45px' } } >
2524 < Head >
2625 < title > Settings</ title >
27- < meta
28- name = "description"
29- content = "List of purchased books."
30- />
26+ < meta name = "description" content = "List of purchased books." />
3127 </ Head >
3228 < p > List of purchased books</ p >
33- < p > Email: { user . email } </ p >
29+ < p > Email: { user . email } </ p >
3430 </ div >
3531 ) ;
3632 }
You can’t perform that action at this time.
0 commit comments