Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/logo.svg" />
<link rel="mask-icon" href="%PUBLIC_URL%/logo.svg" color="#000000" />
<link rel="icon" href="%PUBLIC_URL%/logo.svg" data-react-helmet="true"/>
<link rel="mask-icon" href="%PUBLIC_URL%/logo.svg" color="#000000"/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!-- TODO: come up with better meta tags -->
Expand Down
18 changes: 18 additions & 0 deletions assets/public/logo-unread.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 11 additions & 14 deletions assets/public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 28 additions & 2 deletions assets/src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect, useState} from 'react';
import React, {useEffect, useRef, useState} from 'react';
import {
useLocation,
Switch,
Expand Down Expand Up @@ -67,6 +67,30 @@ const shouldDisplayChat = (pathname: string) => {
return true;
};

const ShortcutIcon = ({totalNumUnread}: {totalNumUnread: number}) => {

const iconLink = '/logo.svg'
const iconUnreadLink = '/logo-unread.svg'
const [data, setData] = useState(iconLink);

useEffect(() => {
if(totalNumUnread){
setData(iconUnreadLink)
} else{
setData(iconLink)
}
})

return (
<div className="" style={{position:'absolute', zIndex: 1, display: 'none'}}>
<Helmet defer={false}>
<link rel="icon" href={data}></link>
</Helmet>
</div>
)

}

// TODO: not sure if this is the best way to handle this, but the goal
// of this component is to flash the number of unread messages in the
// tab (i.e. HTML title) so users can see when new messages arrive
Expand Down Expand Up @@ -131,7 +155,9 @@ const Dashboard = (props: RouteComponentProps) => {

return (
<Layout>
<DashboardHtmlHead totalNumUnread={totalNumUnread} />
<ShortcutIcon totalNumUnread={totalNumUnread} />



<Sider
width={220}
Expand Down