chore: refactor

This commit is contained in:
dancingCycle 2023-05-15 09:24:20 +02:00
parent 6f0ad8721e
commit 2d43b019cb
4 changed files with 47 additions and 21 deletions

View File

@ -5,14 +5,23 @@ import EntitiesMap from './map/entities-map';
//destructure props //destructure props
export default function EntitiesMapComp({entities}){ export default function EntitiesMapComp({entities}){
if(entities.length>0){
return ( return (
<> <>
<h2>Map</h2> <h1>Map</h1>
<h3>Entity Map</h3> <h2>Entity Map</h2>
<EntitiesMap entities={entities}/> <EntitiesMap entities={entities}/>
</> </>
); );
}else{
return (
<>
<h1>Map</h1>
<p>EntitiesMap loading...</p>
</>
);
}
} }
EntitiesMapComp.propTypes = { EntitiesMapComp.propTypes = {
entities: PropTypes.array entities: PropTypes.array

View File

@ -3,10 +3,11 @@ import PropTypes from 'prop-types';
//destructure props //destructure props
export default function List({entities}){ export default function List({entities}){
if(entities.length>0){
return ( return (
<> <>
<h2>List</h2> <h1>List</h1>
<h3>Entity List</h3> <h2>Entity List</h2>
<table> <table>
<thead> <thead>
<tr> <tr>
@ -32,6 +33,14 @@ export default function List({entities}){
</table> </table>
</> </>
); );
}else{
return (
<>
<h1>List</h1>
<p>List loading...</p>
</>
);
}
} }
List.propTypes = { List.propTypes = {
entities: PropTypes.array, entities: PropTypes.array,

View File

@ -21,16 +21,16 @@ export default function RelationsMapComp({entities,relations}){
if(rltns.length===0){ if(rltns.length===0){
return ( return (
<> <>
<h2>Map</h2> <h1>Map</h1>
<h3>Relations Map</h3> <h2>Relations Map</h2>
<p>RelationsMapComp loading...</p>; <p>RelationsMap loading...</p>
</> </>
); );
}else{ }else{
return ( return (
<> <>
<h2>Map</h2> <h1>Map</h1>
<h3>Relations Map</h3> <h2>Relations Map</h2>
<RelationsMap relations={rltns}/> <RelationsMap relations={rltns}/>
</> </>
); );

View File

@ -41,16 +41,24 @@ export default function Home(){
fetchRelations(); fetchRelations();
},[]); },[]);
//return if(entities.length>0){
return ( return (
<> <>
<h1>Home</h1> <h1>Home</h1>
<List entities={entities} /> <List entities={entities} />
<EntitiesMap entities={entities} /> <EntitiesMap entities={entities} />
<RelationsMap <RelationsMap
entities={entities} entities={entities}
relations={relations} relations={relations}
/> />
</> </>
); );
}else{
return (
<>
<h1>Home</h1>
<p>Home loading...</p>
</>
);
}
} }