11import React from "react" ;
22import { connect } from "react-redux" ;
33
4+
45import {
56 BasicTitle ,
67 ProjectTitle ,
@@ -19,7 +20,7 @@ const Heading = ({
1920 headingParams,
2021 streamgraph,
2122 q_advanced,
22- // customTitle ,
23+ service ,
2324 } ) => {
2425 if ( zoomed ) {
2526 const label = streamgraph
@@ -41,13 +42,11 @@ const Heading = ({
4142
4243 let queryString = queryConcatenator ( [ query , q_advanced ] )
4344
44- // console.log("customTitle", headingParams.customTitle)
45-
4645 return (
4746 // html template starts here
4847 < div className = "heading-container" >
4948 < h4 className = "heading" >
50- { renderTitle ( localization , queryString , headingParams ) }
49+ { renderTitle ( localization , queryString , headingParams , service ) }
5150 </ h4 >
5251 </ div >
5352 // html template ends here
@@ -62,10 +61,11 @@ const mapStateToProps = (state) => ({
6261 headingParams : state . heading ,
6362 streamgraph : state . chartType === STREAMGRAPH_MODE ,
6463 q_advanced : state . q_advanced . text ,
65- // context: state,
66- // customTitle : state.heading.customTitle ,
64+ // get source BASE or PubMed
65+ service : state . contextLine . dataSource ,
6766} ) ;
6867
68+
6969export default connect ( mapStateToProps ) ( Heading ) ;
7070
7171// This should probably make its way to a more global config
@@ -75,7 +75,8 @@ const MAX_LENGTH_CUSTOM = 100;
7575/**
7676 * Renders the title for the correct setup.
7777 */
78- const renderTitle = ( localization , query , headingParams ) => {
78+ const renderTitle = ( localization , query , headingParams , service ) => {
79+
7980 if ( headingParams . presetTitle ) {
8081 return < BasicTitle title = { headingParams . presetTitle } /> ;
8182 }
@@ -104,10 +105,18 @@ const renderTitle = (localization, query, headingParams) => {
104105 ) ;
105106 }
106107
108+ // this condition for BASE service and custom title if its value exists in config params
109+ if ( service === "BASE" ) {
110+ if ( headingParams . customTitle ) {
111+ return < StandardTitle label = { label } title = { headingParams . customTitle } /> ;
112+ }
113+ }
114+
107115 return < StandardTitle label = { label } title = { query } /> ;
108116 }
109117
110- return < BasicTitle title = { localization . default_title } /> ;
118+
119+ return < BasicTitle title = { localization . default_title } /> ;
111120} ;
112121
113122const renderViperTitle = ( title , acronym , projectId ) => {
0 commit comments