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) {
|
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;
|
||||||
|
|||||||
+1273
-1271
File diff suppressed because it is too large
Load Diff
+347
-154
@@ -666,88 +666,44 @@ const Catalog = () => {
|
|||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
feed.length > 0 ? (
|
feed.length > 0 ? (
|
||||||
<InfiniteScroll
|
<InfiniteScroll
|
||||||
pageStart={0}
|
pageStart={0}
|
||||||
loadMore={tryLoadMore}
|
loadMore={tryLoadMore}
|
||||||
hasMore={hasMore}
|
hasMore={hasMore}
|
||||||
>
|
>
|
||||||
{feed.map((thread, index) => {
|
{subplebbit.rules ? (
|
||||||
const commentMediaInfo = getCommentMediaInfo(thread);
|
<div className='thread'
|
||||||
const fallbackImgUrl = "assets/filedeleted-res.gif";
|
onMouseOver={() => setIsHoveringOnThread('rules')}
|
||||||
return (
|
onMouseLeave={() => setIsHoveringOnThread('')}>
|
||||||
<div key={`thread-${index}`} className="thread"
|
<BoardForm selectedStyle={selectedStyle} style={{all: 'unset'}}>
|
||||||
onMouseOver={() => {setIsHoveringOnThread(thread.cid)}}
|
<div className='meta' title="(R)eplies / (I)mage Replies">
|
||||||
onMouseLeave={() => {setIsHoveringOnThread('')}}>
|
R:<b>0</b>
|
||||||
{commentMediaInfo?.url ? (
|
<div className='thread-icons'
|
||||||
<Link style={{all: "unset", cursor: "pointer"}} key={`link-${index}`} to={`/p/${selectedAddress}/c/${thread.cid}`}
|
style={{position: 'absolute', top: '-2px', right: '15px'}}>
|
||||||
onClick={() => setSelectedThread(thread.cid)}>
|
<span className="thread-icon sticky-icon" title="Sticky" />
|
||||||
{commentMediaInfo?.type === "webpage" ? (
|
<span className="thread-icon closed-icon" title="Closed" />
|
||||||
thread.thumbnailUrl ? (
|
</div>
|
||||||
<img className="card" key={`img-${index}`}
|
<PostMenu
|
||||||
src={commentMediaInfo.thumbnail} alt={commentMediaInfo.type}
|
style={{ display: isHoveringOnThread === "rules" ? 'inline-block' : 'none',
|
||||||
onError={(e) => {
|
position: 'absolute', lineHeight: '1em', marginTop: '-1px', outline: 'none',
|
||||||
e.target.src = fallbackImgUrl
|
zIndex: '999'}}
|
||||||
e.target.onerror = null;
|
title="Post menu"
|
||||||
}} />
|
ref={el => {
|
||||||
) : null
|
threadMenuRefs.current["rules"] = el;
|
||||||
) : null}
|
postMenuRef.current = el;
|
||||||
{commentMediaInfo?.type === "image" ? (
|
}}
|
||||||
<img className="card" key={`img-${index}`}
|
className='post-menu-button'
|
||||||
src={commentMediaInfo.url} alt={commentMediaInfo.type}
|
id='post-menu-button-catalog'
|
||||||
onError={(e) => {
|
rotated={openMenuCid === "rules"}
|
||||||
e.target.src = fallbackImgUrl
|
onClick={(event) => {
|
||||||
e.target.onerror = null;}} />
|
event.stopPropagation();
|
||||||
) : null}
|
const rect = threadMenuRefs.current["rules"].getBoundingClientRect();
|
||||||
{commentMediaInfo?.type === "video" ? (
|
setMenuPosition({top: rect.top + window.scrollY, left: rect.left});
|
||||||
<video className="card" key={`fti-${index}`}
|
setOpenMenuCid(prevCid => (prevCid === "rules" ? null : "rules"));
|
||||||
src={commentMediaInfo.url}
|
}}
|
||||||
alt={commentMediaInfo.type}
|
>
|
||||||
onError={(e) => e.target.src = fallbackImgUrl} />
|
▶
|
||||||
) : null}
|
</PostMenu>
|
||||||
{commentMediaInfo?.type === "audio" ? (
|
|
||||||
<audio className="card" controls
|
|
||||||
key={`fti-${index}`}
|
|
||||||
src={commentMediaInfo.url}
|
|
||||||
alt={commentMediaInfo.type}
|
|
||||||
onError={(e) => e.target.src = fallbackImgUrl} />
|
|
||||||
) : null}
|
|
||||||
</Link>
|
|
||||||
) : null}
|
|
||||||
<div key={`ti-${index}`} className="thread-icons" >
|
|
||||||
{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>
|
|
||||||
<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>
|
|
||||||
<PostMenu
|
|
||||||
style={{ display: isHoveringOnThread === thread.cid ? 'inline-block' : 'none',
|
|
||||||
position: 'absolute', lineHeight: '1em', marginTop: '-1px', outline: 'none',
|
|
||||||
zIndex: '999'}}
|
|
||||||
key={`pmb-${index}`}
|
|
||||||
title="Post menu"
|
|
||||||
ref={el => {
|
|
||||||
threadMenuRefs.current[thread.cid] = el;
|
|
||||||
postMenuRef.current = el;
|
|
||||||
}}
|
|
||||||
className='post-menu-button'
|
|
||||||
id='post-menu-button-catalog'
|
|
||||||
rotated={openMenuCid === thread.cid}
|
|
||||||
onClick={(event) => {
|
|
||||||
event.stopPropagation();
|
|
||||||
const rect = threadMenuRefs.current[thread.cid].getBoundingClientRect();
|
|
||||||
setMenuPosition({top: rect.top + window.scrollY, left: rect.left});
|
|
||||||
setOpenMenuCid(prevCid => (prevCid === thread.cid ? null : thread.cid));
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
▶
|
|
||||||
</PostMenu>
|
|
||||||
</div>
|
</div>
|
||||||
{createPortal(
|
{createPortal(
|
||||||
<PostMenuCatalog selectedStyle={selectedStyle}
|
<PostMenuCatalog selectedStyle={selectedStyle}
|
||||||
@@ -756,88 +712,325 @@ const Catalog = () => {
|
|||||||
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-${thread.cid}`}
|
<div className={`post-menu-thread post-menu-thread-${"rules"}`}
|
||||||
style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }}
|
style={{ display: openMenuCid === "rules" ? 'block' : 'none' }}
|
||||||
>
|
>
|
||||||
<ul className="post-menu-catalog">
|
<ul className="post-menu-catalog">
|
||||||
<li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li>
|
<li onClick={() => handleOptionClick("rules")}>Hide thread</li>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{/* {isModerator ? (
|
||||||
<>
|
<>
|
||||||
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
|
change rules
|
||||||
<li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li>
|
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null} */}
|
||||||
{isModerator ? (
|
|
||||||
<>
|
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
|
||||||
null
|
|
||||||
) : (
|
|
||||||
<li onClick={() => {
|
|
||||||
setModeratingCommentCid(thread.cid)
|
|
||||||
setIsModerationOpen(true);
|
|
||||||
handleOptionClick(thread.cid);
|
|
||||||
setDeletePost(true);
|
|
||||||
}}>
|
|
||||||
Delete post
|
|
||||||
</li>
|
|
||||||
)}
|
|
||||||
<li
|
|
||||||
onClick={() => {
|
|
||||||
setModeratingCommentCid(thread.cid)
|
|
||||||
setIsModerationOpen(true);
|
|
||||||
handleOptionClick(thread.cid);
|
|
||||||
}}>
|
|
||||||
Mod tools
|
|
||||||
</li>
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
{(commentMediaInfo && (
|
|
||||||
commentMediaInfo.type === 'image' ||
|
|
||||||
(commentMediaInfo.type === 'webpage' &&
|
|
||||||
commentMediaInfo.thumbnail))) ? (
|
|
||||||
<li
|
|
||||||
onMouseOver={() => {setIsImageSearchOpen(true)}}
|
|
||||||
onMouseLeave={() => {setIsImageSearchOpen(false)}}>
|
|
||||||
Image search »
|
|
||||||
<ul className="dropdown-menu post-menu-catalog"
|
|
||||||
style={{display: isImageSearchOpen ? 'block': 'none'}}>
|
|
||||||
<li onClick={() => handleOptionClick(thread.cid)}>
|
|
||||||
<a
|
|
||||||
href={`https://lens.google.com/uploadbyurl?url=${commentMediaInfo.url}`}
|
|
||||||
target="_blank" rel="noreferrer"
|
|
||||||
>Google</a>
|
|
||||||
</li>
|
|
||||||
<li onClick={() => handleOptionClick(thread.cid)}>
|
|
||||||
<a
|
|
||||||
href={`https://yandex.com/images/search?url=${commentMediaInfo.url}`}
|
|
||||||
target="_blank" rel="noreferrer"
|
|
||||||
>Yandex</a>
|
|
||||||
</li>
|
|
||||||
<li onClick={() => handleOptionClick(thread.cid)}>
|
|
||||||
<a
|
|
||||||
href={`https://saucenao.com/search.php?url=${commentMediaInfo.url}`}
|
|
||||||
target="_blank" rel="noreferrer"
|
|
||||||
>SauceNAO</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
) : null
|
|
||||||
}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</PostMenuCatalog>, document.body
|
</PostMenuCatalog>, document.body
|
||||||
)}
|
)}
|
||||||
</BoardForm>
|
</BoardForm>
|
||||||
<Link style={{all: "unset", cursor: "pointer"}} key={`link2-${index}`} to={`/p/${selectedAddress}/c/${thread.cid}`}
|
<Link style={{all: "unset", cursor: "pointer"}} to={() => {}}
|
||||||
onClick={() => setSelectedThread(thread.cid)}>
|
onClick={() => setSelectedThread("rules")}>
|
||||||
<div key={`t-${index}`} className="teaser">
|
<div className="teaser">
|
||||||
<b key={`b2-${index}`}>{thread.title ? `${thread.title}` : null}</b>
|
<b>Rules</b>
|
||||||
{thread.content ? `: ${thread.content}` : null}
|
{": " + subplebbit.rules.map((rule, index) => `${index + 1}. ${rule}`).join(' ')}
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
)})}
|
) : null}
|
||||||
</InfiniteScroll>
|
{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";
|
||||||
|
return (
|
||||||
|
<div key={`thread-${index}`} className="thread"
|
||||||
|
onMouseOver={() => {setIsHoveringOnThread(thread.cid)}}
|
||||||
|
onMouseLeave={() => {setIsHoveringOnThread('')}}>
|
||||||
|
{commentMediaInfo?.url ? (
|
||||||
|
<Link style={{all: "unset", cursor: "pointer"}} key={`link-${index}`} to={`/p/${selectedAddress}/c/${thread.cid}`}
|
||||||
|
onClick={() => setSelectedThread(thread.cid)}>
|
||||||
|
{commentMediaInfo?.type === "webpage" ? (
|
||||||
|
thread.thumbnailUrl ? (
|
||||||
|
<img className="card" key={`img-${index}`}
|
||||||
|
src={commentMediaInfo.thumbnail} alt={commentMediaInfo.type}
|
||||||
|
onError={(e) => {
|
||||||
|
e.target.src = fallbackImgUrl
|
||||||
|
e.target.onerror = null;
|
||||||
|
}} />
|
||||||
|
) : null
|
||||||
|
) : null}
|
||||||
|
{commentMediaInfo?.type === "image" ? (
|
||||||
|
<img className="card" key={`img-${index}`}
|
||||||
|
src={commentMediaInfo.url} alt={commentMediaInfo.type}
|
||||||
|
onError={(e) => {
|
||||||
|
e.target.src = fallbackImgUrl
|
||||||
|
e.target.onerror = null;}} />
|
||||||
|
) : null}
|
||||||
|
{commentMediaInfo?.type === "video" ? (
|
||||||
|
<video className="card" key={`fti-${index}`}
|
||||||
|
src={commentMediaInfo.url}
|
||||||
|
alt={commentMediaInfo.type}
|
||||||
|
onError={(e) => e.target.src = fallbackImgUrl} />
|
||||||
|
) : null}
|
||||||
|
{commentMediaInfo?.type === "audio" ? (
|
||||||
|
<audio className="card" controls
|
||||||
|
key={`fti-${index}`}
|
||||||
|
src={commentMediaInfo.url}
|
||||||
|
alt={commentMediaInfo.type}
|
||||||
|
onError={(e) => e.target.src = fallbackImgUrl} />
|
||||||
|
) : 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" />
|
||||||
|
) : null}
|
||||||
|
{thread.locked ? (
|
||||||
|
<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',
|
||||||
|
zIndex: '999'}}
|
||||||
|
key={`pmb-${index}`}
|
||||||
|
title="Post menu"
|
||||||
|
ref={el => {
|
||||||
|
threadMenuRefs.current[thread.cid] = el;
|
||||||
|
postMenuRef.current = el;
|
||||||
|
}}
|
||||||
|
className='post-menu-button'
|
||||||
|
id='post-menu-button-catalog'
|
||||||
|
rotated={openMenuCid === thread.cid}
|
||||||
|
onClick={(event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
const rect = threadMenuRefs.current[thread.cid].getBoundingClientRect();
|
||||||
|
setMenuPosition({top: rect.top + window.scrollY, left: rect.left});
|
||||||
|
setOpenMenuCid(prevCid => (prevCid === thread.cid ? null : thread.cid));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
▶
|
||||||
|
</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-${thread.cid}`}
|
||||||
|
style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }}
|
||||||
|
>
|
||||||
|
<ul className="post-menu-catalog">
|
||||||
|
<li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li>
|
||||||
|
{thread.author.shortAddress === account?.author.shortAddress ? (
|
||||||
|
<>
|
||||||
|
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
|
||||||
|
<li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
{isModerator ? (
|
||||||
|
<>
|
||||||
|
{thread.author.shortAddress === account?.author.shortAddress ? (
|
||||||
|
null
|
||||||
|
) : (
|
||||||
|
<li onClick={() => {
|
||||||
|
setModeratingCommentCid(thread.cid)
|
||||||
|
setIsModerationOpen(true);
|
||||||
|
handleOptionClick(thread.cid);
|
||||||
|
setDeletePost(true);
|
||||||
|
}}>
|
||||||
|
Delete post
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
<li
|
||||||
|
onClick={() => {
|
||||||
|
setModeratingCommentCid(thread.cid)
|
||||||
|
setIsModerationOpen(true);
|
||||||
|
handleOptionClick(thread.cid);
|
||||||
|
}}>
|
||||||
|
Mod tools
|
||||||
|
</li>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
{(commentMediaInfo && (
|
||||||
|
commentMediaInfo.type === 'image' ||
|
||||||
|
(commentMediaInfo.type === 'webpage' &&
|
||||||
|
commentMediaInfo.thumbnail))) ? (
|
||||||
|
<li
|
||||||
|
onMouseOver={() => {setIsImageSearchOpen(true)}}
|
||||||
|
onMouseLeave={() => {setIsImageSearchOpen(false)}}>
|
||||||
|
Image search »
|
||||||
|
<ul className="dropdown-menu post-menu-catalog"
|
||||||
|
style={{display: isImageSearchOpen ? 'block': 'none'}}>
|
||||||
|
<li onClick={() => handleOptionClick(thread.cid)}>
|
||||||
|
<a
|
||||||
|
href={`https://lens.google.com/uploadbyurl?url=${commentMediaInfo.url}`}
|
||||||
|
target="_blank" rel="noreferrer"
|
||||||
|
>Google</a>
|
||||||
|
</li>
|
||||||
|
<li onClick={() => handleOptionClick(thread.cid)}>
|
||||||
|
<a
|
||||||
|
href={`https://yandex.com/images/search?url=${commentMediaInfo.url}`}
|
||||||
|
target="_blank" rel="noreferrer"
|
||||||
|
>Yandex</a>
|
||||||
|
</li>
|
||||||
|
<li onClick={() => handleOptionClick(thread.cid)}>
|
||||||
|
<a
|
||||||
|
href={`https://saucenao.com/search.php?url=${commentMediaInfo.url}`}
|
||||||
|
target="_blank" rel="noreferrer"
|
||||||
|
>SauceNAO</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</PostMenuCatalog>, document.body
|
||||||
|
)}
|
||||||
|
</BoardForm>
|
||||||
|
<Link style={{all: "unset", cursor: "pointer"}} key={`link2-${index}`} to={`/p/${selectedAddress}/c/${thread.cid}`}
|
||||||
|
onClick={() => setSelectedThread(thread.cid)}>
|
||||||
|
<div key={`t-${index}`} className="teaser">
|
||||||
|
<b key={`b2-${index}`}>{thread.title ? `${thread.title}` : null}</b>
|
||||||
|
{thread.content ? `: ${thread.content}` : null}
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)})}
|
||||||
|
</InfiniteScroll>
|
||||||
) : (<CatalogLoader />)
|
) : (<CatalogLoader />)
|
||||||
)}
|
)}
|
||||||
</Threads>
|
</Threads>
|
||||||
|
|||||||
Reference in New Issue
Block a user