+
+
+
+ Notifications
+
+
+
+
+
;
-
- <>
- {Toasts.getInstance().toasts.length === 0
- ?
-
- No notification yet
-
- :
}
- >
+
+ <>
+ {Toasts.getInstance().toasts.length === 0
+ ?
+
+ No notification yet
+
+ :
}
+ >
+
-
+ >
}
public override componentDidMount() {
- this.removeOnToastChange = Toasts.getInstance().onChange(this.handleToastChange);
- }
+ this.removeOnToastChange = Toasts.getInstance().onChange(this.handleToastChange);
+ }
- public override componentWillUnmount() {
- this.removeOnToastChange();
- }
+ public override componentWillUnmount() {
+ this.removeOnToastChange();
+ }
private handleToastChange(toastList: IToast[] | null) {
- this.setState({
- toastList,
- });
- }
+ this.setState({
+ toastList,
+ });
+ }
}
diff --git a/src/front/components/DesignSystem/Header/Notifications/classes.module.scss b/src/front/components/DesignSystem/Header/Notifications/classes.module.scss
index b043ec9b..48a60e0a 100644
--- a/src/front/components/DesignSystem/Header/Notifications/classes.module.scss
+++ b/src/front/components/DesignSystem/Header/Notifications/classes.module.scss
@@ -3,7 +3,8 @@
.root {
.icon-container{
position: relative;
-
+ cursor: pointer;
+
.notification-icon{
height: 24px;
width: 24px;
@@ -12,10 +13,6 @@
position: absolute;
top: 0;
right: 0;
- height: 12px;
- width: 12px;
- border-radius: 50%;
- background-color: $orange-flash;
}
}
}
diff --git a/src/front/components/DesignSystem/Header/Notifications/index.tsx b/src/front/components/DesignSystem/Header/Notifications/index.tsx
index 3ad4b9b4..55e95151 100644
--- a/src/front/components/DesignSystem/Header/Notifications/index.tsx
+++ b/src/front/components/DesignSystem/Header/Notifications/index.tsx
@@ -2,37 +2,61 @@ import React from "react";
import classes from "./classes.module.scss";
import Image from "next/image";
import NotificationIcon from "@Assets/icons/notification.svg";
-import Toasts from "@Front/Stores/Toasts";
+import Toasts, { IToast } from "@Front/Stores/Toasts";
import NotificationModal from "./NotificationModal";
+import InfoIcon from "@Assets/icons/info.svg";
type IProps = {};
type IState = {
hasNotifications: boolean;
isModalOpen: boolean;
+ toastList: IToast[] | null;
};
export default class Notifications extends React.Component
{
+ private removeOnToastChange: () => void = () => { };
+
constructor(props: IProps) {
super(props);
this.state = {
- hasNotifications: true,
- isModalOpen: true,
+ isModalOpen: false,
+ toastList: Toasts.getInstance().toasts, //TODO : Get from bbd
+ hasNotifications: Toasts.getInstance().toasts.length > 0, // TODO: Change this when we have notification stored in bbd, unread notifications
};
this.openModal = this.openModal.bind(this);
this.closeModal = this.closeModal.bind(this);
+ this.handleToastChange = this.handleToastChange.bind(this);
+
}
+
public override render(): JSX.Element {
- const hasNotifications = Toasts.getInstance().toasts.length;
- console.log(hasNotifications)
return
- {this.state.hasNotifications &&
}
+ {this.state.hasNotifications &&
+
+ }
{this.state.isModalOpen &&
}
;
}
+
+ public override componentDidMount() {
+ this.removeOnToastChange = Toasts.getInstance().onChange(this.handleToastChange);
+ }
+
+ public override componentWillUnmount() {
+ this.removeOnToastChange();
+ }
+
+ private handleToastChange(toastList: IToast[] | null) {
+ this.setState({
+ toastList,
+ hasNotifications: toastList ? toastList.length > 0 : false
+ });
+ }
+
private openModal() {
this.setState({ isModalOpen: true });
};
diff --git a/src/front/components/DesignSystem/Toasts/ToastsContainer/ToastElement/classes.module.scss b/src/front/components/DesignSystem/Toasts/ToastsContainer/ToastElement/classes.module.scss
index ba90f6b4..45b567a8 100644
--- a/src/front/components/DesignSystem/Toasts/ToastsContainer/ToastElement/classes.module.scss
+++ b/src/front/components/DesignSystem/Toasts/ToastsContainer/ToastElement/classes.module.scss
@@ -1,14 +1,5 @@
@import "@Themes/constants.scss";
-// @keyframes loadbar-animation {
-// from {
-// transform: scaleX(1);
-// }
-// to {
-// transform: scaleX(0);
-// }
-// }
-
@keyframes slide-left {
from {
opacity: 0;
diff --git a/src/front/components/Layouts/Home/index.tsx b/src/front/components/Layouts/Home/index.tsx
index be9baf46..58ef5ea1 100644
--- a/src/front/components/Layouts/Home/index.tsx
+++ b/src/front/components/Layouts/Home/index.tsx
@@ -8,9 +8,7 @@ export default class Home extends BasePage {
return (
-
JDJADJIZDIAZN?DIAZ?
-
COUCOU JE SUIS UNE TYPO
-
COUCOU JE SUIS UNE TYPO
+
HomePage
);