From f6095e90c0711632390d54838a47351feb8d4061 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Sat, 17 Jun 2023 09:33:29 +0200 Subject: [PATCH] add board rules and description --- src/components/styled/views/Board.styled.jsx | 24 +++ src/components/views/Board.jsx | 182 ++++++++++++++++++- 2 files changed, 199 insertions(+), 7 deletions(-) diff --git a/src/components/styled/views/Board.styled.jsx b/src/components/styled/views/Board.styled.jsx index 95050d1a..2ccd0606 100644 --- a/src/components/styled/views/Board.styled.jsx +++ b/src/components/styled/views/Board.styled.jsx @@ -1740,6 +1740,10 @@ export const BoardForm = styled.div` border-left: none !important; border-top: none !important; } + + .capcode { + color: purple !important; + } #post-menu { border-right: 1px solid #d9bfb7; @@ -1763,6 +1767,10 @@ export const BoardForm = styled.div` border-left: none !important; border-top: none !important; } + + .capcode { + color: purple !important; + } #post-menu { border-right: 1px solid #b7c5d9; @@ -1783,6 +1791,10 @@ export const BoardForm = styled.div` return `.highlighted { background-color: #f0c0b0 !important; } + + .capcode { + color: purple !important; + } #post-menu { font-size: 13px !important; @@ -1803,6 +1815,10 @@ export const BoardForm = styled.div` return `.highlighted { background-color: #d6bad0 !important; } + + .capcode { + color: purple !important; + } #post-menu { font-size: 13px !important; @@ -1824,6 +1840,10 @@ export const BoardForm = styled.div` background-color: #1d1d21 !important; outline: 1px solid #111 !important; } + + .capcode { + color: #81a2be !important; + } #post-menu { border: 1px solid #000; @@ -1844,6 +1864,10 @@ export const BoardForm = styled.div` background-color: #ccc !important; outline: 1px solid #ccc !important; } + + .capcode { + color: #f60 !important; + } #post-menu { border: 1px solid #ccc; diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index a9e20da7..c885691d 100755 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -424,7 +424,7 @@ const Board = () => { }, }); - + const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions); @@ -764,6 +764,173 @@ const Board = () => { null ) : ( feed.length > 0 ? ( + <> + {subplebbit.rules ? +
+
+
+
+
+ + Rules +   + ## Board Admins +   + {getDate(subplebbit.createdAt)} +   + Sticky +   + Closed +   + [ + {}} style={{textDecoration: "none"}} className="reply-link">Reply + ] + + { + threadMenuRefs.current[subplebbit.statsCid] = el; + }} + className='post-menu-button' + rotated={openMenuCid === subplebbit.statsCid} + onClick={(event) => { + event.stopPropagation(); + const rect = threadMenuRefs.current[subplebbit.statsCid].getBoundingClientRect(); + setMenuPosition({top: rect.top + window.scrollY, left: rect.left}); + setOpenMenuCid(prevCid => (prevCid === subplebbit.statsCid ? null : subplebbit.statsCid)); + }} + > + ▶ + + {createPortal( + {postMenuCatalogRef.current = el}} + onClick={(event) => event.stopPropagation()} + style={{position: "absolute", + top: menuPosition.top + 7, + left: menuPosition.left}}> +
+
    +
  • handleOptionClick(subplebbit.statsCid)}>Hide thread
  • + {/* {isModerator ? ( + <> + change rules + + ) : null} */} +
+
+
, document.body + )} +
+
+
+ {subplebbit.rules.map((rule, index) => ( + + {index + 1}. {rule} +
+
+ ))} +
+
+
+
+
+
+ : null} + {subplebbit.description ? +
+
+
+
+
+ {subplebbit.suggested?.avatarUrl ? ( + + ) : null} + + Welcome to {subplebbit.title || subplebbit.address} +   + ## Board Admins +   + {getDate(subplebbit.createdAt)} +   + Sticky +   + Closed +   + [ + {}} style={{textDecoration: "none"}} className="reply-link">Reply + ] + + { + threadMenuRefs.current[subplebbit.pubsubTopic] = el; + }} + className='post-menu-button' + rotated={openMenuCid === subplebbit.pubsubTopic} + onClick={(event) => { + event.stopPropagation(); + const rect = threadMenuRefs.current[subplebbit.pubsubTopic].getBoundingClientRect(); + setMenuPosition({top: rect.top + window.scrollY, left: rect.left}); + setOpenMenuCid(prevCid => (prevCid === subplebbit.pubsubTopic ? null : subplebbit.pubsubTopic)); + }} + > + ▶ + + {createPortal( + {postMenuCatalogRef.current = el}} + onClick={(event) => event.stopPropagation()} + style={{position: "absolute", + top: menuPosition.top + 7, + left: menuPosition.left}}> +
+
    +
  • handleOptionClick(subplebbit.pubsubTopic)}>Hide thread
  • + {/* {isModerator ? ( + <> + change description + + ) : null} */} +
+
+
, document.body + )} +
+
+
+ {subplebbit.description} +
+
+
+
+
+
+ : null} { setSelectedParentCid(thread.cid); }} title="Reply to this post">{thread.shortCid}   -   - [ - setSelectedThread(thread.cid)} className="reply-link" >Reply - ] - -   {thread.pinned ? ( <>   @@ -900,6 +1061,12 @@ const Board = () => { style={{marginBottom: "-3px"}} /> ) : null} +   + [ + setSelectedThread(thread.cid)} className="reply-link" >Reply + ] + + { useWindowScroll={true} components={{ Footer: hasMore ? () => : null }} /> + ) : () )}