@@ -2,39 +2,30 @@ import * as React from "react";
2
2
import './App.css' ;
3
3
import { localize } from "./main" ;
4
4
import config from "./config" ;
5
- import { GraphPerson } from "./backend/graph" ;
6
5
import Header from "./components/Header" ;
7
6
import NavigationTutorial from "./components/NavigationTutorial" ;
8
7
import Notification from "./components/Notification" ;
9
- import FamilyPath from "./components/FamilyPath" ;
10
8
import Uploader from "./components/Uploader" ;
11
- import InfoPanel from "./components/InfoPanel" ;
12
9
import View from "./components/View" ;
13
10
import { graphModel , loadData } from "./backend/ModelGraph" ;
14
11
import { ReactNode } from "react" ;
15
12
16
13
interface State {
17
14
notifications : ReactNode [ ]
18
- focusId : string
19
- focusHidden : boolean
20
15
dataAvailable : boolean
21
16
}
22
17
23
18
class App extends React . Component < any , State > {
24
19
constructor ( props ) {
25
20
super ( props ) ;
26
-
27
- let url = new URL ( window . location . href ) ;
28
-
21
+ new URL ( window . location . href ) ;
29
22
let data = sessionStorage . getItem ( "familyData" ) ;
30
23
if ( data ) {
31
24
loadData ( JSON . parse ( data ) ) ;
32
25
}
33
26
34
27
this . state = {
35
28
notifications : [ ] ,
36
- focusId : url . searchParams . get ( "id" ) ,
37
- focusHidden : graphModel === undefined ,
38
29
dataAvailable : graphModel !== undefined
39
30
} ;
40
31
}
@@ -54,23 +45,11 @@ class App extends React.Component<any, State> {
54
45
) ;
55
46
}
56
47
57
- let focus ;
58
- if ( this . state . focusId ) {
59
- focus = graphModel . getPersonById ( this . state . focusId ) ;
60
- } else {
61
- focus = graphModel . persons [ 0 ] ;
62
- }
63
- if ( ! focus ) {
64
- throw new Error ( `No person with id ${ this . state . focusId } could be found` )
65
- }
66
-
67
48
return (
68
49
< >
69
50
< Header />
70
51
{ this . state . notifications }
71
- { ! this . state . focusHidden && < InfoPanel person = { focus } onRefocus = { this . onRefocus . bind ( this ) } /> }
72
- < View focus = { focus } onRefocus = { this . onRefocus . bind ( this ) } focusHidden = { this . state . focusHidden } />
73
- < FamilyPath focus = { focus } />
52
+ < View />
74
53
</ >
75
54
) ;
76
55
}
@@ -79,41 +58,12 @@ class App extends React.Component<any, State> {
79
58
sessionStorage . setItem ( "familyData" , fileContent ) ;
80
59
loadData ( JSON . parse ( fileContent ) ) ;
81
60
this . setState ( {
82
- dataAvailable : true ,
83
- focusHidden : false
84
- } ) ;
85
- }
86
-
87
- onRefocus ( newFocus : GraphPerson ) {
88
- if ( newFocus . data . getId ( ) === this . state . focusId ) {
89
- this . setState ( {
90
- focusHidden : ! this . state . focusHidden
91
- } )
92
- return ;
93
- }
94
- this . setState ( {
95
- focusHidden : false ,
96
- focusId : newFocus . data . getId ( )
61
+ dataAvailable : true
97
62
} ) ;
98
63
}
99
64
100
65
componentDidMount ( ) {
101
66
localize ( config . browserLang ) ;
102
- let root = document . querySelector < HTMLDivElement > ( "#root" ) ;
103
- if ( this . state . focusHidden ) {
104
- root . classList . add ( "sidebar-hidden" ) ;
105
- } else {
106
- root . classList . remove ( "sidebar-hidden" ) ;
107
- }
108
- }
109
-
110
- componentDidUpdate ( prevProps : Readonly < any > , prevState : Readonly < State > , snapshot ?: any ) {
111
- let root = document . querySelector < HTMLDivElement > ( "#root" ) ;
112
- if ( this . state . focusHidden ) {
113
- root . classList . add ( "sidebar-hidden" ) ;
114
- } else {
115
- root . classList . remove ( "sidebar-hidden" ) ;
116
- }
117
67
}
118
68
119
69
componentDidCatch ( error : Error , errorInfo : React . ErrorInfo ) {
0 commit comments