diff --git a/src/app/Header.tsx b/src/app/Header.tsx
index fdd5393..cb136a4 100644
--- a/src/app/Header.tsx
+++ b/src/app/Header.tsx
@@ -6,12 +6,14 @@ import { getDarkLogo, getLightLogo, getSignatureAccentColour, hasTransparentLogo
// import { Link } from "react-router-dom";
import { useThemeType } from "../hooks/useThemeType";
import UserMenu from "../user/UserMenu";
+import { useMobile } from "hooks";
+import HeaderButtons from "./HeaderButtons";
+import { useGlobalState } from "providers";
const useStyles = makeStyles((theme: Theme) => ({
appBar: {
zIndex: theme.zIndex.drawer + 1,
backgroundImage: "none", // This prevents de-saturation of header in dark mode
- // border: "1px solid purple"
},
toolbar: {
marginLeft: theme.spacing(0.5),
@@ -87,21 +89,25 @@ export default function Header(props: Props) {
const { openSide, toggleTheme } = props;
const themeType = useThemeType();
const classes = useStyles()
+ const isMobile = useMobile();
+
+ const [{ user, team }] = useGlobalState();
+ const hasTeams = user.hasFeature ? user.hasFeature("teams") : false;
return (
- {/* {!isMobile && ( */}
-
-
-
- {/* )} */}
+ {!isMobile && (
+
+
+
+ )}
{!hideLogo() && (
@@ -116,6 +122,7 @@ export default function Header(props: Props) {
+
diff --git a/src/app/HeaderButtons.tsx b/src/app/HeaderButtons.tsx
new file mode 100644
index 0000000..a6b1fd1
--- /dev/null
+++ b/src/app/HeaderButtons.tsx
@@ -0,0 +1,146 @@
+import { Chat } from "@mui/icons-material";
+import { Box, IconButton, Theme, Tooltip, useTheme } from "@mui/material";
+import { makeStyles } from "@mui/styles";
+import { Team, User } from "models";
+import moment from "moment";
+import { useEffect, useState } from "react";
+import { getSignatureAccentColour, hasTransparentLogoBG } from "services/whiteLabel";
+
+const useStyles = makeStyles((theme: Theme) => ({
+ button: {
+ width: theme.spacing(6),
+ height: theme.spacing(6),
+ marginTop: "auto",
+ marginBottom: "auto",
+ marginLeft: theme.spacing(0.5)
+ },
+ on: {
+ boxShadow: `0 0 0 2px ${theme.palette.background.paper}`,
+ animationName: "$ripple",
+ animationDuration: "1.2s",
+ animationTimingFunction: "ease-in-out",
+ animationIterationCount: "infinite",
+ position: "absolute",
+ right: theme.spacing(0.5),
+ top: theme.spacing(0.5),
+ backgroundColor: theme.palette.primary.main
+ },
+ off: {
+ backgroundColor: "transparent"
+ },
+}))
+
+interface Props {
+ hasTeams: boolean;
+ team: Team;
+ user: User
+}
+
+export default function HeaderButtons(props: Props) {
+ const {hasTeams, user, team} = props
+ const [hasNewChats, setHasNewChats] = useState(false);
+ const [chatDrawerOpen, setChatDrawerOpen] = useState(false);
+
+ // const theme = useTheme();
+ const classes = useStyles();
+
+ useEffect(() => {
+ if (!team) return;
+ if (
+ team.preferences.chatViewedTimestamp.length < 1 &&
+ team.settings.lastChatTimestamp.length > 1
+ ) {
+ setHasNewChats(true);
+ return;
+ }
+ let viewMoment = moment(team.preferences.chatViewedTimestamp);
+ let chatMoment = moment(team.settings.lastChatTimestamp);
+ if (viewMoment.diff(chatMoment) < 0) {
+ setHasNewChats(true);
+ } else {
+ setHasNewChats(false);
+ }
+ }, [team]);
+
+ const chatButton = () => {
+ if (!hasTeams) return;
+ if (team.key().length < 1) return
+ return (
+ <>
+
+ {
+ setChatDrawerOpen(true);
+ setHasNewChats(false);
+ }}>
+
+
+
+
+ {hasNewChats && (
+
+ )}
+ >
+ )
+ }
+
+ return (
+ chatButton()
+ )
+
+ // return (
+ // {user.settings?.notificationMethods?.includes(
+ // pond.NotificationMethod.NOTIFICATION_METHOD_APP
+ // ) && (
+ //
+ //
+ // {
+ // setNotificationDrawerOpen(true);
+ // }}>
+ //
+ //
+ //
+ // {hasNewNotifications && (
+ //
+ // )}
+ //
+ // )}
+ // {team && team.settings && team.settings.key && (
+ // setChatDrawerOpen(false)}
+ // style={{ height: "100%", maxWidth: "100%" }}
+ // title={team.settings.name ? team.settings.name + "Chat" : "Chat"}>
+ //
+ //
+ // setChatDrawerOpen(false)}>
+ //
+ //
+ // {team.name()} Chat
+ //
+ //
+ //
+ //
+ // )}
+ //
+ // )
+}
\ No newline at end of file