Display WS state in favicon
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import Favicon from "react-favicon";
|
||||
import { WSState } from "./MatrixWS";
|
||||
|
||||
// Taken from https://github.com/element-hq/element-web/blob/0577e245dac944bd85eea07b93a9762a93062f62/src/favicon.ts
|
||||
function getInitialFavicon(): HTMLLinkElement[] {
|
||||
@@ -21,6 +22,14 @@ let iconPath = getInitialFavicon()[0].getAttribute("href")!;
|
||||
|
||||
export function AppIconModifier(p: {
|
||||
numberUnread: number;
|
||||
state: string;
|
||||
}): React.ReactElement {
|
||||
return <Favicon url={iconPath} alertCount={p.numberUnread} />;
|
||||
const isError = p.state === WSState.Error || p.state === WSState.Closed;
|
||||
return (
|
||||
<Favicon
|
||||
url={iconPath}
|
||||
alertFillColor={isError ? "orange" : undefined}
|
||||
alertCount={isError ? "x" : p.numberUnread}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user