From bbd700270fb3def3ea2b527b8661f4b23dde773a Mon Sep 17 00:00:00 2001 From: Emmanuel Pelletier Date: Tue, 3 Jun 2025 12:48:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(homepage)=20let=20people=20use=20a?= =?UTF-8?q?=20simple=20login=20button=20instead=20of=20proconnect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is done to have people self-hosting meet be able to show a simple "login" button instead of having the ProConnect branding --- docs/installation.md | 1 + env.d/development/common.dist | 1 + src/backend/meet/settings.py | 3 +++ src/frontend/src/api/useConfig.ts | 1 + src/frontend/src/components/LoginButton.tsx | 12 ++++++++++++ src/frontend/src/components/ProConnectButton.tsx | 2 +- src/frontend/src/features/home/routes/Home.tsx | 13 +++++++++++-- src/frontend/src/locales/en/global.json | 3 ++- 8 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 src/frontend/src/components/LoginButton.tsx diff --git a/docs/installation.md b/docs/installation.md index 9c70ace3..51cc7569 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -282,6 +282,7 @@ These are the environmental options available on meet backend. | FRONTEND_IS_SILENT_LOGIN_ENABLED | Enable silent login feature | true | | FRONTEND_FEEDBACK | Frontend feedback configuration | {} | | FRONTEND_USE_FRENCH_GOV_FOOTER | Show the French government footer in the homepage | false | +| FRONTEND_USE_PROCONNECT_BUTTON | Show a "Login with ProConnect" button in the homepage instead of a "Login" button | false | | DJANGO_EMAIL_BACKEND | Email backend library | django.core.mail.backends.smtp.EmailBackend | | DJANGO_EMAIL_HOST | Host of the email server | | | DJANGO_EMAIL_HOST_USER | User to connect to the email server | | diff --git a/env.d/development/common.dist b/env.d/development/common.dist index bf39a638..07b84ba3 100644 --- a/env.d/development/common.dist +++ b/env.d/development/common.dist @@ -59,3 +59,4 @@ SCREEN_RECORDING_BASE_URL=http://localhost:3000/recordings ROOM_TELEPHONY_ENABLED=True FRONTEND_USE_FRENCH_GOV_FOOTER=False +FRONTEND_USE_PROCONNECT_BUTTON=False diff --git a/src/backend/meet/settings.py b/src/backend/meet/settings.py index 9c340c56..fd96983e 100755 --- a/src/backend/meet/settings.py +++ b/src/backend/meet/settings.py @@ -327,6 +327,9 @@ class Base(Configuration): "use_french_gov_footer": values.BooleanValue( False, environ_name="FRONTEND_USE_FRENCH_GOV_FOOTER", environ_prefix=None ), + "use_proconnect_button": values.BooleanValue( + False, environ_name="FRONTEND_USE_PROCONNECT_BUTTON", environ_prefix=None + ), } # Mail diff --git a/src/frontend/src/api/useConfig.ts b/src/frontend/src/api/useConfig.ts index e6c21161..2274fa24 100644 --- a/src/frontend/src/api/useConfig.ts +++ b/src/frontend/src/api/useConfig.ts @@ -18,6 +18,7 @@ export interface ApiConfig { is_silent_login_enabled?: boolean custom_css_url?: string use_french_gov_footer?: boolean + use_proconnect_button?: boolean recording?: { is_enabled?: boolean available_modes?: RecordingMode[] diff --git a/src/frontend/src/components/LoginButton.tsx b/src/frontend/src/components/LoginButton.tsx new file mode 100644 index 00000000..70876d55 --- /dev/null +++ b/src/frontend/src/components/LoginButton.tsx @@ -0,0 +1,12 @@ +import { LinkButton } from '@/primitives' +import { authUrl } from '@/features/auth' +import { useTranslation } from 'react-i18next' + +export const LoginButton = () => { + const { t } = useTranslation('global', { keyPrefix: 'login' }) + return ( + + {t('buttonLabel')} + + ) +} diff --git a/src/frontend/src/components/ProConnectButton.tsx b/src/frontend/src/components/ProConnectButton.tsx index 2ad12f63..6a0d83fe 100644 --- a/src/frontend/src/components/ProConnectButton.tsx +++ b/src/frontend/src/components/ProConnectButton.tsx @@ -34,7 +34,7 @@ export const ProConnectButton = ({ hint = true }: ProConnectButtonProps) => { diff --git a/src/frontend/src/features/home/routes/Home.tsx b/src/frontend/src/features/home/routes/Home.tsx index 7ae473ab..64f5bfee 100644 --- a/src/frontend/src/features/home/routes/Home.tsx +++ b/src/frontend/src/features/home/routes/Home.tsx @@ -18,6 +18,8 @@ import { ReactNode, useState } from 'react' import { css } from '@/styled-system/css' import { menuRecipe } from '@/primitives/menuRecipe.ts' import { usePersistentUserChoices } from '@/features/rooms/livekit/hooks/usePersistentUserChoices' +import { useConfig } from '@/api/useConfig' +import { LoginButton } from '@/components/LoginButton' const Columns = ({ children }: { children?: ReactNode }) => { return ( @@ -155,6 +157,8 @@ export const Home = () => { const { mutateAsync: createRoom } = useCreateRoom() const [laterRoomId, setLaterRoomId] = useState(null) + const { data } = useConfig() + return ( @@ -210,14 +214,19 @@ export const Home = () => { - ) : ( + ) : data?.use_proconnect_button ? ( + ) : ( + )}