add offline indicator to all desktop views

This commit is contained in:
Tom
2023-05-06 15:40:30 +02:00
parent 5ee3c2c5e3
commit 511e2248c9
9 changed files with 85 additions and 32 deletions
+28
View File
@@ -0,0 +1,28 @@
import React from "react";
import { useSubplebbit } from "@plebbit/plebbit-react-hooks";
const OfflineIndicator = ({ address, className, tooltipPlace }) => {
const subplebbit = useSubplebbit({ subplebbitAddress: address });
const isOnline = subplebbit.updatedAt > Date.now() / 1000 - 60 * 20;
return (
<>
{!isOnline && (
<>
{" "}
<img
className={className}
alt="offline"
src="assets/offline.png"
data-tooltip-id="tooltip"
data-tooltip-content="OFFLINE"
data-tooltip-place={tooltipPlace}
/>
</>
)}
</>
);
};
export default OfflineIndicator;