-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
368 additions
and
37 deletions.
There are no files selected for viewing
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,33 @@ | ||
--- | ||
"@logto/experience": minor | ||
"@logto/console": minor | ||
"@logto/core": minor | ||
"@logto/integration-tests": patch | ||
"@logto/phrases": patch | ||
"@logto/schemas": patch | ||
--- | ||
|
||
support organization logo and sign-in experience override | ||
|
||
Now it's able to set light and dark logos for organizations. You can upload the logos in the organization settings page. | ||
|
||
Also, it's possible to override the sign-in experience logo from an organization. Simply add the `organization_id` parameter to the authentication request. In most Logto SDKs, it can be done by using the `extraParams` field in the `signIn` method. | ||
|
||
For example, in the JavaScript SDK: | ||
|
||
```ts | ||
import LogtoClient from '@logto/client'; | ||
|
||
const logtoClient = new LogtoClient(/* your configuration */); | ||
|
||
logtoClient.signIn({ | ||
redirectUri: 'https://your-app.com/callback', | ||
extraParams: { | ||
organization_id: '<organization-id>' | ||
}, | ||
}); | ||
``` | ||
|
||
The value `<organization-id>` can be found in the organization settings page. | ||
|
||
If you could not find the `extraParams` field in the SDK you are using, please let us know. |
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,5 @@ | ||
--- | ||
"@logto/demo-app": minor | ||
--- | ||
|
||
support extra token params in dev panel |
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
72 changes: 72 additions & 0 deletions
72
packages/console/src/pages/OrganizationDetails/Settings/Branding.tsx
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,72 @@ | ||
import { Theme, themeToLogoKey } from '@logto/schemas'; | ||
import { Controller, type UseFormReturn } from 'react-hook-form'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import FormCard, { FormCardSkeleton } from '@/components/FormCard'; | ||
import FormField from '@/ds-components/FormField'; | ||
import TextInput from '@/ds-components/TextInput'; | ||
import ImageUploaderField from '@/ds-components/Uploader/ImageUploaderField'; | ||
import useUserAssetsService from '@/hooks/use-user-assets-service'; | ||
import { uriValidator } from '@/utils/validator'; | ||
|
||
import * as styles from './index.module.scss'; | ||
import { type FormData } from './utils'; | ||
|
||
type Props = { | ||
readonly form: UseFormReturn<FormData>; | ||
}; | ||
|
||
function Branding({ form }: Props) { | ||
const { isReady: isUserAssetsServiceReady, isLoading } = useUserAssetsService(); | ||
const { | ||
control, | ||
formState: { errors }, | ||
register, | ||
} = form; | ||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); | ||
|
||
if (isLoading) { | ||
return <FormCardSkeleton />; | ||
} | ||
|
||
return ( | ||
<FormCard | ||
title="organization_details.branding.title" | ||
description="organization_details.branding.description" | ||
> | ||
<div className={styles.branding}> | ||
{Object.values(Theme).map((theme) => ( | ||
<section key={theme}> | ||
<FormField title={`organization_details.branding.${theme}_logo`}> | ||
{isUserAssetsServiceReady ? ( | ||
<Controller | ||
control={control} | ||
name={`branding.${themeToLogoKey[theme]}`} | ||
render={({ field: { onChange, value, name } }) => ( | ||
<ImageUploaderField | ||
name={name} | ||
value={value ?? ''} | ||
actionDescription={t('organization_details.branding.logo_upload_description')} | ||
onChange={onChange} | ||
/> | ||
)} | ||
/> | ||
) : ( | ||
<TextInput | ||
{...register(`branding.${themeToLogoKey[theme]}`, { | ||
validate: (value?: string) => | ||
!value || uriValidator(value) || t('errors.invalid_uri_format'), | ||
})} | ||
error={errors.branding?.[themeToLogoKey[theme]]?.message} | ||
placeholder={t('sign_in_exp.branding.logo_image_url_placeholder')} | ||
/> | ||
)} | ||
</FormField> | ||
</section> | ||
))} | ||
</div> | ||
</FormCard> | ||
); | ||
} | ||
|
||
export default Branding; |
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
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
Oops, something went wrong.