From 2d43b019cb6cbf07cefb3d5b6d756311b81ea527 Mon Sep 17 00:00:00 2001 From: "Begerad, Stefan" Date: Mon, 15 May 2023 09:24:20 +0200 Subject: [PATCH] chore: refactor --- app/components/entities-map-comp.jsx | 13 +++++++++-- app/components/list.jsx | 13 +++++++++-- app/components/relations-map-comp.jsx | 10 ++++----- app/pages/home.jsx | 32 +++++++++++++++++---------- 4 files changed, 47 insertions(+), 21 deletions(-) diff --git a/app/components/entities-map-comp.jsx b/app/components/entities-map-comp.jsx index c8afe68..30b1b1f 100644 --- a/app/components/entities-map-comp.jsx +++ b/app/components/entities-map-comp.jsx @@ -5,14 +5,23 @@ import EntitiesMap from './map/entities-map'; //destructure props export default function EntitiesMapComp({entities}){ + if(entities.length>0){ return ( <> -

Map

-

Entity Map

+

Map

+

Entity Map

); + }else{ + return ( + <> +

Map

+

EntitiesMap loading...

+ + ); + } } EntitiesMapComp.propTypes = { entities: PropTypes.array diff --git a/app/components/list.jsx b/app/components/list.jsx index aee0d1b..c14e4b8 100644 --- a/app/components/list.jsx +++ b/app/components/list.jsx @@ -3,10 +3,11 @@ import PropTypes from 'prop-types'; //destructure props export default function List({entities}){ + if(entities.length>0){ return ( <> -

List

-

Entity List

+

List

+

Entity List

@@ -32,6 +33,14 @@ export default function List({entities}){
); + }else{ + return ( + <> +

List

+

List loading...

+ + ); + } } List.propTypes = { entities: PropTypes.array, diff --git a/app/components/relations-map-comp.jsx b/app/components/relations-map-comp.jsx index 83cd0e5..7bf1e95 100644 --- a/app/components/relations-map-comp.jsx +++ b/app/components/relations-map-comp.jsx @@ -21,16 +21,16 @@ export default function RelationsMapComp({entities,relations}){ if(rltns.length===0){ return ( <> -

Map

-

Relations Map

-

RelationsMapComp loading...

; +

Map

+

Relations Map

+

RelationsMap loading...

); }else{ return ( <> -

Map

-

Relations Map

+

Map

+

Relations Map

); diff --git a/app/pages/home.jsx b/app/pages/home.jsx index 2225c03..0e89391 100644 --- a/app/pages/home.jsx +++ b/app/pages/home.jsx @@ -41,16 +41,24 @@ export default function Home(){ fetchRelations(); },[]); - //return - return ( - <> -

Home

- - - - - ); + if(entities.length>0){ + return ( + <> +

Home

+ + + + + ); + }else{ + return ( + <> +

Home

+

Home loading...

+ + ); + } }