-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(whitelabel): use favicon loaded from configs as default for noti…
…fications * fix(whitelabel): load favicon and title also when request fails - Set defaults for favicon and title on store. - Create hook and getters for favicon, title and logo. - Create a component for the logo which can be reused in different points of the project. - Cleanup unused assets and move svgs inside assets folder. - Prepare splash view to use dynamic logo component. - Use png for the favicon in order to make it usable also for the notification system. - Set favicon and title on the document even if the request fails, defaults will be used in case. - Improve typing of svg assets module * fix: relative path for favicon * feat(whitelabel): use favicon loaded from configs as default for notifications refs: SHELL-61 (#220)
- Loading branch information
Showing
16 changed files
with
144 additions
and
358 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file not shown.
File renamed without changes
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com> | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
import React from 'react'; | ||
import { useLogo } from '../store/login/hooks'; | ||
import { useLoginConfigStore } from '../store/login/store'; | ||
|
||
export const Logo = (props: Record<string, unknown>): JSX.Element => { | ||
const { loaded } = useLoginConfigStore(); | ||
const LogoElement = useLogo(); | ||
|
||
return loaded ? ( | ||
(typeof LogoElement === 'string' && <img alt={''} {...props} src={LogoElement} />) || ( | ||
<LogoElement {...props} /> | ||
) | ||
) : ( | ||
<></> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com> | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
import { useLoginConfigStore } from './store'; | ||
|
||
export function getFavicon(): string { | ||
return useLoginConfigStore.getState().carbonioWebUiFavicon; | ||
} | ||
|
||
export function getClientTitle(): string { | ||
return useLoginConfigStore.getState().carbonioWebUiTitle; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com> | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
import React, { useMemo } from 'react'; | ||
import { useLoginConfigStore } from './store'; | ||
import { useDarkMode } from '../../dark-mode/use-dark-mode'; | ||
import DefaultLogo from '../../../assets/carbonio.svg'; | ||
|
||
export function useLogo(): string | React.ComponentType { | ||
const { carbonioWebUiAppLogo, carbonioWebUiDarkAppLogo } = useLoginConfigStore(); | ||
|
||
const { darkModeEnabled } = useDarkMode(); | ||
|
||
return useMemo(() => { | ||
if (darkModeEnabled) { | ||
return carbonioWebUiDarkAppLogo || carbonioWebUiAppLogo || DefaultLogo; | ||
} | ||
return carbonioWebUiAppLogo || carbonioWebUiDarkAppLogo || DefaultLogo; | ||
}, [carbonioWebUiDarkAppLogo, carbonioWebUiAppLogo, darkModeEnabled]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.