diff options
author | Anton Tananaev <anton@traccar.org> | 2023-05-19 07:35:54 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-05-19 07:35:54 -0700 |
commit | 7f978889b45672285da1e73461e67bc78e78e1bb (patch) | |
tree | 8122a810ca1da580e34ac99701e28b399e2f4a67 | |
parent | 03b6c9fe0eda8788480bd6ae675658769758c96d (diff) | |
download | trackermap-web-7f978889b45672285da1e73461e67bc78e78e1bb.tar.gz trackermap-web-7f978889b45672285da1e73461e67bc78e78e1bb.tar.bz2 trackermap-web-7f978889b45672285da1e73461e67bc78e78e1bb.zip |
Custom logo option
-rw-r--r-- | modern/src/common/attributes/useServerAttributes.js | 4 | ||||
-rw-r--r-- | modern/src/login/LogoImage.js | 12 | ||||
-rw-r--r-- | modern/src/resources/l10n/en.json | 1 |
3 files changed, 16 insertions, 1 deletions
diff --git a/modern/src/common/attributes/useServerAttributes.js b/modern/src/common/attributes/useServerAttributes.js index 76d5a157..e87d1d7e 100644 --- a/modern/src/common/attributes/useServerAttributes.js +++ b/modern/src/common/attributes/useServerAttributes.js @@ -9,6 +9,10 @@ export default (t) => useMemo(() => ({ name: t('serverDescription'), type: 'string', }, + logo: { + name: t('serverLogo'), + type: 'string', + }, colorPrimary: { name: t('serverColorPrimary'), type: 'string', diff --git a/modern/src/login/LogoImage.js b/modern/src/login/LogoImage.js index 1b78c80e..f8de13e2 100644 --- a/modern/src/login/LogoImage.js +++ b/modern/src/login/LogoImage.js @@ -1,4 +1,5 @@ import React from 'react'; +import { useSelector } from 'react-redux'; import { makeStyles } from '@mui/styles'; import { ReactComponent as Logo } from '../resources/images/logo.svg'; @@ -15,7 +16,16 @@ const useStyles = makeStyles(() => ({ const LogoImage = ({ color }) => { const classes = useStyles(); - return (<Logo className={classes.image} style={{ color }} />); + const imageFile = useSelector((state) => state.session.server.attributes?.logo); + + if (imageFile) { + return ( + <img className={classes.image} src={imageFile} alt="" /> + ); + } + return ( + <Logo className={classes.image} style={{ color }} /> + ); }; export default LogoImage; diff --git a/modern/src/resources/l10n/en.json b/modern/src/resources/l10n/en.json index fa14778b..8791c530 100644 --- a/modern/src/resources/l10n/en.json +++ b/modern/src/resources/l10n/en.json @@ -310,6 +310,7 @@ "serverDescription": "Server Description", "serverColorPrimary": "Color Primary", "serverColorSecondary": "Color Secondary", + "serverLogo": "Logo Image", "mapTitle": "Map", "mapActive": "Active Maps", "mapOverlay": "Map Overlay", |