Skip to content

Commit

Permalink
feat: notify users about new design (#300)
Browse files Browse the repository at this point in the history
* feat: notify users about new design

* feat: applay message only for search page

* feat: notify users about new design
  • Loading branch information
ImenOuidou authored Oct 29, 2023
1 parent 64e17aa commit c171806
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 24 deletions.
8 changes: 7 additions & 1 deletion src/client/src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,17 @@ const App = () => {
<Maintenance />
) : (
<Switch>
<PrivateRoute exact path="/" component={Search} />
<PrivateRoute
exact
displayMessage
path="/"
component={Search}
/>
<PrivateRoute
exact
path="/search"
component={Search}
displayMessage
/>
<PrivateRoute
exact
Expand Down
34 changes: 25 additions & 9 deletions src/client/src/components/App/Header/Header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import "./header.scss";

import { faChevronLeft, faPlus } from "@fortawesome/free-solid-svg-icons";
import {
faChevronLeft,
faInfoCircle,
faPlus,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import PropTypes from "prop-types";
import React from "react";
Expand All @@ -9,6 +13,7 @@ import { withRouter } from "react-router";
import { Link } from "react-router-dom";

import logo from "../../../assets/img/logo_gouv-65w38h.png";
import Config from "../../../services/Config";
import { resetSearch } from "../../../services/Store/actions";

const Header = ({ resetSearch, location, showBetaMessage }) => {
Expand Down Expand Up @@ -59,16 +64,27 @@ const Header = ({ resetSearch, location, showBetaMessage }) => {
{showBetaMessage && (
<div className="beta-message">
<div>
<span>Ce site est en beta-test. </span>
<span className="beta-message__nouveaute">
{" "}
<FontAwesomeIcon icon={faInfoCircle} /> Une nouvelle version de
notre portail FCE sera déployée le 15 novembre 2023 :{" "}
</span>
{location.pathname !== "/login" && (
<span>
Aidez-nous à l{"'"}améliorer en{" "}
<a
className="beta-message__feedback-link"
href="#user-feedback"
>
donnant votre avis
</a>
{`Cette mise à jour est une refonte ergonomique visant à aligner notre site avec la charte graphique de l'État.
Nous tenons à souligner que cette mise à jour n'affectera en rien le contenu actuel de notre portail,
qui restera inchangé. Vous continuerez d'accéder à toutes les informations et fonctionnalités auxquelles
vous êtes habitués. `}
<br />
<span>
Questions ou préoccupations ➜
<a
className="beta-message__feedback-link"
href={`mailto:${Config.get("contact.mailto")}`}
>
[email protected]
</a>
</span>
</span>
)}
</div>
Expand Down
22 changes: 11 additions & 11 deletions src/client/src/components/App/Header/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,26 @@

.beta-message {
@extend %flex-center;
height: 40px;
font-size: 0.9rem;
font-weight: bold;
text-align: center;
font-size: 1rem;
letter-spacing: 0.04rem;
color: $black;
background-color: #ffe15b;
color: #0063cb;
background-color: #e8edff;
padding: 1rem;
box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);

&__nouveaute {
font-weight: bold;
}
&__feedback-link {
margin-left: $spacing-1;
padding: $spacing-1 $spacing-2;
color: $dark-grey;
background-color: $white;
color: #0063cb !important;
transition: background-size 0s;
background-color: #b9c7f3;
border-radius: $border-radius-1;
transition: color $duration-2, background-color $duration-2;

&:hover {
color: $white;
background-color: $primary;
background-color: #a9bfff;
}
}
}
4 changes: 3 additions & 1 deletion src/client/src/components/App/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const Layout = ({
hasLandingHeader = false,
hasSharedButton = false,
children,
displayMessage = false,
}) => {
const isActiveMaintenanceMode = Config.get("maintenanceMode");

Expand All @@ -20,7 +21,7 @@ const Layout = ({
{hasLandingHeader ? (
<LandingHeader hasSharedButton={hasSharedButton} />
) : (
<Header showBetaMessage={!isActiveMaintenanceMode} />
<Header showBetaMessage={!isActiveMaintenanceMode && displayMessage} />
)}
<div className={classNames("app-container", { ie11: isIE })}>
{children}
Expand All @@ -32,6 +33,7 @@ const Layout = ({

Layout.propTypes = {
children: PropTypes.node,
displayMessage: PropTypes.bool,
hasLandingHeader: PropTypes.bool,
hasSharedButton: PropTypes.bool,
};
Expand Down
10 changes: 8 additions & 2 deletions src/client/src/services/PrivateRoute/PrivateRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { Redirect, Route, useHistory } from "react-router-dom";
import Layout from "../../components/App/Layout";
import Auth from "../Auth";

const PrivateRoute = ({ component: Component, location, ...rest }) => {
const PrivateRoute = ({
component: Component,
displayMessage,
location,
...rest
}) => {
const history = useHistory();

async function getTempAuthAndRedirect(credential, location) {
Expand Down Expand Up @@ -46,7 +51,7 @@ const PrivateRoute = ({ component: Component, location, ...rest }) => {
{...rest}
render={(props) => {
return authorization.auth ? (
<Layout>
<Layout displayMessage={displayMessage}>
<Component {...props} />
</Layout>
) : (
Expand All @@ -64,6 +69,7 @@ const PrivateRoute = ({ component: Component, location, ...rest }) => {

PrivateRoute.propTypes = {
component: PropTypes.elementType,
displayMessage: PropTypes.bool,
history: PropTypes.shape({
push: PropTypes.func,
}),
Expand Down

0 comments on commit c171806

Please sign in to comment.