diff --git a/src/components/BoardAvatar.jsx b/src/components/BoardAvatar.jsx index beb393ec..454332cf 100644 --- a/src/components/BoardAvatar.jsx +++ b/src/components/BoardAvatar.jsx @@ -15,7 +15,7 @@ const BoardAvatar = ({ address }) => { return ( board logo ); diff --git a/src/components/StateLabel.jsx b/src/components/StateLabel.jsx new file mode 100644 index 00000000..54efa1c5 --- /dev/null +++ b/src/components/StateLabel.jsx @@ -0,0 +1,52 @@ +import React, { useEffect, useState } from "react"; +import { useComment } from "@plebbit/plebbit-react-hooks"; + + +const StateLabel = ({ commentCid, className }) => { + const comment = useComment({commentCid}); + const [stateString, setStateString] = useState(null); + + useEffect(() => { + if (comment.clients) { + for (const ipfsGatewayUrl in comment.clients?.ipfsGateways) { + const ipfsGateway = comment.clients?.ipfsGateways[ipfsGatewayUrl] + if (ipfsGateway.state === 'fetching-ipfs') { + setStateString(`Fetching IPFS from ${ipfsGatewayUrl}`) + } + if (ipfsGateway.state === 'fetching-ipns-update') { + setStateString(`Fetching IPNS from ${ipfsGatewayUrl}`) + } + if (ipfsGateway.state === 'succeeded') { + setStateString(`Fetched comment from ${ipfsGatewayUrl}`) + } + } + + for (const ipfsClientUrl in comment.clients?.ipfsClients) { + const ipfsClient = comment.clients?.ipfsClients[ipfsClientUrl] + if (ipfsClient.state === 'fetching-ipfs') { + setStateString(`Fetching IPFS from ${ipfsClient.peers.length} peers`) + } + if (ipfsClient.state === 'fetching-ipns-update') { + setStateString(`Fetching IPNS from ${ipfsClient.peers.length} peers`) + } + if (ipfsClient.state === 'succeeded') { + setStateString(`Fetched comment from ${ipfsClient.peers.length} peers`) + } + } + } + }, [comment.clients]) + + + return ( + comment.state === "succeeded" ? null : ( + + <> +
+ {stateString || comment.state} + +
+ ) + ) +}; + +export default StateLabel; \ No newline at end of file diff --git a/src/components/styled/views/Board.styled.jsx b/src/components/styled/views/Board.styled.jsx index c78e704c..7d98fc12 100644 --- a/src/components/styled/views/Board.styled.jsx +++ b/src/components/styled/views/Board.styled.jsx @@ -1630,6 +1630,31 @@ export const TopBar = styled.div` `; export const BoardForm = styled.div` + .ellipsis { + margin-right: 14px; + } + + .ellipsis:after { + content: "\\2026"; + position: absolute; + -webkit-animation: ellipsis steps(4,end) 1200ms infinite; + animation: ellipsis steps(4,end) 1500ms infinite; + width: 0px; + overflow: hidden; + } + + @keyframes ellipsis { + to { + width: 1.25em; + } + } + + @-webkit-keyframes ellipsis { + to { + width: 1.25em; + } + } + @media (min-width: 480px) { margin-bottom: 130px; diff --git a/src/components/styled/views/Thread.styled.jsx b/src/components/styled/views/Thread.styled.jsx index 257d7924..ea86d1fe 100644 --- a/src/components/styled/views/Thread.styled.jsx +++ b/src/components/styled/views/Thread.styled.jsx @@ -834,6 +834,30 @@ export const BottomBar = styled.div` `; export const BoardForm = styled.div` + .ellipsis { + margin-right: 14px; + } + + .ellipsis:after { + content: "\\2026"; + position: absolute; + -webkit-animation: ellipsis steps(4,end) 1200ms infinite; + animation: ellipsis steps(4,end) 1500ms infinite; + width: 0px; + overflow: hidden; + } + + @keyframes ellipsis { + to { + width: 1.25em; + } + } + + @-webkit-keyframes ellipsis { + to { + width: 1.25em; + } + } @media (min-width: 480px) { .thread-mobile { display: none; @@ -3185,6 +3209,11 @@ export const Footer = styled.div` a:hover { color: #5f89ac; } + } + #style-selector { + background-color: #282a2e; + color: #c5c8c6; + border: 1px solid #373b41; }`; case 'Photon': diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index 04425bf7..1836da0d 100644 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -19,6 +19,7 @@ import ModerationModal from '../modals/ModerationModal'; import OfflineIndicator from '../OfflineIndicator'; import Post from '../Post'; import PostLoader from '../PostLoader'; +import StateLabel from '../StateLabel'; import ReplyModal from '../modals/ReplyModal'; import SettingsModal from '../modals/SettingsModal'; import findShortParentCid from '../../utils/findShortParentCid'; @@ -985,6 +986,9 @@ const Board = () => { +
Post too long.  setSelectedThread(thread.cid)} className="ttl-link">Click here @@ -997,6 +1001,9 @@ const Board = () => { + ) : null} @@ -1256,6 +1263,9 @@ const Board = () => { +
Comment too long.  setSelectedThread(thread.cid)} className="ttl-link">Click here @@ -1270,6 +1280,9 @@ const Board = () => { + ) : null} @@ -1410,6 +1423,9 @@ const Board = () => { +
Post too long.  setSelectedThread(thread.cid)} className="ttl-link">Click here @@ -1421,6 +1437,9 @@ const Board = () => { + ) : null} @@ -1560,6 +1579,9 @@ const Board = () => { +
Comment too long.  setSelectedThread(thread.cid)} className="ttl-link">Click here @@ -1574,6 +1596,9 @@ const Board = () => { + ) : null} {reply.replyCount > 0 ? ( diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx index f6f90e8d..b1542fa3 100644 --- a/src/components/views/Thread.jsx +++ b/src/components/views/Thread.jsx @@ -18,6 +18,7 @@ import ModerationModal from '../modals/ModerationModal'; import OfflineIndicator from '../OfflineIndicator'; import Post from '../Post'; import PostLoader from '../PostLoader'; +import StateLabel from '../StateLabel'; import ReplyModal from '../modals/ReplyModal'; import SettingsModal from '../modals/SettingsModal'; import findShortParentCid from '../../utils/findShortParentCid'; @@ -935,6 +936,9 @@ const Thread = () => { + @@ -1174,6 +1178,9 @@ const Thread = () => { + @@ -1294,6 +1301,9 @@ const Thread = () => { + ) : null} @@ -1411,6 +1421,9 @@ const Thread = () => { + {reply.replyCount > 0 ? (