Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

💄(proconnect) replace all proconnect buttons when env is off

Emmanuel Pelletier260eab23be56
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 <ProConnectButton hint={proConnectHint} />
+ }
+
return (
<LinkButton href={authUrl()} data-attr="login" variant="primary">
{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 (
<VStack alignItems="start">
- <Link
+ <RALink
className={proConnectButtonRecipe()}
aria-label={t('proconnectButtonLabel')}
href={authUrl()}
data-attr="login"
/>
{hint && (
- <Text margin="sm" variant="note">
- <Link
- href="https://agentconnect.gouv.fr/"
- target="_blank"
- rel="noopener noreferrer"
- aria-label={t('linkLabel')}
- >
- {t('link')}
- </Link>
- </Text>
+ <Link
+ to="https://agentconnect.gouv.fr/"
+ target="_blank"
+ rel="noopener noreferrer"
+ color="note"
+ aria-label={t('proconnectLinkLabel')}
+ >
+ {t('proconnectLink')}
+ </Link>
)}
</VStack>
)
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 = () => {
</MenuItem>
</RACMenu>
</Menu>
- ) : data?.use_proconnect_button ? (
- <ProConnectButton hint={false} />
) : (
- <LoginButton />
+ <LoginButton proConnectHint={false} />
)}
<DialogTrigger>
<Button
diff --git a/src/frontend/src/features/settings/components/SettingsDialog.tsx b/src/frontend/src/features/settings/components/SettingsDialog.tsx
index 2b405119..ec1ef05f 100644
--- a/src/frontend/src/features/settings/components/SettingsDialog.tsx
+++ b/src/frontend/src/features/settings/components/SettingsDialog.tsx
@@ -2,7 +2,7 @@ import { Trans, useTranslation } from 'react-i18next'
import { useLanguageLabels } from '@/i18n/useLanguageLabels'
import { A, Badge, Dialog, type DialogProps, Field, H, P } from '@/primitives'
import { useUser } from '@/features/auth'
-import { ProConnectButton } from '@/components/ProConnectButton'
+import { LoginButton } from '@/components/LoginButton'
export type SettingsDialogProps = Pick<DialogProps, 'isOpen' | 'onOpenChange'>
@@ -29,7 +29,7 @@ export const SettingsDialog = (props: SettingsDialogProps) => {
) : (
<>
<P>{t('account.youAreNotLoggedIn')}</P>
- <ProConnectButton />
+ <LoginButton />
</>
)}
<H lvl={2}>{t('language.heading')}</H>
diff --git a/src/frontend/src/features/settings/components/tabs/AccountTab.tsx b/src/frontend/src/features/settings/components/tabs/AccountTab.tsx
index 73e8d6fd..14bc7b34 100644
--- a/src/frontend/src/features/settings/components/tabs/AccountTab.tsx
+++ b/src/frontend/src/features/settings/components/tabs/AccountTab.tsx
@@ -6,7 +6,7 @@ import { css } from '@/styled-system/css'
import { TabPanel, TabPanelProps } from '@/primitives/Tabs'
import { HStack } from '@/styled-system/jsx'
import { useState } from 'react'
-import { ProConnectButton } from '@/components/ProConnectButton'
+import { LoginButton } from '@/components/LoginButton'
import { usePersistentUserChoices } from '@/features/rooms/livekit/hooks/usePersistentUserChoices'
export type AccountTabProps = Pick<DialogProps, 'onOpenChange'> &
@@ -57,7 +57,7 @@ export const AccountTab = ({ id, onOpenChange }: AccountTabProps) => {
) : (
<>
<P>{t('account.youAreNotLoggedIn')}</P>
- <ProConnectButton />
+ <LoginButton />
</>
)}
<HStack
diff --git a/src/frontend/src/layout/Header.tsx b/src/frontend/src/layout/Header.tsx
index 6080e150..c4d778ee 100644
--- a/src/frontend/src/layout/Header.tsx
+++ b/src/frontend/src/layout/Header.tsx
@@ -9,7 +9,7 @@ import { useMatchesRoute } from '@/navigation/useMatchesRoute'
import { FeedbackBanner } from '@/components/FeedbackBanner'
import { Menu } from '@/primitives/Menu'
import { MenuList } from '@/primitives/MenuList'
-import { ProConnectButton } from '@/components/ProConnectButton'
+import { LoginButton } from '@/components/LoginButton'
import LogoAsset from '@/assets/logo.svg'
import { useLoginHint } from '@/hooks/useLoginHint'
@@ -175,7 +175,7 @@ export const Header = () => {
!isAccessibility &&
!isTermsOfService && (
<>
- <ProConnectButton hint={false} />
+ <LoginButton proConnectHint={false} />
<LoginHint />
</>
)}
diff --git a/src/frontend/src/locales/de/global.json b/src/frontend/src/locales/de/global.json
index 3630db55..b9aacff6 100644
--- a/src/frontend/src/locales/de/global.json
+++ b/src/frontend/src/locales/de/global.json
@@ -16,9 +16,10 @@
"loading": "Ladevorgang…",
"loggedInUserTooltip": "Angemeldet als…",
"login": {
- "buttonLabel": "Mit ProConnect anmelden",
- "linkLabel": "Was ist ProConnect? – neues Fenster",
- "link": "Was ist ProConnect?"
+ "buttonLabel": "Anmelden",
+ "proconnectButtonLabel": "Mit ProConnect anmelden",
+ "proconnectLinkLabel": "Was ist ProConnect? – neues Fenster",
+ "proconnectLink": "Was ist ProConnect?"
},
"logout": "Abmelden",
"notFound": {
diff --git a/src/frontend/src/locales/en/global.json b/src/frontend/src/locales/en/global.json
index 96c0d60b..c59e50f8 100644
--- a/src/frontend/src/locales/en/global.json
+++ b/src/frontend/src/locales/en/global.json
@@ -16,10 +16,10 @@
"loading": "Loading…",
"loggedInUserTooltip": "Logged in as…",
"login": {
- "proconnectButtonLabel": "Login with ProConnect",
"buttonLabel": "Login",
- "linkLabel": "What is ProConnect? - new tab",
- "link": "What is ProConnect?"
+ "proconnectButtonLabel": "Login with ProConnect",
+ "proconnectLinkLabel": "What is ProConnect? - new tab",
+ "proconnectLink": "What is ProConnect?"
},
"logout": "Logout",
"notFound": {
diff --git a/src/frontend/src/locales/fr/global.json b/src/frontend/src/locales/fr/global.json
index 13c97c55..eb1b8a61 100644
--- a/src/frontend/src/locales/fr/global.json
+++ b/src/frontend/src/locales/fr/global.json
@@ -16,9 +16,10 @@
"loading": "Chargement…",
"loggedInUserTooltip": "Connecté en tant que…",
"login": {
- "buttonLabel": "S'identifier avec ProConnect",
- "linkLabel": "Qu'est-ce que ProConnect ? - nouvelle fenêtre",
- "link": "Qu'est-ce que ProConnect ?"
+ "buttonLabel": "Se connecter",
+ "proconnectButtonLabel": "S'identifier avec ProConnect",
+ "proconnectLinkLabel": "Qu'est-ce que ProConnect ? - nouvelle fenêtre",
+ "proconnectLink": "Qu'est-ce que ProConnect ?"
},
"logout": "Se déconnecter",
"notFound": {
diff --git a/src/frontend/src/locales/nl/global.json b/src/frontend/src/locales/nl/global.json
index add9413f..3565e325 100644
--- a/src/frontend/src/locales/nl/global.json
+++ b/src/frontend/src/locales/nl/global.json
@@ -16,9 +16,10 @@
"loading": "Laden ...",
"loggedInUserTooltip": "Ingelogd als ...",
"login": {
- "buttonLabel": "Log in met Proconnect",
- "linkLabel": "Wat is ProConnect? ",
- "link": "Wat is ProConnect?"
+ "buttonLabel": "Log in",
+ "proconnectButtonLabel": "Log in met Proconnect",
+ "proconnectLinkLabel": "Wat is ProConnect?",
+ "proconnectLink": "Wat is ProConnect?"
},
"logout": "Uitloggen",
"notFound": {
diff --git a/src/frontend/src/primitives/A.tsx b/src/frontend/src/primitives/A.tsx
index c5de211c..8bda7534 100644
--- a/src/frontend/src/primitives/A.tsx
+++ b/src/frontend/src/primitives/A.tsx
@@ -55,6 +55,9 @@ const link = cva({
primary: {
color: 'blue',
},
+ note: {
+ color: 'default.subtle-text',
+ },
},
},
})