mirror of
https://github.com/logto-io/logto.git
synced 2025-03-31 22:51:25 -05:00
fix(console): fix wrong illustration status (#4976)
This commit is contained in:
parent
5e695c2dd6
commit
2ede63c446
2 changed files with 16 additions and 5 deletions
|
@ -13,15 +13,22 @@ type Props = {
|
|||
data: Pick<SsoConnectorWithProviderConfig, 'providerLogo' | 'providerLogoDark' | 'branding'>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Prioritize `branding` configuration:
|
||||
* - Even if it's in light mode and have `branding.darkLogo` configured, use `branding.darkLogo`.
|
||||
*/
|
||||
const pickLogoForCurrentTheme = (
|
||||
isDarkMode: boolean,
|
||||
{ logo, logoDark }: { logo: string; logoDark: string },
|
||||
branding: SsoConnectorWithProviderConfig['branding']
|
||||
): string => {
|
||||
if (isDarkMode) {
|
||||
return branding.darkLogo ?? logoDark;
|
||||
}
|
||||
return branding.logo ?? logo;
|
||||
// Need to use `||` here since `??` operator can not avoid empty strings.
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
const configuredLogo = isDarkMode ? branding.darkLogo : branding.logo || branding.darkLogo;
|
||||
const builtInLogo = isDarkMode ? logoDark : logo || logoDark;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
return configuredLogo || builtInLogo;
|
||||
};
|
||||
|
||||
function SsoConnectorLogo({ className, containerClassName, data }: Props) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
} from '@logto/schemas';
|
||||
import { generateStandardShortId } from '@logto/shared/universal';
|
||||
import { conditional, conditionalArray, conditionalString } from '@silverhand/essentials';
|
||||
import cleanDeep from 'clean-deep';
|
||||
import { t as globalTranslate } from 'i18next';
|
||||
import { HTTPError } from 'ky';
|
||||
import { useForm, Controller, FormProvider } from 'react-hook-form';
|
||||
|
@ -107,7 +108,10 @@ function Settings({ data, isDeleted, onUpdated }: Props) {
|
|||
|
||||
try {
|
||||
const updatedSsoConnector = await api
|
||||
.patch(`api/sso-connectors/${data.id}`, { json: formDataToSsoConnectorParser(formData) })
|
||||
// Only keep non-empty values since PATCH operation performs a merge scheme.
|
||||
.patch(`api/sso-connectors/${data.id}`, {
|
||||
json: cleanDeep(formDataToSsoConnectorParser(formData)),
|
||||
})
|
||||
.json<SsoConnectorWithProviderConfig>();
|
||||
|
||||
reset(dataToFormParser(updatedSsoConnector));
|
||||
|
|
Loading…
Add table
Reference in a new issue