mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
add offline indicator in subscriptions section
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { useSubplebbit } from "@plebbit/plebbit-react-hooks";
|
||||||
|
|
||||||
|
const BoardSubscription = ({ address }) => {
|
||||||
|
|
||||||
|
const subplebbit = useSubplebbit({ subplebbitAddress: address });
|
||||||
|
const isOnline = subplebbit.updatedAt > Date.now() / 1000 - 60 * 20;
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{address}{!isOnline && (
|
||||||
|
<img className="disconnected" alt="offline" src="assets/disconnected.png" />
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BoardSubscription;
|
||||||
@@ -296,6 +296,11 @@ export const BoardsContent = styled.div`
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disconnected {
|
||||||
|
width: 15px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const Footer = styled.div`
|
export const Footer = styled.div`
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Link, useNavigate } from 'react-router-dom';
|
|||||||
import { Container, Header, Logo, Page, Search, About, AboutTitle, AboutContent, Boards, BoardsTitle, BoardsContent, Footer } from '../styled/Home.styled';
|
import { Container, Header, Logo, Page, Search, About, AboutTitle, AboutContent, Boards, BoardsTitle, BoardsContent, Footer } from '../styled/Home.styled';
|
||||||
import BoardAvatar from '../BoardAvatar';
|
import BoardAvatar from '../BoardAvatar';
|
||||||
import packageJson from '../../../package.json'
|
import packageJson from '../../../package.json'
|
||||||
|
import BoardSubscription from '../BoardSubscription';
|
||||||
const {version} = packageJson
|
const {version} = packageJson
|
||||||
|
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ const Home = () => {
|
|||||||
<>
|
<>
|
||||||
<Link key={`sub-${index}`} className="boardlink" to={`/p/${subscription}`}>
|
<Link key={`sub-${index}`} className="boardlink" to={`/p/${subscription}`}>
|
||||||
<br id="mobile-br" />
|
<br id="mobile-br" />
|
||||||
{subscription}
|
<BoardSubscription address={subscription} />
|
||||||
</Link>
|
</Link>
|
||||||
<br />
|
<br />
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user