mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
Move update indicator to titlebar on desktop.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Download } from "@styled-icons/boxicons-regular";
|
||||
import { CloudDownload } from "@styled-icons/boxicons-regular";
|
||||
|
||||
import { useContext, useEffect, useState } from "preact/hooks";
|
||||
|
||||
@@ -13,7 +14,11 @@ import { updateSW } from "../../main";
|
||||
let pendingUpdate = false;
|
||||
internalSubscribe("PWA", "update", () => (pendingUpdate = true));
|
||||
|
||||
export default function UpdateIndicator() {
|
||||
interface Props {
|
||||
style: "titlebar" | "channel";
|
||||
}
|
||||
|
||||
export default function UpdateIndicator({ style }: Props) {
|
||||
const [pending, setPending] = useState(pendingUpdate);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -23,6 +28,16 @@ export default function UpdateIndicator() {
|
||||
if (!pending) return null;
|
||||
const theme = useContext(ThemeContext);
|
||||
|
||||
if (style === "titlebar") {
|
||||
return (
|
||||
<div onClick={() => updateSW(true)}>
|
||||
<CloudDownload size={22} color={theme.success} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (window.isNative) return null;
|
||||
|
||||
return (
|
||||
<IconButton onClick={() => updateSW(true)}>
|
||||
<Download size={22} color={theme.success} />
|
||||
|
||||
Reference in New Issue
Block a user