Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/plebbit/plebchan
Browse files Browse the repository at this point in the history
  • Loading branch information
plebeius-eth committed Jul 1, 2023
2 parents bb278b4 + 0e3aa5f commit a15a545
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 26 deletions.
12 changes: 6 additions & 6 deletions src/components/styled/views/Board.styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,7 @@ export const BoardForm = styled.div`
}
.op-container {
display: inline;
display: grid;
}
.op {
Expand Down Expand Up @@ -2327,7 +2327,7 @@ export const BoardForm = styled.div`
}
.op-container {
display: inline;
display: grid;
}
.op {
Expand Down Expand Up @@ -2500,7 +2500,7 @@ export const BoardForm = styled.div`
}
.op-container {
display: inline;
display: grid;
}
.op {
Expand Down Expand Up @@ -2671,7 +2671,7 @@ export const BoardForm = styled.div`
}
.op-container {
display: inline;
display: grid;
}
.op {
Expand Down Expand Up @@ -2839,7 +2839,7 @@ export const BoardForm = styled.div`
}
.op-container {
display: inline;
display: grid;
}
.op {
Expand Down Expand Up @@ -3017,7 +3017,7 @@ export const BoardForm = styled.div`
}
.op-container {
display: inline;
display: grid;
}
.op {
Expand Down
146 changes: 138 additions & 8 deletions src/components/views/Board.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,20 @@ const Board = () => {
selectedStyle,
setSelectedThread,
setSelectedText,
selectedTitle, setSelectedTitle,
setSelectedTitle,
showPostForm,
showPostFormLink,
setTriggerInsertion,
} = useGeneralStore(state => state);

const { anonymousMode } = useAnonModeStore();

// temporary hardcode
const plebtokenRules = [
"This community is strictly SFW. Any NSFW language or content will be removed.",
<span>Only post about the plebbit token ($PLEB). For general cryptocurrency discussion, go to <Link className='quotelink' to="/p/business-and-finance.eth">p/business-and-finance.eth</Link>.</span>,
"FUD is allowed unless blatantly meaningless and spammy."
]

const account = useAccount();
const navigate = useNavigate();
Expand Down Expand Up @@ -623,7 +630,7 @@ const Board = () => {
return (
<>
<Helmet>
<title>{((selectedTitle ? selectedTitle : selectedAddress) + " - plebchan")}</title>
<title>{((subplebbit.title ? subplebbit.title : subplebbit.address) + " - plebchan")}</title>
</Helmet>
<Container>
<AdminListModal
Expand Down Expand Up @@ -831,7 +838,7 @@ const Board = () => {
{subplebbit?.state === "failed" ? (
null
) : (
feed.length > 0 ? (
subplebbit?.state === "succeeded" ? (
<>
{subplebbit.rules ?
<>
Expand Down Expand Up @@ -958,13 +965,136 @@ const Board = () => {
</div>
</div>
</>
: null}
: subplebbit.address === "plebtoken.eth" ? (
<>
<div className="thread">
<div className="op-container">
<div className="post op op-desktop">
<hr />
<div className="post-info">
<span className="name-block">
<span className="title">Rules</span>
&nbsp;
<span className="name capcode"
style={{cursor: 'pointer'}}
onClick={() => {setIsAdminListOpen(!isAdminListOpen)}}
>## Board Admins</span>
&nbsp;
<span className="date-time">{getDate(subplebbit.createdAt)}</span>
&nbsp;
<img src="assets/sticky.gif" alt="Sticky" title="Sticky" style={{marginBottom: "-1px",
imageRendering: "pixelated",}} />
&nbsp;
<img src="assets/closed.gif" alt="Closed" title="Closed" style={{marginBottom: "-1px",
imageRendering: "pixelated",}} />
<span>&nbsp;
[
<Link to={`/p/${selectedAddress}/rules`} style={{textDecoration: "none"}} className="reply-link">Reply</Link>
]
</span>
<PostMenu
title="Post menu"
ref={el => {
threadMenuRefs.current["rules"] = el;
}}
className='post-menu-button'
rotated={openMenuCid === "rules"}
onClick={(event) => {
event.stopPropagation();
const rect = threadMenuRefs.current["rules"].getBoundingClientRect();
setMenuPosition({top: rect.top + window.scrollY, left: rect.left});
setOpenMenuCid(prevCid => (prevCid === "rules" ? null : "rules"));
}}
>
</PostMenu>
{createPortal(
<PostMenuCatalog selectedStyle={selectedStyle}
ref={el => {postMenuCatalogRef.current = el}}
onClick={(event) => event.stopPropagation()}
style={{position: "absolute",
top: menuPosition.top + 7,
left: menuPosition.left}}>
<div className={`post-menu-thread post-menu-thread-${"rules"}`}
style={{ display: openMenuCid === "rules" ? 'block' : 'none' }}
>
<ul className="post-menu-catalog">
<li onClick={() => handleOptionClick("rules")}>Hide thread</li>
{/* {isModerator ? (
<>
change rules
</>
) : null} */}
</ul>
</div>
</PostMenuCatalog>, document.body
)}
</span>
<blockquote>
<div className="custom-paragraph">
{plebtokenRules.map((rule, index) => (
<React.Fragment key={index}>
{index + 1}. {rule}
<br />
</React.Fragment>
))}
</div>
</blockquote>
</div>
</div>
</div>
</div>
<div className="thread-mobile">
<hr style={{marginTop: "10px"}} />
<div className="op-container">
<div className="post op op-mobile">
<div className="post-info-mobile">
<button className="post-menu-button-mobile"
style={{ all: 'unset', cursor: 'pointer' }}>...</button>
<span className="name-block-mobile">
<span className="name-mobile capcode"
style={{cursor: 'pointer'}}
onClick={() => {setIsAdminListOpen(!isAdminListOpen)}}
>## Board Admins</span>
&nbsp;
<span className="thread-icons-mobile"
style={{float: "right", marginRight: "18px"}}>
<img src="assets/sticky.gif" alt="Sticky" title="Sticky" style={{marginTop: "-1px", marginRight: "2px",
imageRendering: "pixelated",}} />
&nbsp;
<img src="assets/closed.gif" alt="Closed" title="Closed" style={{marginTop: "-1px", marginRight: "2px",
imageRendering: "pixelated",}} />
</span>
<br />
<span className="subject-mobile"
style={{marginBottom: "-15px"}}>Rules</span>
&nbsp;
</span>
<span className="date-time-mobile post-number-mobile">{getDate(subplebbit.createdAt)}</span>
&nbsp;
</div>
<blockquote className="post-message-mobile">
<div className="custom-paragraph">
{plebtokenRules.map((rule, index) => (
<React.Fragment key={index}>
{index + 1}. {rule}
<br />
</React.Fragment>
))}
</div>
</blockquote>
</div>
<div className="post-link-mobile">
<Link to={`/p/${selectedAddress}/rules`} className="button-mobile">View Thread</Link>
</div>
</div>
</div>
</>
) : null}
{subplebbit.description ?
<>
<div className="thread">
<div className="op-container" style={{
display: subplebbit.rules ? "grid" : "block"
}}>
<div className="op-container">
<div className="post op op-desktop">
<hr />
<div className="post-info">
Expand Down Expand Up @@ -2549,7 +2679,7 @@ const Board = () => {
}}
endReached={tryLoadMore}
useWindowScroll={true}
components={{ Footer: hasMore ? () => <PostLoader /> : null }}
components={{ Footer: hasMore && feed.length > 0 ? () => <PostLoader /> : null }}
/>
</>
) : (<PostLoader />)
Expand Down
49 changes: 37 additions & 12 deletions src/components/views/Rules.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ const Rules = () => {
selectedThread, setSelectedThread,
setSelectedTitle,
} = useGeneralStore(state => state);

// temporary hardcode
const plebtokenRules = [
"This community is strictly SFW. Any NSFW language or content will be removed.",
<span>Only post about the plebbit token ($PLEB). For general cryptocurrency discussion, go to <Link className='quotelink' to="/p/business-and-finance.eth">p/business-and-finance.eth</Link>.</span>,
"FUD is allowed unless blatantly meaningless and spammy."
]

const navigate = useNavigate();

Expand Down Expand Up @@ -332,12 +339,21 @@ const Rules = () => {
</span>
<blockquote >
<div className="custom-paragraph" style={{paddingBottom: '17px'}}>
{subplebbit.rules?.map((rule, index) => (
<React.Fragment key={index}>
{index + 1}. {rule}
<br />
</React.Fragment>
))}
{subplebbit.address === "plebtoken.eth" ? (
plebtokenRules.map((rule, index) => (
<React.Fragment key={index}>
{index + 1}. {rule}
<br />
</React.Fragment>
))
) : (
subplebbit.rules?.map((rule, index) => (
<React.Fragment key={index}>
{index + 1}. {rule}
<br />
</React.Fragment>
))
)}
</div>
</blockquote>
</div>
Expand Down Expand Up @@ -373,12 +389,21 @@ const Rules = () => {
</div>
<blockquote className="post-message-mobile">
<div className="custom-paragraph">
{subplebbit.rules?.map((rule, index) => (
<React.Fragment key={index}>
{index + 1}. {rule}
<br />
</React.Fragment>
))}
{subplebbit.address === "plebtoken.eth" ? (
plebtokenRules.map((rule, index) => (
<React.Fragment key={index}>
{index + 1}. {rule}
<br />
</React.Fragment>
))
) : (
subplebbit.rules?.map((rule, index) => (
<React.Fragment key={index}>
{index + 1}. {rule}
<br />
</React.Fragment>
))
)}
</div>
</blockquote>
</div>
Expand Down

0 comments on commit a15a545

Please sign in to comment.