11// @ts -nocheck
22
33import React from "react" ;
4- import { connect } from "react-redux" ;
54import { Modal } from "react-bootstrap" ;
5+ import { connect } from "react-redux" ;
66
7- import { closeInfoModal } from "../../actions" ;
8- import { STREAMGRAPH_MODE } from "../../reducers/chartType" ;
7+ import { useVisualizationType } from "@/hooks" ;
98
9+ import { closeInfoModal } from "../../actions" ;
1010import BaseInfo from "./infomodal/BaseInfo" ;
1111import CovisInfo from "./infomodal/CovisInfo" ;
1212import DefaultKMInfo from "./infomodal/DefaultKMInfo" ;
1313import DefaultSGInfo from "./infomodal/DefaultSGInfo" ;
14+ import OpenAireInfo from "./infomodal/OpenAireInfo" ;
15+ import OrcidInfo from "./infomodal/OrcidInfo" ;
1416import PubMedInfo from "./infomodal/PubMedInfo" ;
1517import TripleKMInfo from "./infomodal/TripleKMInfo" ;
1618import TripleSGInfo from "./infomodal/TripleSGInfo" ;
1719import ViperInfo from "./infomodal/ViperInfo" ;
18- import OpenAireInfo from "./infomodal/OpenAireInfo" ;
19- import OrcidInfo from "./infomodal/OrcidInfo" ;
2020
21+ const getInfoTemplate = (
22+ service : string ,
23+ isStreamgraph : boolean ,
24+ modalType : string ,
25+ isGeomap : boolean ,
26+ ) => {
27+ if ( isGeomap ) {
28+ return BaseInfo ;
29+ }
2130
22- const getInfoTemplate = ( service : string , isStreamgraph : boolean , modalType : string ) => {
2331 switch ( service ) {
2432 case "base" :
2533 return BaseInfo ;
2634 case "pubmed" :
2735 return PubMedInfo ;
2836 case "openaire" :
29- if ( modalType && modalType === ' openaire' ) {
37+ if ( modalType && modalType === " openaire" ) {
3038 return OpenAireInfo ;
31- } else if ( modalType && modalType === 'viper' ) {
39+ }
40+ if ( modalType && modalType === "viper" ) {
3241 return ViperInfo ;
3342 }
3443 return OpenAireInfo ;
@@ -45,19 +54,25 @@ const getInfoTemplate = (service: string, isStreamgraph: boolean, modalType: str
4554 }
4655} ;
4756
48- const InfoModal = ( { open, onClose, params, service, isStreamgraph, modalInfoType} ) => {
49- const InfoTemplate = getInfoTemplate ( service , isStreamgraph , modalInfoType ) ;
57+ const InfoModal = ( { open, onClose, params, service, modalInfoType } ) => {
58+ const { isStreamgraph, isGeoMap } = useVisualizationType ( ) ;
59+
60+ const InfoTemplate = getInfoTemplate (
61+ service ,
62+ isStreamgraph ,
63+ modalInfoType ,
64+ isGeoMap ,
65+ ) ;
5066
5167 return (
52- // html template starts here
53- < Modal id = "info_modal" show = { open } onHide = { onClose } animation >
54- < InfoTemplate params = { params } isStreamgraph = { isStreamgraph } />
55- </ Modal >
56- // html template ends here
68+ // html template starts here
69+ < Modal id = "info_modal" show = { open } onHide = { onClose } animation >
70+ < InfoTemplate params = { params } isStreamgraph = { isStreamgraph } />
71+ </ Modal >
72+ // html template ends here
5773 ) ;
5874} ;
5975
60-
6176const mapStateToProps = ( state ) => ( {
6277 open : state . modals . openInfoModal ,
6378 params : {
@@ -68,9 +83,8 @@ const mapStateToProps = (state) => ({
6883 author : state . author ,
6984 } ,
7085 service : state . isCovis ? "covis" : state . service ,
71- isStreamgraph : state . chartType === STREAMGRAPH_MODE ,
7286 // new parameter from config to render correct type of info modal window
73- modalInfoType : state . modalInfoType
87+ modalInfoType : state . modalInfoType ,
7488} ) ;
7589
7690const mapDispatchToProps = ( dispatch ) => ( {
0 commit comments