1- import { FC } from "react" ;
1+ import { FC , PropsWithChildren } from "react" ;
22import { Modal } from "react-bootstrap" ;
33
44import { queryConcatenator } from "@/js/utils/data" ;
@@ -20,29 +20,46 @@ export const StandardGeomapInfo: FC<StandardGeomapInfoProps> = ({ params }) => {
2020 const queryAfterConcatenate = queryConcatenator ( [ query , queryAdvanced ] ) ;
2121 const saveCustomTitle = customTitle && unescapeHTML ( customTitle ) ;
2222
23+ const hasQuery = queryAfterConcatenate . length > 0 ;
24+ const hasCustomTitle = Boolean ( saveCustomTitle ) ;
25+
2326 return (
2427 < >
2528 < Modal . Header closeButton >
2629 < Modal . Title id = "info-title" > What's this?</ Modal . Title >
2730 </ Modal . Header >
2831 < Modal . Body id = "info-body" >
29- { ( ! ! saveCustomTitle || ! ! query || ! ! queryAdvanced ) && (
30- < p >
31- This geo map presents you with an overview of{ " " }
32- < strong className = "hs-strong" >
33- { saveCustomTitle ? saveCustomTitle : queryAfterConcatenate }
34- </ strong >
35- </ p >
32+ { hasQuery && ! hasCustomTitle && (
33+ < OverviewParagraph > { queryAfterConcatenate } </ OverviewParagraph >
34+ ) }
35+ { ! hasQuery && hasCustomTitle && (
36+ < OverviewParagraph > { saveCustomTitle } </ OverviewParagraph >
37+ ) }
38+ { ! hasQuery && ! hasCustomTitle && (
39+ < OverviewParagraph > { null } </ OverviewParagraph >
3640 ) }
37- { ! ! saveCustomTitle && (
38- < p >
39- This map has a custom title and was created using the following
40- query:{ " " }
41- < strong className = "hs-strong" > { queryAfterConcatenate } </ strong >
42- </ p >
41+ { hasQuery && hasCustomTitle && (
42+ < >
43+ < OverviewParagraph > { saveCustomTitle } </ OverviewParagraph >
44+ < CustomTitleParagraph > { queryAfterConcatenate } </ CustomTitleParagraph >
45+ </ >
4346 ) }
4447 < AboutSoftware />
4548 </ Modal . Body >
4649 </ >
4750 ) ;
4851} ;
52+
53+ const OverviewParagraph : FC < PropsWithChildren > = ( { children } ) => (
54+ < p >
55+ This geo map presents you with an overview of{ " " }
56+ < strong className = "hs-strong" > { children } </ strong > .
57+ </ p >
58+ ) ;
59+
60+ const CustomTitleParagraph : FC < PropsWithChildren > = ( { children } ) => (
61+ < p >
62+ This map has a custom title and was created using the following query:{ " " }
63+ < strong className = "hs-strong" > { children } </ strong >
64+ </ p >
65+ ) ;
0 commit comments