add catalog rules and description

This commit is contained in:
plebeius.eth
2023-06-17 12:51:30 +02:00
parent 08e072b795
commit 1abaf3faf2
3 changed files with 1637 additions and 1423 deletions
@@ -3266,6 +3266,9 @@ export const BoardForm = styled.div`
switch (selectedStyle) { switch (selectedStyle) {
case 'Yotsuba': case 'Yotsuba':
return ` return `
.capcode {
color: purple !important;
}
.op-container { .op-container {
background-color: #f5e9e1; background-color: #f5e9e1;
border: 1px solid #d9bfb7 !important; border: 1px solid #d9bfb7 !important;
@@ -3383,6 +3386,9 @@ export const BoardForm = styled.div`
case 'Yotsuba-B': case 'Yotsuba-B':
return ` return `
.capcode {
color: purple !important;
}
.op-container { .op-container {
background-color: #d6daf0; background-color: #d6daf0;
border: 1px solid #b7c5d9 !important; border: 1px solid #b7c5d9 !important;
@@ -3496,6 +3502,9 @@ export const BoardForm = styled.div`
case 'Futaba': case 'Futaba':
return ` return `
.capcode {
color: purple !important;
}
.op-container { .op-container {
background-color: #f5e9e1; background-color: #f5e9e1;
border: 1px solid #d9bfb7 !important; border: 1px solid #d9bfb7 !important;
@@ -3612,6 +3621,9 @@ export const BoardForm = styled.div`
case 'Burichan': case 'Burichan':
return ` return `
.capcode {
color: purple !important;
}
.op-container { .op-container {
background-color: #d6daf0; background-color: #d6daf0;
border: 1px solid #b7c5d9 !important; border: 1px solid #b7c5d9 !important;
@@ -3724,6 +3736,10 @@ export const BoardForm = styled.div`
case 'Tomorrow': case 'Tomorrow':
return ` return `
.capcode {
color: #81a2be !important;
}
.op-container { .op-container {
background-color: #282A2E; background-color: #282A2E;
border: 1px solid #2D2F33 !important; border: 1px solid #2D2F33 !important;
@@ -3846,6 +3862,9 @@ export const BoardForm = styled.div`
case 'Photon': case 'Photon':
return ` return `
.capcode {
color: #f60 !important;
}
.op-container { .op-container {
background-color: #eee; background-color: #eee;
border: 1px solid #ccc !important; border: 1px solid #ccc !important;
+11 -9
View File
@@ -790,15 +790,15 @@ const Board = () => {
<PostMenu <PostMenu
title="Post menu" title="Post menu"
ref={el => { ref={el => {
threadMenuRefs.current[subplebbit.statsCid] = el; threadMenuRefs.current["rules"] = el;
}} }}
className='post-menu-button' className='post-menu-button'
rotated={openMenuCid === subplebbit.statsCid} rotated={openMenuCid === "rules"}
onClick={(event) => { onClick={(event) => {
event.stopPropagation(); event.stopPropagation();
const rect = threadMenuRefs.current[subplebbit.statsCid].getBoundingClientRect(); const rect = threadMenuRefs.current["rules"].getBoundingClientRect();
setMenuPosition({top: rect.top + window.scrollY, left: rect.left}); setMenuPosition({top: rect.top + window.scrollY, left: rect.left});
setOpenMenuCid(prevCid => (prevCid === subplebbit.statsCid ? null : subplebbit.statsCid)); setOpenMenuCid(prevCid => (prevCid === "rules" ? null : "rules"));
}} }}
> >
@@ -810,11 +810,11 @@ const Board = () => {
style={{position: "absolute", style={{position: "absolute",
top: menuPosition.top + 7, top: menuPosition.top + 7,
left: menuPosition.left}}> left: menuPosition.left}}>
<div className={`post-menu-thread post-menu-thread-${subplebbit.statsCid}`} <div className={`post-menu-thread post-menu-thread-${"rules"}`}
style={{ display: openMenuCid === subplebbit.statsCid ? 'block' : 'none' }} style={{ display: openMenuCid === "rules" ? 'block' : 'none' }}
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(subplebbit.statsCid)}>Hide thread</li> <li onClick={() => handleOptionClick("rules")}>Hide thread</li>
{/* {isModerator ? ( {/* {isModerator ? (
<> <>
change rules change rules
@@ -856,7 +856,8 @@ const Board = () => {
<img src="assets/closed.gif" alt="Closed" title="Closed" style={{marginBottom: "-3px"}} /> <img src="assets/closed.gif" alt="Closed" title="Closed" style={{marginBottom: "-3px"}} />
</span> </span>
<br /> <br />
<span className="subject-mobile">Rules</span> <span className="subject-mobile"
style={{marginBottom: "-15px"}}>Rules</span>
&nbsp; &nbsp;
</span> </span>
<span className="date-time-mobile post-number-mobile">{getDate(subplebbit.createdAt)}</span> <span className="date-time-mobile post-number-mobile">{getDate(subplebbit.createdAt)}</span>
@@ -992,7 +993,8 @@ const Board = () => {
<img src="assets/closed.gif" alt="Closed" title="Closed" style={{marginBottom: "-3px"}} /> <img src="assets/closed.gif" alt="Closed" title="Closed" style={{marginBottom: "-3px"}} />
</span> </span>
<br /> <br />
<span className="subject-mobile">Welcome to {subplebbit.title || subplebbit.address}</span> <span className="subject-mobile"
style={{marginBottom: "-15px"}}>Welcome to {subplebbit.title || subplebbit.address}</span>
&nbsp; &nbsp;
</span> </span>
<span className="date-time-mobile post-number-mobile">{getDate(subplebbit.createdAt)}</span> <span className="date-time-mobile post-number-mobile">{getDate(subplebbit.createdAt)}</span>
+193
View File
@@ -671,6 +671,178 @@ const Catalog = () => {
loadMore={tryLoadMore} loadMore={tryLoadMore}
hasMore={hasMore} hasMore={hasMore}
> >
{subplebbit.rules ? (
<div className='thread'
onMouseOver={() => setIsHoveringOnThread('rules')}
onMouseLeave={() => setIsHoveringOnThread('')}>
<BoardForm selectedStyle={selectedStyle} style={{all: 'unset'}}>
<div className='meta' title="(R)eplies / (I)mage Replies">
R:<b>0</b>
<div className='thread-icons'
style={{position: 'absolute', top: '-2px', right: '15px'}}>
<span className="thread-icon sticky-icon" title="Sticky" />
<span className="thread-icon closed-icon" title="Closed" />
</div>
<PostMenu
style={{ display: isHoveringOnThread === "rules" ? 'inline-block' : 'none',
position: 'absolute', lineHeight: '1em', marginTop: '-1px', outline: 'none',
zIndex: '999'}}
title="Post menu"
ref={el => {
threadMenuRefs.current["rules"] = el;
postMenuRef.current = el;
}}
className='post-menu-button'
id='post-menu-button-catalog'
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>
</div>
{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
)}
</BoardForm>
<Link style={{all: "unset", cursor: "pointer"}} to={() => {}}
onClick={() => setSelectedThread("rules")}>
<div className="teaser">
<b>Rules</b>
{": " + subplebbit.rules.map((rule, index) => `${index + 1}. ${rule}`).join(' ')}
</div>
</Link>
</div>
) : null}
{subplebbit.description ? (
<div className='thread'
onMouseOver={() => setIsHoveringOnThread('description')}
onMouseLeave={() => setIsHoveringOnThread('')}>
<Link style={{all: 'unset', cursor: 'pointer'}} to={() => {}}>
{subplebbit.suggested?.avatarUrl ? (
<img className='card'
src={subplebbit.suggested.avatarUrl} alt="board avatar" />
) : null}
</Link>
{subplebbit.suggested?.avatarUrl ? (
<div className='thread-icons'>
<span className="thread-icon sticky-icon" title="Sticky" />
<span className="thread-icon closed-icon" title="Closed" />
</div>
) : null}
<BoardForm selectedStyle={selectedStyle} style={{all: 'unset'}}>
<div className='meta' title="(R)eplies / (I)mage Replies">
R:<b>0</b>
{subplebbit.suggested?.avatarUrl ? null : (
<div className='thread-icons'
style={{position: 'absolute', top: '-2px', right: '15px'}}>
<span className="thread-icon sticky-icon" title="Sticky" />
<span className="thread-icon closed-icon" title="Closed" />
</div>
)}
<PostMenu
style={{ display: isHoveringOnThread === "description" ? 'inline-block' : 'none',
position: 'absolute', lineHeight: '1em', marginTop: '-1px', outline: 'none',
zIndex: '999'}}
title="Post menu"
ref={el => {
threadMenuRefs.current["description"] = el;
postMenuRef.current = el;
}}
className='post-menu-button'
id='post-menu-button-catalog'
rotated={openMenuCid === "description"}
onClick={(event) => {
event.stopPropagation();
const rect = threadMenuRefs.current["description"].getBoundingClientRect();
setMenuPosition({top: rect.top + window.scrollY, left: rect.left});
setOpenMenuCid(prevCid => (prevCid === "description" ? null : "description"));
}}
>
</PostMenu>
</div>
{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-${"description"}`}
style={{ display: openMenuCid === "description" ? 'block' : 'none' }}
>
<ul className="post-menu-catalog">
<li onClick={() => handleOptionClick("description")}>Hide thread</li>
{/* {isModerator ? (
<>
change description
</>
) : null} */}
{subplebbit.suggested?.avatarUrl ? (
<li
onMouseOver={() => {setIsImageSearchOpen(true)}}
onMouseLeave={() => {setIsImageSearchOpen(false)}}>
Image search »
<ul className="dropdown-menu post-menu-catalog"
style={{display: isImageSearchOpen ? 'block': 'none'}}>
<li onClick={() => handleOptionClick("description")}>
<a
href={`https://lens.google.com/uploadbyurl?url=${subplebbit.suggested.avatarUrl}`}
target="_blank" rel="noreferrer"
>Google</a>
</li>
<li onClick={() => handleOptionClick("description")}>
<a
href={`https://yandex.com/images/search?url=${subplebbit.suggested.avatarUrl}`}
target="_blank" rel="noreferrer"
>Yandex</a>
</li>
<li onClick={() => handleOptionClick("description")}>
<a
href={`https://saucenao.com/search.php?url=${subplebbit.suggested.avatarUrl}`}
target="_blank" rel="noreferrer"
>SauceNAO</a>
</li>
</ul>
</li>
) : null}
</ul>
</div>
</PostMenuCatalog>, document.body
)}
</BoardForm>
<Link style={{all: "unset", cursor: "pointer"}} to={() => {}}
onClick={() => setSelectedThread("description")}>
<div className="teaser">
<b>Welcome to {subplebbit.title || subplebbit.address}</b>
{": " + subplebbit.description}
</div>
</Link>
</div>
) : null}
{feed.map((thread, index) => { {feed.map((thread, index) => {
const commentMediaInfo = getCommentMediaInfo(thread); const commentMediaInfo = getCommentMediaInfo(thread);
const fallbackImgUrl = "assets/filedeleted-res.gif"; const fallbackImgUrl = "assets/filedeleted-res.gif";
@@ -713,6 +885,11 @@ const Catalog = () => {
) : null} ) : null}
</Link> </Link>
) : null} ) : null}
{(commentMediaInfo && (
commentMediaInfo.type === 'image' ||
commentMediaInfo.type === 'video' ||
(commentMediaInfo.type === 'webpage' &&
commentMediaInfo.thumbnail))) ? (
<div key={`ti-${index}`} className="thread-icons" > <div key={`ti-${index}`} className="thread-icons" >
{thread.pinned ? ( {thread.pinned ? (
<span key={`si-${index}`} className="thread-icon sticky-icon" title="Sticky" /> <span key={`si-${index}`} className="thread-icon sticky-icon" title="Sticky" />
@@ -721,11 +898,27 @@ const Catalog = () => {
<span key={`li-${index}`} className="thread-icon closed-icon" title="Closed" /> <span key={`li-${index}`} className="thread-icon closed-icon" title="Closed" />
) : null} ) : null}
</div> </div>
) : null}
<BoardForm selectedStyle={selectedStyle} <BoardForm selectedStyle={selectedStyle}
style={{ all: "unset"}}> style={{ all: "unset"}}>
<div key={`meta-${index}`} className="meta" title="(R)eplies / (I)mage Replies" > <div key={`meta-${index}`} className="meta" title="(R)eplies / (I)mage Replies" >
R: R:
<b key={`b-${index}`}>{thread.replyCount}</b> <b key={`b-${index}`}>{thread.replyCount}</b>
{(commentMediaInfo && (
commentMediaInfo.type === 'image' ||
commentMediaInfo.type === 'video' ||
(commentMediaInfo.type === 'webpage' &&
commentMediaInfo.thumbnail))) ? null : (
<div className='thread-icons'
style={{position: 'absolute', top: '-2px', right: '15px'}}>
{thread.pinned ? (
<span key={`si-${index}`} className="thread-icon sticky-icon" title="Sticky" />
) : null}
{thread.locked ? (
<span key={`li-${index}`} className="thread-icon closed-icon" title="Closed" />
) : null}
</div>
)}
<PostMenu <PostMenu
style={{ display: isHoveringOnThread === thread.cid ? 'inline-block' : 'none', style={{ display: isHoveringOnThread === thread.cid ? 'inline-block' : 'none',
position: 'absolute', lineHeight: '1em', marginTop: '-1px', outline: 'none', position: 'absolute', lineHeight: '1em', marginTop: '-1px', outline: 'none',