mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
add catalog rules and description
This commit is contained in:
@@ -3266,6 +3266,9 @@ export const BoardForm = styled.div`
|
||||
switch (selectedStyle) {
|
||||
case 'Yotsuba':
|
||||
return `
|
||||
.capcode {
|
||||
color: purple !important;
|
||||
}
|
||||
.op-container {
|
||||
background-color: #f5e9e1;
|
||||
border: 1px solid #d9bfb7 !important;
|
||||
@@ -3383,6 +3386,9 @@ export const BoardForm = styled.div`
|
||||
|
||||
case 'Yotsuba-B':
|
||||
return `
|
||||
.capcode {
|
||||
color: purple !important;
|
||||
}
|
||||
.op-container {
|
||||
background-color: #d6daf0;
|
||||
border: 1px solid #b7c5d9 !important;
|
||||
@@ -3496,6 +3502,9 @@ export const BoardForm = styled.div`
|
||||
|
||||
case 'Futaba':
|
||||
return `
|
||||
.capcode {
|
||||
color: purple !important;
|
||||
}
|
||||
.op-container {
|
||||
background-color: #f5e9e1;
|
||||
border: 1px solid #d9bfb7 !important;
|
||||
@@ -3612,6 +3621,9 @@ export const BoardForm = styled.div`
|
||||
|
||||
case 'Burichan':
|
||||
return `
|
||||
.capcode {
|
||||
color: purple !important;
|
||||
}
|
||||
.op-container {
|
||||
background-color: #d6daf0;
|
||||
border: 1px solid #b7c5d9 !important;
|
||||
@@ -3724,6 +3736,10 @@ export const BoardForm = styled.div`
|
||||
|
||||
case 'Tomorrow':
|
||||
return `
|
||||
.capcode {
|
||||
color: #81a2be !important;
|
||||
}
|
||||
|
||||
.op-container {
|
||||
background-color: #282A2E;
|
||||
border: 1px solid #2D2F33 !important;
|
||||
@@ -3846,6 +3862,9 @@ export const BoardForm = styled.div`
|
||||
|
||||
case 'Photon':
|
||||
return `
|
||||
.capcode {
|
||||
color: #f60 !important;
|
||||
}
|
||||
.op-container {
|
||||
background-color: #eee;
|
||||
border: 1px solid #ccc !important;
|
||||
|
||||
@@ -790,15 +790,15 @@ const Board = () => {
|
||||
<PostMenu
|
||||
title="Post menu"
|
||||
ref={el => {
|
||||
threadMenuRefs.current[subplebbit.statsCid] = el;
|
||||
threadMenuRefs.current["rules"] = el;
|
||||
}}
|
||||
className='post-menu-button'
|
||||
rotated={openMenuCid === subplebbit.statsCid}
|
||||
rotated={openMenuCid === "rules"}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
const rect = threadMenuRefs.current[subplebbit.statsCid].getBoundingClientRect();
|
||||
const rect = threadMenuRefs.current["rules"].getBoundingClientRect();
|
||||
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",
|
||||
top: menuPosition.top + 7,
|
||||
left: menuPosition.left}}>
|
||||
<div className={`post-menu-thread post-menu-thread-${subplebbit.statsCid}`}
|
||||
style={{ display: openMenuCid === subplebbit.statsCid ? 'block' : 'none' }}
|
||||
<div className={`post-menu-thread post-menu-thread-${"rules"}`}
|
||||
style={{ display: openMenuCid === "rules" ? 'block' : 'none' }}
|
||||
>
|
||||
<ul className="post-menu-catalog">
|
||||
<li onClick={() => handleOptionClick(subplebbit.statsCid)}>Hide thread</li>
|
||||
<li onClick={() => handleOptionClick("rules")}>Hide thread</li>
|
||||
{/* {isModerator ? (
|
||||
<>
|
||||
change rules
|
||||
@@ -856,7 +856,8 @@ const Board = () => {
|
||||
<img src="assets/closed.gif" alt="Closed" title="Closed" style={{marginBottom: "-3px"}} />
|
||||
</span>
|
||||
<br />
|
||||
<span className="subject-mobile">Rules</span>
|
||||
<span className="subject-mobile"
|
||||
style={{marginBottom: "-15px"}}>Rules</span>
|
||||
|
||||
</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"}} />
|
||||
</span>
|
||||
<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>
|
||||
|
||||
</span>
|
||||
<span className="date-time-mobile post-number-mobile">{getDate(subplebbit.createdAt)}</span>
|
||||
|
||||
@@ -671,6 +671,178 @@ const Catalog = () => {
|
||||
loadMore={tryLoadMore}
|
||||
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) => {
|
||||
const commentMediaInfo = getCommentMediaInfo(thread);
|
||||
const fallbackImgUrl = "assets/filedeleted-res.gif";
|
||||
@@ -713,6 +885,11 @@ const Catalog = () => {
|
||||
) : null}
|
||||
</Link>
|
||||
) : null}
|
||||
{(commentMediaInfo && (
|
||||
commentMediaInfo.type === 'image' ||
|
||||
commentMediaInfo.type === 'video' ||
|
||||
(commentMediaInfo.type === 'webpage' &&
|
||||
commentMediaInfo.thumbnail))) ? (
|
||||
<div key={`ti-${index}`} className="thread-icons" >
|
||||
{thread.pinned ? (
|
||||
<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" />
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
<BoardForm selectedStyle={selectedStyle}
|
||||
style={{ all: "unset"}}>
|
||||
<div key={`meta-${index}`} className="meta" title="(R)eplies / (I)mage Replies" >
|
||||
R:
|
||||
<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
|
||||
style={{ display: isHoveringOnThread === thread.cid ? 'inline-block' : 'none',
|
||||
position: 'absolute', lineHeight: '1em', marginTop: '-1px', outline: 'none',
|
||||
|
||||
Reference in New Issue
Block a user