1
- import PropTypes from 'prop-types' ;
2
- import React , { useState , useEffect } from 'react' ;
1
+ import React , { useState } from 'react' ;
3
2
import { connect } from 'react-redux' ;
4
3
import MediaQuery from 'react-responsive' ;
5
4
import { withTranslation } from 'react-i18next' ;
5
+ import PropTypes from 'prop-types' ;
6
6
7
- import browserHistory from '../../../browserHistory' ;
8
7
import Button from '../../../common/Button' ;
9
8
import Nav from '../../IDE/components/Header/Nav' ;
10
9
import Overlay from '../../App/components/Overlay' ;
@@ -27,22 +26,10 @@ import DashboardTabSwitcherPublic, {
27
26
function DashboardView ( props ) {
28
27
const [ collectionCreateVisible , setCollectionCreateVisible ] = useState ( false ) ;
29
28
30
- useEffect ( ( ) => {
31
- // You can add any componentDidMount logic here if needed.
32
- } , [ ] ) ;
33
-
34
- const closeAccountPage = ( ) => {
35
- browserHistory . push ( props . previousPath ) ;
36
- } ;
37
-
38
29
const createNewSketch = ( ) => {
39
30
props . newProject ( ) ;
40
31
} ;
41
32
42
- const gotoHomePage = ( ) => {
43
- browserHistory . push ( '/' ) ;
44
- } ;
45
-
46
33
const selectedTabKey = ( ) => {
47
34
const path = props . location . pathname ;
48
35
@@ -63,9 +50,7 @@ function DashboardView(props) {
63
50
return props . user . username ;
64
51
} ;
65
52
66
- const isOwner = ( ) => {
67
- return props . user . username === props . params . username ;
68
- } ;
53
+ const isOwner = ( ) => props . user . username === props . params . username ;
69
54
70
55
const toggleCollectionCreate = ( ) => {
71
56
setCollectionCreateVisible ( ( prevState ) => ! prevState ) ;
@@ -111,7 +96,9 @@ function DashboardView(props) {
111
96
) ;
112
97
case TabKey . sketches :
113
98
default :
114
- return < SketchList key = { username } mobile = { mobile } username = { username } /> ;
99
+ return (
100
+ < SketchList key = { username } mobile = { mobile } username = { username } />
101
+ ) ;
115
102
}
116
103
} ;
117
104
@@ -168,6 +155,10 @@ const mapDispatchToProps = {
168
155
...ProjectActions
169
156
} ;
170
157
158
+ DashboardView . defaultProps = {
159
+ user : null // Provide an appropriate default value
160
+ } ;
161
+
171
162
DashboardView . propTypes = {
172
163
newProject : PropTypes . func . isRequired ,
173
164
location : PropTypes . shape ( {
@@ -176,7 +167,6 @@ DashboardView.propTypes = {
176
167
params : PropTypes . shape ( {
177
168
username : PropTypes . string . isRequired
178
169
} ) . isRequired ,
179
- previousPath : PropTypes . string . isRequired ,
180
170
user : PropTypes . shape ( {
181
171
username : PropTypes . string
182
172
} ) ,
0 commit comments