From 260eab23be56c989c041052008be374bdb6fbb34 Mon Sep 17 00:00:00 2001 From: Emmanuel Pelletier Date: Tue, 3 Jun 2025 23:10:04 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84(proconnect)=20replace=20all=20proc?= =?UTF-8?q?onnect=20buttons=20when=20env=20is=20off?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The home button was already updated but I missed a few places where it was also used. --- src/frontend/src/components/LoginButton.tsx | 14 ++++++++++- .../src/components/ProConnectButton.tsx | 25 +++++++++---------- .../src/features/home/routes/Home.tsx | 5 +--- .../settings/components/SettingsDialog.tsx | 4 +-- .../settings/components/tabs/AccountTab.tsx | 4 +-- src/frontend/src/layout/Header.tsx | 4 +-- src/frontend/src/locales/de/global.json | 7 +++--- src/frontend/src/locales/en/global.json | 6 ++--- src/frontend/src/locales/fr/global.json | 7 +++--- src/frontend/src/locales/nl/global.json | 7 +++--- src/frontend/src/primitives/A.tsx | 3 +++ 11 files changed, 50 insertions(+), 36 deletions(-) diff --git a/src/frontend/src/components/LoginButton.tsx b/src/frontend/src/components/LoginButton.tsx index 70876d55..c597cc85 100644 --- a/src/frontend/src/components/LoginButton.tsx +++ b/src/frontend/src/components/LoginButton.tsx @@ -1,9 +1,21 @@ import { LinkButton } from '@/primitives' import { authUrl } from '@/features/auth' import { useTranslation } from 'react-i18next' +import { useConfig } from '@/api/useConfig' +import { ProConnectButton } from './ProConnectButton' -export const LoginButton = () => { +type LoginButtonProps = { + proConnectHint?: boolean // Hide hint in layouts where space doesn't allow it. +} + +export const LoginButton = ({ proConnectHint = true }: LoginButtonProps) => { const { t } = useTranslation('global', { keyPrefix: 'login' }) + const { data } = useConfig() + + if (data?.use_proconnect_button) { + return + } + return ( {t('buttonLabel')} diff --git a/src/frontend/src/components/ProConnectButton.tsx b/src/frontend/src/components/ProConnectButton.tsx index 6a0d83fe..f16a069c 100644 --- a/src/frontend/src/components/ProConnectButton.tsx +++ b/src/frontend/src/components/ProConnectButton.tsx @@ -1,9 +1,9 @@ -import { Link } from 'react-aria-components' +import { Link as RALink } from 'react-aria-components' import { authUrl } from '@/features/auth' import { cva } from '@/styled-system/css' import { useTranslation } from 'react-i18next' import { VStack } from '@/styled-system/jsx' -import { Text } from '@/primitives' +import { Link } from '@/primitives' // Styles per their documentation https://github.com/numerique-gouv/agentconnect-documentation/blob/main/doc_fs/bouton_proconnect.md const proConnectButtonRecipe = cva({ @@ -32,23 +32,22 @@ export const ProConnectButton = ({ hint = true }: ProConnectButtonProps) => { const { t } = useTranslation('global', { keyPrefix: 'login' }) return ( - {hint && ( - - - {t('link')} - - + + {t('proconnectLink')} + )} ) diff --git a/src/frontend/src/features/home/routes/Home.tsx b/src/frontend/src/features/home/routes/Home.tsx index 64f5bfee..861310bf 100644 --- a/src/frontend/src/features/home/routes/Home.tsx +++ b/src/frontend/src/features/home/routes/Home.tsx @@ -7,7 +7,6 @@ import { Screen } from '@/layout/Screen' import { generateRoomId } from '@/features/rooms' import { useUser, UserAware } from '@/features/auth' import { JoinMeetingDialog } from '../components/JoinMeetingDialog' -import { ProConnectButton } from '@/components/ProConnectButton' import { useCreateRoom } from '@/features/rooms' import { RiAddLine, RiLink } from '@remixicon/react' import { LaterMeetingDialog } from '@/features/home/components/LaterMeetingDialog' @@ -214,10 +213,8 @@ export const Home = () => { - ) : data?.use_proconnect_button ? ( - ) : ( - + )}