diff --git a/src/components/VolunteerConfirmation/VolunteerConfirmation.tsx b/src/components/VolunteerConfirmation/VolunteerConfirmation.tsx
new file mode 100644
index 0000000..4a74a0d
--- /dev/null
+++ b/src/components/VolunteerConfirmation/VolunteerConfirmation.tsx
@@ -0,0 +1,8 @@
+import { FC, memo } from "react"
+import styles from "./styles.module.scss"
+
+const VolunteerConfirmation: FC = (): JSX.Element => (
+
✓ Tu es bénévole pour le festival de 2022. Merci !
+)
+
+export default memo(VolunteerConfirmation)
diff --git a/src/components/VolunteerConfirmation/styles.module.scss b/src/components/VolunteerConfirmation/styles.module.scss
new file mode 100755
index 0000000..f0bfad0
--- /dev/null
+++ b/src/components/VolunteerConfirmation/styles.module.scss
@@ -0,0 +1,7 @@
+@import "../../theme/variables";
+
+.root {
+ margin-bottom: 10px;
+ text-align: center;
+ color: $color-green;
+}
diff --git a/src/components/index.ts b/src/components/index.ts
index 5b3c1b9..ba0a18d 100755
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -12,6 +12,7 @@ import VolunteerList from "./VolunteerList"
import VolunteerInfo from "./VolunteerInfo"
import VolunteerSet from "./VolunteerSet"
import WishAdd from "./WishAdd"
+import { fetchFor as fetchForBoardForms } from "./VolunteerBoard/Board"
export {
AnnouncementLink,
@@ -28,4 +29,5 @@ export {
VolunteerList,
VolunteerSet,
WishAdd,
+ fetchForBoardForms,
}
diff --git a/src/components/ui/Content/ContentBlock.tsx b/src/components/ui/Content/ContentBlock.tsx
new file mode 100644
index 0000000..ebd4b32
--- /dev/null
+++ b/src/components/ui/Content/ContentBlock.tsx
@@ -0,0 +1,21 @@
+import { FC, memo, ReactNode } from "react"
+import styles from "./styles.module.scss"
+import ContentTitle from "./ContentTitle"
+
+interface Props {
+ children: ReactNode
+ title?: string | null
+}
+
+const ContentBlock: FC
= ({ children, title }): JSX.Element => (
+
+ {title &&
}
+
{children}
+
+)
+
+ContentBlock.defaultProps = {
+ title: null,
+}
+
+export default memo(ContentBlock)
diff --git a/src/components/ui/Content/ContentTitle.tsx b/src/components/ui/Content/ContentTitle.tsx
new file mode 100644
index 0000000..10ac7bd
--- /dev/null
+++ b/src/components/ui/Content/ContentTitle.tsx
@@ -0,0 +1,12 @@
+import { FC, memo } from "react"
+import styles from "./styles.module.scss"
+
+interface Props {
+ title: string
+}
+
+const ContentTitle: FC = ({ title }): JSX.Element => (
+ {title}
+)
+
+export default memo(ContentTitle)
diff --git a/src/components/ui/Content/styles.module.scss b/src/components/ui/Content/styles.module.scss
new file mode 100755
index 0000000..ddf4df2
--- /dev/null
+++ b/src/components/ui/Content/styles.module.scss
@@ -0,0 +1,12 @@
+@import "../../../theme/mixins";
+
+.title {
+ margin: 30px 10px 0;
+ padding: 0;
+ font-weight: 600;
+ font-size: 1.1em;
+}
+
+.content {
+ @include inner-content-wrapper;
+}
diff --git a/src/components/Page/Page.tsx b/src/components/ui/Page/Page.tsx
similarity index 100%
rename from src/components/Page/Page.tsx
rename to src/components/ui/Page/Page.tsx
diff --git a/src/components/Page/styles.module.scss b/src/components/ui/Page/styles.module.scss
similarity index 77%
rename from src/components/Page/styles.module.scss
rename to src/components/ui/Page/styles.module.scss
index fd951e3..ac77648 100755
--- a/src/components/Page/styles.module.scss
+++ b/src/components/ui/Page/styles.module.scss
@@ -1,4 +1,4 @@
-@import "../../theme/mixins";
+@import "../../../theme/mixins";
.pageWrapper {
@include page-wrapper-center;
diff --git a/src/pages/Board/Board.tsx b/src/pages/Board/Board.tsx
index c7d2b41..6bdb341 100644
--- a/src/pages/Board/Board.tsx
+++ b/src/pages/Board/Board.tsx
@@ -4,7 +4,7 @@ import { useSelector } from "react-redux"
import { AppThunk } from "../../store"
import { selectUserJwtToken } from "../../store/auth"
-import Page from "../../components/Page/Page"
+import Page from "../../components/ui/Page/Page"
import Board from "../../components/VolunteerBoard/Board"
import { fetchVolunteerDayWishesSetIfNeed } from "../../store/volunteerDayWishesSet"
import { fetchVolunteerParticipationDetailsSetIfNeed } from "../../store/volunteerParticipationDetailsSet"
diff --git a/src/pages/Home/Home.tsx b/src/pages/Home/Home.tsx
index 6586af1..e6b796f 100644
--- a/src/pages/Home/Home.tsx
+++ b/src/pages/Home/Home.tsx
@@ -1,35 +1,33 @@
import { FC, memo } from "react"
import { RouteComponentProps, Link } from "react-router-dom"
-import { useSelector, shallowEqual } from "react-redux"
+import { useSelector } from "react-redux"
import { Helmet } from "react-helmet"
-import { AppState, AppThunk } from "../../store"
-import { LoginForm, Notifications, fetchForTeamWishesForm } from "../../components"
+import { AppThunk } from "../../store"
+import { LoginForm, Notifications, fetchForBoardForms } from "../../components"
import styles from "./styles.module.scss"
-import { fetchVolunteerNotifsSetIfNeed } from "../../store/volunteerNotifsSet"
-import { VolunteerNotifs } from "../../services/volunteers"
+import { fetchVolunteerNotifsSetIfNeed, hasWaitingNotifs } from "../../store/volunteerNotifsSet"
import { selectUserJwtToken } from "../../store/auth"
+import Board from "../../components/VolunteerBoard/Board"
+import Page from "../../components/ui/Page/Page"
+import VolunteerConfirmation from "../../components/VolunteerConfirmation/VolunteerConfirmation"
export type Props = RouteComponentProps
-let prevNotifs: VolunteerNotifs | undefined
-
const HomePage: FC = (): JSX.Element => {
const jwtToken = useSelector(selectUserJwtToken)
-
- const volunteerNotifs = useSelector((state: AppState) => {
- const notifs = state.volunteerNotifsSet?.entity
- if (notifs) {
- prevNotifs = notifs
- return notifs
- }
- return prevNotifs
- }, shallowEqual)
+ const waitingNotifs = useSelector(hasWaitingNotifs)
if (jwtToken === undefined) return Loading...
if (jwtToken) {
- return
+ return (
+
+ {!waitingNotifs && }
+
+ {!waitingNotifs && }
+
+ )
}
return (
@@ -51,7 +49,7 @@ const HomePage: FC
= (): JSX.Element => {
// Fetch server-side data here
export const loadData = (): AppThunk[] => [
fetchVolunteerNotifsSetIfNeed(),
- ...fetchForTeamWishesForm.map((f) => f()),
+ ...fetchForBoardForms.map((f) => f()),
]
export default memo(HomePage)
diff --git a/src/pages/Volunteers/Volunteers.tsx b/src/pages/Volunteers/Volunteers.tsx
index 3791e7d..eec249a 100644
--- a/src/pages/Volunteers/Volunteers.tsx
+++ b/src/pages/Volunteers/Volunteers.tsx
@@ -4,7 +4,7 @@ import { useSelector } from "react-redux"
import { AppThunk } from "../../store"
import { selectUserJwtToken } from "../../store/auth"
-import Page from "../../components/Page/Page"
+import Page from "../../components/ui/Page/Page"
import { fetchVolunteerListIfNeed } from "../../store/volunteerList"
export type Props = RouteComponentProps
diff --git a/src/store/volunteerNotifsSet.ts b/src/store/volunteerNotifsSet.ts
index a34db8c..4200652 100644
--- a/src/store/volunteerNotifsSet.ts
+++ b/src/store/volunteerNotifsSet.ts
@@ -1,4 +1,5 @@
-import { PayloadAction, createSlice } from "@reduxjs/toolkit"
+import { PayloadAction, createSlice, createSelector } from "@reduxjs/toolkit"
+import get from "lodash/get"
import { StateRequest, toastError, elementFetch } from "./utils"
import { VolunteerNotifs } from "../services/volunteers"
@@ -57,3 +58,21 @@ export const fetchVolunteerNotifsSetIfNeed =
return null
}
+
+export const openedNotifsIds = [1, 2, 3]
+
+export const selectVolunteerNotifsSetState = (state: AppState): StateVolunteerNotifsSet =>
+ state.volunteerNotifsSet
+
+export const selectHiddenNotifs = createSelector(selectVolunteerNotifsSetState, (notifState) =>
+ get(notifState, "entity.hiddenNotifs", [])
+)
+
+export const selectWaitingsNotifs = createSelector(selectHiddenNotifs, (hidden) =>
+ openedNotifsIds.filter((id) => !hidden.find((hiddenId: number) => hiddenId === id))
+)
+
+export const hasWaitingNotifs = createSelector(
+ selectWaitingsNotifs,
+ (waiting) => waiting.length > 0
+)
diff --git a/src/theme/mixins.scss b/src/theme/mixins.scss
index b16fd3c..3fe4d75 100644
--- a/src/theme/mixins.scss
+++ b/src/theme/mixins.scss
@@ -37,7 +37,7 @@
}
@mixin inner-content-wrapper() {
- margin: 10px 0;
+ margin: 5px 0 10px;
padding: 10px;
border-radius: 5px;
background-color: $color-grey-lighter;