From 854cdd711c4bdf3da90907ebbed867064185e8b0 Mon Sep 17 00:00:00 2001 From: kirahsapong <102400653+kirahsapong@users.noreply.github.com> Date: Wed, 28 Jun 2023 11:22:31 -0700 Subject: [PATCH] Update admin overview to react to new notifications (#88) --- src/components/Header/Header.tsx | 152 +++++++++--------- .../Admin/AdminOverview/AdminOverview.tsx | 16 +- 2 files changed, 90 insertions(+), 78 deletions(-) diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 5738662..8ddfda1 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -1,4 +1,4 @@ -import { Component, createEffect, createSignal } from 'solid-js'; +import { Component, createEffect, createRoot, createSignal } from 'solid-js'; import TBDBrackets from '../../assets/tbd-brackets.svg'; import './Header.scss'; import { A } from '@solidjs/router'; @@ -8,84 +8,84 @@ import NotifyBlock, { NotifyBlockContent } from '../NotifyBlock/NotifyBlock'; import { store, updateStore } from '../../utils/store'; const Header: Component<{ username: string }> = (props) => { - const [ hasApplications, setHasApplications ] = createSignal(false); - const [ hasSubmissions, setHasSubmissions ] = createSignal(false); - - createEffect(() => { + const [ hasApplications, setHasApplications ] = createSignal(false); + const [ hasSubmissions, setHasSubmissions ] = createSignal(false); + + createEffect(() => { setHasApplications(!!store.applications?.length); - }, [store.applications]); - - createEffect(() => { + }, [store.applications]); + + createEffect(() => { setHasSubmissions(store.submissions && !!Object.values(store.submissions)?.length); - }, [store.submissions]); + }, [store.submissions]); - return ( -
-
-
- -
-
- - Docs - -
- -
-
    - {notifications(hasApplications(), hasSubmissions())?.map(notification => -
  • - )} -
-
-
-
- -
- -
-
-
-
-
- -
-
- ) + return ( +
+
+
+ +
+
+ + Docs + +
+ +
+
    + {notifications(hasApplications(), hasSubmissions())?.map(notification => +
  • + )} +
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+ ) } export default Header; diff --git a/src/pages/Admin/AdminOverview/AdminOverview.tsx b/src/pages/Admin/AdminOverview/AdminOverview.tsx index b5bc64f..d71206d 100644 --- a/src/pages/Admin/AdminOverview/AdminOverview.tsx +++ b/src/pages/Admin/AdminOverview/AdminOverview.tsx @@ -1,4 +1,4 @@ -import { Component } from "solid-js"; +import { Component, createEffect, createSignal } from "solid-js"; import AvatarPerson from "../../../assets/avatar-person.svg"; import SearchCheckmark from "../../../assets/search-checkmark.svg"; import GroupPeople from "../../../assets/group-people.svg"; @@ -7,14 +7,26 @@ import Card, { CardContent } from "../../../components/Card/Card"; import NotifyBlock from "../../../components/NotifyBlock/NotifyBlock"; import "./AdminOverview.scss"; import { notifications } from "../../../components/Header/Header"; +import { store, updateStore } from "@/utils/store"; const AdminOverview: Component = () => { + const [ hasApplications, setHasApplications ] = createSignal(false); + const [ hasSubmissions, setHasSubmissions ] = createSignal(false); + + createEffect(() => { + setHasApplications(!!store.applications?.length); + }, [store.applications]); + + createEffect(() => { + setHasSubmissions(store.submissions && !!Object.values(store.submissions)?.length); + }, [store.submissions]); + return (

SSI Admin Console

- {notifications && notifications.map(notification => + {notifications(hasApplications(), hasSubmissions())?.map(notification => )}