From 443f01263d1db728855e460ed1b815bd2089b1cf Mon Sep 17 00:00:00 2001
From: esikkala <esko.ikkala@aalto.fi>
Date: Mon, 3 Jan 2022 16:29:05 +0200
Subject: [PATCH] Adapt configs

---
 .../facet_results/ResultClassRoute.js         | 38 +++++++++----------
 src/client/components/main_layout/MuiIcon.js  |  6 ++-
 src/client/components/main_layout/TopBar.js   | 30 ++++++++++++---
 src/client/helpers/helpers.js                 |  4 ++
 4 files changed, 52 insertions(+), 26 deletions(-)

diff --git a/src/client/components/facet_results/ResultClassRoute.js b/src/client/components/facet_results/ResultClassRoute.js
index 10277ab8..5189d9a9 100644
--- a/src/client/components/facet_results/ResultClassRoute.js
+++ b/src/client/components/facet_results/ResultClassRoute.js
@@ -2,7 +2,7 @@ import React, { lazy } from 'react'
 import intl from 'react-intl-universal'
 import { Route } from 'react-router-dom'
 import { has } from 'lodash'
-import LineChartSotasurmat from '../perspectives/sotasurmat/LineChartSotasurmat'
+// import LineChartSotasurmat from '../perspectives/sotasurmat/LineChartSotasurmat'
 const ResultTable = lazy(() => import('./ResultTable'))
 const InstancePageTable = lazy(() => import('../main_layout/InstancePageTable'))
 const ReactVirtualizedList = lazy(() => import('./ReactVirtualizedList'))
@@ -316,24 +316,24 @@ const ResultClassRoute = props => {
       )
       break
     }
-    case 'LineChartSotasurmat': {
-      const lineChartProps = {
-        data: perspectiveState,
-        facetUpdateID: facetState.facetUpdateID,
-        fetchResults: props.fetchResults,
-        updatePage: props.updatePage,
-        routeProps: props.routeProps,
-        resultCount: perspectiveState.resultCount
-      }
-      routeComponent = (
-        <Route
-          path={path}
-          render={() =>
-            <LineChartSotasurmat {...lineChartProps} />}
-        />
-      )
-      break
-    }
+    // case 'LineChartSotasurmat': {
+    //   const lineChartProps = {
+    //     data: perspectiveState,
+    //     facetUpdateID: facetState.facetUpdateID,
+    //     fetchResults: props.fetchResults,
+    //     updatePage: props.updatePage,
+    //     routeProps: props.routeProps,
+    //     resultCount: perspectiveState.resultCount
+    //   }
+    //   routeComponent = (
+    //     <Route
+    //       path={path}
+    //       render={() =>
+    //         <LineChartSotasurmat {...lineChartProps} />}
+    //     />
+    //   )
+    //   break
+    // }
     case 'Network': {
       const { networkConfig } = props
       const {
diff --git a/src/client/components/main_layout/MuiIcon.js b/src/client/components/main_layout/MuiIcon.js
index be78abc8..552c629a 100644
--- a/src/client/components/main_layout/MuiIcon.js
+++ b/src/client/components/main_layout/MuiIcon.js
@@ -16,7 +16,8 @@ import {
   OndemandVideo,
   KeyboardVoice,
   Autorenew,
-  Add
+  Add,
+  PlayArrow
 } from '@material-ui/icons'
 import has from 'lodash'
 
@@ -38,7 +39,8 @@ const MuiIcon = props => {
     OndemandVideo: OndemandVideo,
     KeyboardVoice: KeyboardVoice,
     Autorenew: Autorenew,
-    Add: Add
+    Add: Add,
+    PlayArrow: PlayArrow
   }
   if (has(MuiIcons, props.iconName)) {
     const MuiIconComponent = MuiIcons[props.iconName]
diff --git a/src/client/components/main_layout/TopBar.js b/src/client/components/main_layout/TopBar.js
index 02442ec0..37b128ee 100644
--- a/src/client/components/main_layout/TopBar.js
+++ b/src/client/components/main_layout/TopBar.js
@@ -71,9 +71,9 @@ const useStyles = makeStyles(theme => ({
     }
   }),
   mainLogo: props => ({
-    height: 23,
+    height: props.layoutConfig.topBar.logoImageReducedHeight || 23,
     [theme.breakpoints.up(props.layoutConfig.reducedHeightBreakpoint)]: {
-      height: 40
+      height: props.layoutConfig.topBar.logoImageHeight || 40
     },
     marginRight: theme.spacing(1)
   }),
@@ -101,6 +101,15 @@ const useStyles = makeStyles(theme => ({
       }
     })
   }),
+  logoSecondary: props => ({
+    height: 26,
+    [theme.breakpoints.up('sm')]: {
+      height: 32
+    },
+    [theme.breakpoints.up(props.layoutConfig.reducedHeightBreakpoint)]: {
+      height: 52
+    }
+  }),
   mobileMenuButton: {
     padding: 12
   }
@@ -295,10 +304,21 @@ const TopBar = props => {
                 src={topBar.logoImage}
                 alt={`${intl.get('appTitle.short')} logo`}
               />}
-            <Typography className={classes.mainLogoTypography} variant='h5'>
-              {props.xsScreen ? intl.get('appTitle.mobile') : intl.get('appTitle.short')}
-            </Typography>
+            {!topBar.hideLogoText &&
+              <Typography className={classes.mainLogoTypography} variant='h5'>
+                {props.xsScreen ? intl.get('appTitle.mobile') : intl.get('appTitle.short')}
+              </Typography>}
           </Button>
+          {topBar.logoImageSecondary &&
+            <a
+              href={topBar.logoImageSecondaryLink}
+              target='_blank'
+              rel='noopener noreferrer'
+            >
+              <Button>
+                <img className={classes.logoSecondary} src={topBar.logoImageSecondary} alt='logoSecondary' />
+              </Button>
+            </a>}
           {showSearchField &&
             <TopBarSearchField
               fetchFullTextResults={props.fetchFullTextResults}
diff --git a/src/client/helpers/helpers.js b/src/client/helpers/helpers.js
index e3780518..555a30b7 100644
--- a/src/client/helpers/helpers.js
+++ b/src/client/helpers/helpers.js
@@ -205,6 +205,10 @@ export const processPortalConfig = async portalConfig => {
     const { default: image } = await import(/* webpackMode: "eager" */ `../img/${layoutConfig.topBar.logoImage}`)
     layoutConfig.topBar.logoImage = image
   }
+  if (layoutConfig.topBar.logoImageSecondary) {
+    const { default: image } = await import(/* webpackMode: "eager" */ `../img/${layoutConfig.topBar.logoImageSecondary}`)
+    layoutConfig.topBar.logoImageSecondary = image
+  }
 }
 
 export const createPerspectiveConfig = async ({ portalID, searchPerspectives }) => {
-- 
GitLab