Skip to content
Snippets Groups Projects
Commit c2db2382 authored by Sivert Kronen Hatteberg's avatar Sivert Kronen Hatteberg
Browse files

Merge appTheme and appInst into appInst

No need for two config variables. Use the appInst config to get the
correct theme.
parent 3a1be273
No related branches found
No related tags found
1 merge request!174Updated header and footer
Pipeline #101211 failed
...@@ -16,14 +16,9 @@ export const appTimezone: string = 'Europe/Oslo' ...@@ -16,14 +16,9 @@ export const appTimezone: string = 'Europe/Oslo'
export const appVersion: string = process.env.REACT_APP_VERSION as string export const appVersion: string = process.env.REACT_APP_VERSION as string
export const appName: string = process.env.REACT_APP_NAME as string export const appName: string = process.env.REACT_APP_NAME as string
/* Institution */ /* Institution (used for features and theming */
export const appInst: string = env.REACT_APP_INST as string export const appInst: string = env.REACT_APP_INST as string
/* Theming */
export const appTheme: string = env.REACT_APP_THEME
? (env.REACT_APP_THEME as string)
: 'default'
/* Show warning in the footer about this being a staging/test system */ /* Show warning in the footer about this being a staging/test system */
export const appStagingWarning: boolean = export const appStagingWarning: boolean =
env.REACT_APP_STAGING_WARNING === 'true' env.REACT_APP_STAGING_WARNING === 'true'
......
import React, { useState } from 'react' import { useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import CheckIcon from '@mui/icons-material/Check' import CheckIcon from '@mui/icons-material/Check'
...@@ -15,7 +15,7 @@ import { ...@@ -15,7 +15,7 @@ import {
Divider, Divider,
} from '@mui/material' } from '@mui/material'
import { appTheme, appTimezone, appVersion, appInst } from 'appConfig' import { appInst, appTimezone, appVersion, appInst } from 'appConfig'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
const Yes = () => <CheckIcon color="success" /> const Yes = () => <CheckIcon color="success" />
...@@ -139,7 +139,7 @@ export const Debug = () => { ...@@ -139,7 +139,7 @@ export const Debug = () => {
['Version', appVersion], ['Version', appVersion],
['Timezone', appTimezone], ['Timezone', appTimezone],
['Language', i18n.language], ['Language', i18n.language],
['Theme', appTheme], ['Theme', appInst],
['Institution', appInst], ['Institution', appInst],
['API reachable?', apiHealth === 'yes' ? <Yes /> : apiHealth], ['API reachable?', apiHealth === 'yes' ? <Yes /> : apiHealth],
['Authenticated?', isAuthenticated ? <Yes /> : <No />], ['Authenticated?', isAuthenticated ? <Yes /> : <No />],
......
import React from 'react' import { appInst } from 'appConfig'
import { appTheme } from 'appConfig'
import UiOLogoBar from './UiO' import UiOLogoBar from './UiO'
import UiBLogoBar from './UiB' import UiBLogoBar from './UiB'
function LogoBar() { function LogoBar() {
switch (appTheme) { switch (appInst) {
case 'uio': case 'uio':
return <UiOLogoBar /> return <UiOLogoBar />
case 'uib': case 'uib':
...@@ -15,4 +13,4 @@ function LogoBar() { ...@@ -15,4 +13,4 @@ function LogoBar() {
} }
} }
export default LogoBar export default LogoBar
\ No newline at end of file
...@@ -5,7 +5,7 @@ import uibTheme from 'themes/uib' ...@@ -5,7 +5,7 @@ import uibTheme from 'themes/uib'
import uioTheme from 'themes/uio' import uioTheme from 'themes/uio'
import mainTheme from 'themes/main' import mainTheme from 'themes/main'
import { appTheme } from 'appConfig' import { appInst } from 'appConfig'
declare module '@mui/material/styles' { declare module '@mui/material/styles' {
interface Theme { interface Theme {
...@@ -33,13 +33,11 @@ declare module '@mui/material/styles' { ...@@ -33,13 +33,11 @@ declare module '@mui/material/styles' {
export const defaultTheme = createTheme(mainTheme) export const defaultTheme = createTheme(mainTheme)
function getTheme() { function getTheme() {
switch (appTheme) { switch (appInst) {
case 'uib': case 'uib':
return createTheme(deepmerge(mainTheme, uibTheme)) return createTheme(deepmerge(mainTheme, uibTheme))
case 'uio': case 'uio':
return createTheme(deepmerge(mainTheme, uioTheme)) return createTheme(deepmerge(mainTheme, uioTheme))
case 'default':
return defaultTheme
default: default:
return defaultTheme return defaultTheme
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment