@@ -2,118 +2,32 @@ import React from 'react';
22import PropTypes from 'prop-types' ;
33import remark from 'remark' ;
44import remarkReact from 'remark-react' ;
5- import { t } from 'i18next' ;
65import classnames from 'classnames' ;
7- import config from '../config' ;
86
9- class Dashboard extends React . Component {
10- _renderMenu ( ) {
11- let exportRepoButton ;
12-
13- if ( this . props . isExperimental && this . props . currentUser . authenticated ) {
14- exportRepoButton = (
15- < div
16- className = "dashboard__menu-item dashboard__menu-item_grid"
17- onClick = { this . props . onExportRepo }
18- >
19- { t ( 'dashboard.menu.export-repo' ) }
20- </ div >
21- ) ;
22- }
23-
24- return (
25- < div className = "dashboard__menu dashboard__menu_grid" >
26- < div
27- className = {
28- classnames (
29- 'dashboard__menu-item' ,
30- 'dashboard__menu-item_grid' ,
31- {
32- 'dashboard__menu-item_spinner' :
33- this . props . gistExportInProgress ,
34- } ,
35- )
36- }
37- onClick = { this . props . onExportGist }
38- >
39- { t ( 'dashboard.menu.export-gist' ) }
40- </ div >
41- < a
42- className = "dashboard__menu-item dashboard__menu-item_grid"
43- href = { config . feedbackUrl }
44- rel = "noopener noreferrer"
45- target = "_blank"
46- >
47- { t ( 'dashboard.menu.send-feedback' ) }
48- </ a >
49- { exportRepoButton }
50- </ div >
51- ) ;
7+ function Dashboard ( { instructions, isOpen} ) {
8+ if ( ! isOpen ) {
9+ return null ;
5210 }
5311
54- _renderLinks ( ) {
55- return (
56- < div className = "dashboard__links" >
57- < a
58- className = "dashboard__link u__icon"
59- href = "https://github.com/popcodeorg/popcode"
60- rel = "noopener noreferrer"
61- target = "_blank"
62- > </ a >
63- < a
64- className = "dashboard__link u__icon"
65- href = "https://twitter.com/popcodeorg"
66- rel = "noopener noreferrer"
67- target = "_blank"
68- > </ a >
69- < a
70- className = "dashboard__link u__icon"
71- href = "https://slack.popcode.org/"
72- rel = "noopener noreferrer"
73- target = "_blank"
74- > </ a >
12+ const sidebarClassnames = classnames (
13+ 'layout__dashboard' ,
14+ 'dashboard' ,
15+ 'u__flex-container' ,
16+ 'u__flex-container_column' ,
17+ ) ;
18+
19+ return (
20+ < div className = { sidebarClassnames } >
21+ < div className = "dashboard__instructions" >
22+ { remark ( ) . use ( remarkReact ) . processSync ( instructions ) . contents }
7523 </ div >
76- ) ;
77- }
78-
79- render ( ) {
80- const { instructions, isOpen} = this . props ;
81- if ( ! isOpen ) {
82- return null ;
83- }
84-
85- const sidebarClassnames = classnames (
86- 'layout__dashboard' ,
87- 'dashboard' ,
88- 'u__flex-container' ,
89- 'u__flex-container_column' ,
90- ) ;
91-
92- return (
93- < div className = { sidebarClassnames } >
94- { this . _renderMenu ( ) }
95- < div className = "dashboard__instructions" >
96- { remark ( ) . use ( remarkReact ) . processSync ( instructions ) . contents }
97- </ div >
98- < div className = "dashboard__spacer" />
99- { this . _renderLinks ( ) }
100- </ div >
101- ) ;
102- }
24+ </ div >
25+ ) ;
10326}
10427
10528Dashboard . propTypes = {
106- currentUser : PropTypes . object . isRequired ,
107- gistExportInProgress : PropTypes . bool . isRequired ,
10829 instructions : PropTypes . string . isRequired ,
109- isExperimental : PropTypes . bool . isRequired ,
11030 isOpen : PropTypes . bool . isRequired ,
111- onExportGist : PropTypes . func . isRequired ,
112- onExportRepo : PropTypes . func . isRequired ,
113- } ;
114-
115- Dashboard . defaultProps = {
116- currentProject : null ,
11731} ;
11832
11933export default Dashboard ;
0 commit comments