Files
5chan/src/components/OfflineIndicator.jsx
T

28 lines
738 B
React
Raw Normal View History

2023-05-06 15:40:30 +02:00
import React from "react";
import { useSubplebbit } from "@plebbit/plebbit-react-hooks";
2023-05-29 18:30:09 +02:00
const OfflineIndicator = ({ address, className, tooltipPlace }) => {
2023-05-06 15:40:30 +02:00
const subplebbit = useSubplebbit({ subplebbitAddress: address });
2023-05-29 18:31:15 +02:00
const isOnline = subplebbit.updatedAt > Date.now() / 1000 - 60 * 20;
2023-05-06 15:40:30 +02:00
return (
<>
{!isOnline && (
<>
2023-05-29 18:30:09 +02:00
{" "}
<img
className={className}
alt="offline"
src="assets/offline.png"
data-tooltip-id="tooltip"
data-tooltip-content="Offline"
data-tooltip-place={tooltipPlace}
2023-06-28 18:23:22 +02:00
style={{imageRendering: 'pixelated'}}
2023-05-29 18:30:09 +02:00
/>
2023-05-06 15:40:30 +02:00
</>
)}
</>
);
};
export default OfflineIndicator;