@@ -10,8 +10,7 @@ import Graph from './GraphArea';
1010const GraphComp = ( props ) => {
1111 const graphContainerRef = React . useRef ( ) ;
1212 const { dispatcher, superState } = props ;
13- const [ loadedFromStorage , setLoadedFromStorage ] = React . useState ( false ) ;
14- const [ loadedFromURL , setLoadedFromURL ] = React . useState ( false ) ;
13+ // const [loadedFromStorage, setLoadedFromStorage] = React.useState(false);
1514
1615 useEffect ( ( ) => {
1716 const allSavedGs = localStorageManager . getAllGraphs ( ) . map ( ( graphID ) => ( {
@@ -21,33 +20,33 @@ const GraphComp = (props) => {
2120 type : T . ADD_GRAPH_BULK ,
2221 payload : allSavedGs ,
2322 } ) ;
24- setLoadedFromStorage ( true ) ;
23+ // setLoadedFromStorage(true);
2524 } , [ ] ) ;
2625
27- useEffect ( ( ) => {
28- if ( ! loadedFromStorage ) return ;
29- const graphFromParams = Object . fromEntries ( new URLSearchParams ( window . location . search ) . entries ( ) ) . g ;
30- if ( graphFromParams ) {
31- const graphContent = JSON . parse ( window . atob ( graphFromParams ) ) ;
32- const gid = new Date ( ) . getTime ( ) . toString ( ) ;
33- localStorageManager . addToFront ( gid ) ;
34- localStorageManager . save ( gid , graphContent ) ;
35- window . history . replaceState ( { } , document . title , window . location . pathname ) ;
36- dispatcher ( { type : T . ADD_GRAPH , payload : { graphID : gid } } ) ;
37- }
38- const urlParms = window . location . pathname . split ( '/' ) ;
39- const serverIDIndex = urlParms . indexOf ( 's ') ;
40- const localIDIndex = urlParms . indexOf ( 'l ' ) ;
41- if ( serverIDIndex !== - 1 && serverIDIndex + 1 < urlParms . length ) {
42- const serverID = urlParms [ serverIDIndex + 1 ] ;
43- dispatcher ( { type : T . ADD_GRAPH , payload : { serverID } } ) ;
44- }
45- if ( localIDIndex !== - 1 && localIDIndex + 1 < urlParms . length ) {
46- const graphID = urlParms [ localIDIndex + 1 ] ;
47- dispatcher ( { type : T . ADD_GRAPH , payload : { graphID } } ) ;
48- }
49- setLoadedFromURL ( true ) ;
50- } , [ loadedFromStorage ] ) ;
26+ // Remote server implementation - Not being used.
27+ // useEffect(() => {
28+ // if (!loadedFromStorage) return ;
29+ // const graphFromParams = Object.fromEntries(new URLSearchParams(window.location.search).entries()).g;
30+ // if ( graphFromParams) {
31+ // const graphContent = JSON.parse(window.atob(graphFromParams) );
32+ // const gid = new Date().getTime().toString( );
33+ // localStorageManager.addToFront (gid);
34+ // localStorageManager.save(gid, graphContent );
35+ // window.history.replaceState({}, document.title, window.location.pathname );
36+ // dispatcher({ type: T.ADD_GRAPH, payload: { graphID: gid } });
37+ // }
38+ // const urlParms = window.location.pathname.split('/ ');
39+ // const serverIDIndex = urlParms.indexOf('s ');
40+ // const localIDIndex = urlParms.indexOf('l');
41+ // if (serverIDIndex !== -1 && serverIDIndex + 1 < urlParms.length) {
42+ // const serverID = urlParms[serverIDIndex + 1] ;
43+ // dispatcher({ type: T.ADD_GRAPH, payload: { serverID } });
44+ // }
45+ // if (localIDIndex !== -1 && localIDIndex + 1 < urlParms.length) {
46+ // const graphID = urlParms[localIDIndex + 1] ;
47+ // dispatcher({ type: T.ADD_GRAPH, payload: { graphID } });
48+ // }
49+ // }, [loadedFromStorage]);
5150
5251 return (
5352 < div
@@ -73,7 +72,8 @@ const GraphComp = (props) => {
7372 serverID = { el . serverID }
7473 graphML = { el . graphML }
7574 projectName = { el . projectName }
76- loaded = { loadedFromURL }
75+ fileHandle = { el . fileHandle }
76+ fileName = { el . fileName }
7777 />
7878 ) ) }
7979 < ZoomComp dispatcher = { dispatcher } superState = { superState } />
0 commit comments