Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ and this project adheres to
from the site configuration in the Django admin
- Warn that an auto-reply is active for the selected mailbox with a banner
instead of a header icon
- `with_proconnect` in `FRONTEND_THEME_CONFIG` replaces the ProConnect button
of the home page with a generic "Sign in" button

### Changed

Expand Down
2 changes: 1 addition & 1 deletion docs/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ These settings are unset by default: an unset setting is omitted from the `/conf
| Variable | Default | Description | Required |
|----------|---------|-------------|----------|
| `FRONTEND_SILENT_LOGIN_ENABLED` | `False` | Whether silent login is enabled | Optional |
| `FRONTEND_THEME_CONFIG` | None (frontend defaults to `{"theme": "white-label"}`) | Theme configuration served to the frontend (`theme`, `terms_of_service_url`, `footer`), as JSON | Optional |
| `FRONTEND_THEME_CONFIG` | None (frontend defaults to `{"theme": "white-label"}`) | Theme configuration served to the frontend (`theme`, `terms_of_service_url`, `footer`, `with_proconnect`), as JSON | Optional |
| `FRONTEND_FORCED_DEFAULT_LANGUAGE` | None (frontend defaults to `False`) | When `True`, the frontend default language fallback is `LANGUAGE_CODE` instead of the browser language | Optional |
| `FRONTEND_MULTIPART_UPLOAD_CHUNK_SIZE_MB` | None (frontend defaults to `100`) | Chunk size in MB for frontend multipart uploads | Optional |
| `FRONTEND_HELP_CENTER_URL` | None | Help center URL | Optional |
Expand Down
9 changes: 9 additions & 0 deletions docs/theme-customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ The theme configuration is a JSON object that contains the following properties:
Each theme are available in two variants: `light` and `dark`.
- `terms_of_service_url`: The terms of service URL that will be displayed in the user menu.
- `footer`: Customize logo and links in the footer.
- `with_proconnect`: Show the ProConnect button on the home page (default: `true`).
Set it to `false` to display a generic "Sign in" button instead, e.g. when your
OIDC provider is not ProConnect.

Example:

```json
{"theme": "white-label", "with_proconnect": false}
```

## About the footer

Expand Down
2 changes: 1 addition & 1 deletion src/backend/core/api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
},
"FRONTEND_THEME_CONFIG": {
"type": "object",
"description": "Theme configuration for the frontend (theme, terms_of_service_url, footer)",
"description": "Theme configuration for the frontend (theme, terms_of_service_url, footer, with_proconnect)",
"readOnly": true
},
"FRONTEND_FORCED_DEFAULT_LANGUAGE": {
Expand Down
2 changes: 1 addition & 1 deletion src/backend/core/api/viewsets/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def resolve(self):
"type": "object",
"description": (
"Theme configuration for the frontend "
"(theme, terms_of_service_url, footer)"
"(theme, terms_of_service_url, footer, with_proconnect)"
),
},
required=False,
Expand Down
1 change: 1 addition & 0 deletions src/frontend/public/locales/common/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@
"Show logs": "Show logs",
"Show more": "Show more",
"Show window": "Show window",
"Sign in": "Sign in",
"Sign in with another address": "Sign in with another address",
"Sign out": "Sign out",
"Sign out \"{{name}}\"": "Sign out \"{{name}}\"",
Expand Down
1 change: 1 addition & 0 deletions src/frontend/public/locales/common/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@
"Show logs": "En savoir plus",
"Show more": "Afficher plus",
"Show window": "Afficher la fenêtre",
"Sign in": "Se connecter",
"Sign in with another address": "Se connecter avec une autre adresse",
"Sign out": "Déconnecter",
"Sign out \"{{name}}\"": "Déconnecter « {{name}} »",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export type ConfigRetrieve200 = {
readonly FRONTEND_SILENT_LOGIN_ENABLED: boolean;
/** Sentry DSN shared with the frontend */
readonly SENTRY_DSN?: string;
/** Theme configuration for the frontend (theme, terms_of_service_url, footer) */
/** Theme configuration for the frontend (theme, terms_of_service_url, footer, with_proconnect) */
readonly FRONTEND_THEME_CONFIG?: ConfigRetrieve200FRONTENDTHEMECONFIG;
/** Whether the frontend should fall back to LANGUAGE_CODE instead of the browser language */
readonly FRONTEND_FORCED_DEFAULT_LANGUAGE?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
*/

/**
* Theme configuration for the frontend (theme, terms_of_service_url, footer)
* Theme configuration for the frontend (theme, terms_of_service_url, footer, with_proconnect)
*/
export type ConfigRetrieve200FRONTENDTHEMECONFIG = { [key: string]: unknown };
2 changes: 2 additions & 0 deletions src/frontend/src/features/config/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export type ThemeConfig = {
theme: "white-label" | "anct" | "dsfr";
terms_of_service_url?: string;
footer?: FooterProps;
/** Show the ProConnect button on the home page. Defaults to `true`. */
with_proconnect?: boolean;
};

export type FeedbackWidgetConfig = {
Expand Down
12 changes: 10 additions & 2 deletions src/frontend/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createFileRoute, useSearch } from "@tanstack/react-router";
import { useTranslation } from "react-i18next";
import { Hero, HomeGutter, Footer, ProConnectButton, useResponsive } from "@gouvfr-lasuite/ui-components";
import { Button, Hero, HomeGutter, Footer, ProConnectButton, useResponsive } from "@gouvfr-lasuite/ui-components";

import { login, useAuth } from "@/features/auth";
import { MainLayout } from "@/features/layouts/components/main";
Expand Down Expand Up @@ -48,7 +48,15 @@ const HomePage = () => {
title={t("Simple and intuitive messaging")}
banner={`/images/banner-${variant}.webp`}
subtitle={t("Send and receive your messages in an instant.")}
mainButton={<ProConnectButton onClick={handleLogin} />}
mainButton={
themeConfig.with_proconnect === false ? (
<Button onClick={handleLogin} className="login-button">
{t("Sign in")}
</Button>
) : (
<ProConnectButton onClick={handleLogin} />
)
}
/>
</HomeGutter>
{themeConfig.footer && (
Expand Down