2023-04-03 15:08:45 +02:00
import React , { useState , useEffect , useRef } from 'react' ;
2023-03-20 17:08:05 +01:00
import { Link , useNavigate , useParams } from 'react-router-dom' ;
2023-03-23 15:49:57 +01:00
import { Tooltip } from 'react-tooltip' ;
2023-03-24 18:08:07 +01:00
import { useComment , usePublishComment } from '@plebbit/plebbit-react-hooks' ;
2023-03-25 14:54:04 +01:00
import { debounce } from 'lodash' ;
2023-04-08 13:27:17 +02:00
import useGeneralStore from '../../hooks/stores/useGeneralStore' ;
2023-04-09 08:37:29 +02:00
import { Container , NavBar , Header , Break , PostForm , PostFormTable , BoardForm } from '../styled/Board.styled' ;
import { ReplyFormLink , TopBar , BottomBar } from '../styled/Thread.styled' ;
2023-03-19 11:49:05 +01:00
import CaptchaModal from '../CaptchaModal' ;
2023-03-19 18:30:07 +01:00
import ImageBanner from '../ImageBanner' ;
2023-03-29 13:37:36 +02:00
import Post from '../Post' ;
2023-03-19 18:30:07 +01:00
import PostLoader from '../PostLoader' ;
2023-03-19 11:49:05 +01:00
import ReplyModal from '../ReplyModal' ;
import SettingsModal from '../SettingsModal' ;
2023-03-23 15:49:57 +01:00
import getCommentMediaInfo from '../../utils/getCommentMediaInfo' ;
import getDate from '../../utils/getDate' ;
2023-03-20 17:08:05 +01:00
import handleStyleChange from '../../utils/handleStyleChange' ;
2023-03-19 11:49:05 +01:00
import renderThreadComments from '../../utils/renderThreadComments' ;
2023-03-20 17:08:05 +01:00
import useClickForm from '../../hooks/useClickForm' ;
2023-04-04 14:42:22 +02:00
import useError from '../../hooks/useError' ;
import useSuccess from '../../hooks/useSuccess' ;
2023-02-12 21:20:08 +01:00
2023-03-02 21:51:06 +01:00
2023-03-20 17:08:05 +01:00
const Thread = () => {
2023-03-13 14:29:34 +01:00
const {
2023-03-20 17:08:05 +01:00
captchaResponse , setCaptchaResponse ,
defaultSubplebbits ,
isSettingsOpen , setIsSettingsOpen ,
selectedAddress , setSelectedAddress ,
2023-03-13 14:29:34 +01:00
selectedStyle ,
2023-03-20 17:08:05 +01:00
selectedThread , setSelectedThread ,
selectedTitle , setSelectedTitle ,
showPostForm ,
showPostFormLink
2023-04-08 13:27:17 +02:00
} = useGeneralStore ( state => state );
2023-03-20 17:08:05 +01:00
2023-04-03 15:08:45 +02:00
const nameRef = useRef ();
const commentRef = useRef ();
const linkRef = useRef ();
2023-03-12 22:07:15 +01:00
const [ isCaptchaOpen , setIsCaptchaOpen ] = useState ( false );
2023-03-17 14:35:03 +01:00
const [ isReplyOpen , setIsReplyOpen ] = useState ( false );
2023-03-12 22:07:15 +01:00
const [ captchaImage , setCaptchaImage ] = useState ( '' );
2023-02-12 21:20:08 +01:00
const navigate = useNavigate ();
2023-02-24 20:57:51 +01:00
const [ prevScrollPos , setPrevScrollPos ] = useState ( 0 );
const [ visible , setVisible ] = useState ( true );
2023-03-25 15:34:10 +01:00
const comment = useComment ({ commentCid : selectedThread });
2023-03-02 18:19:08 +01:00
const { subplebbitAddress , threadCid } = useParams ();
2023-03-20 17:08:05 +01:00
const handleClickForm = useClickForm ();
2023-02-20 22:17:04 +01:00
2023-03-23 15:49:57 +01:00
const commentMediaInfo = getCommentMediaInfo ( comment );
const fallbackImgUrl = "/assets/filedeleted-res.gif" ;
2023-04-04 14:42:22 +02:00
const [ errorMessage , setErrorMessage ] = useState ( null );
const [ successMessage , setSuccessMessage ] = useState ( null );
useError ( errorMessage , [ errorMessage ]);
useSuccess ( successMessage , [ successMessage ]);
2023-04-01 13:59:54 +02:00
2023-03-25 15:34:10 +01:00
// useEffect(() => {
// console.log(comment);
// }, [comment]);
2023-03-08 09:49:42 +01:00
// temporary title from JSON, gets subplebbitAddress and threadCid from URL
2023-03-02 18:19:08 +01:00
useEffect (() => {
setSelectedAddress ( subplebbitAddress );
setSelectedThread ( threadCid );
const selectedSubplebbit = defaultSubplebbits . find (( subplebbit ) => subplebbit . address === subplebbitAddress );
if ( selectedSubplebbit ) {
setSelectedTitle ( selectedSubplebbit . title );
}
}, [ subplebbitAddress , setSelectedAddress , setSelectedTitle , defaultSubplebbits ]);
2023-02-12 21:20:08 +01:00
2023-03-08 09:49:42 +01:00
// mobile navbar scroll effect
2023-02-24 20:57:51 +01:00
useEffect (() => {
2023-03-25 14:54:04 +01:00
const debouncedHandleScroll = debounce (() => {
2023-02-24 20:57:51 +01:00
const currentScrollPos = window . pageYOffset ;
setVisible ( prevScrollPos > currentScrollPos || currentScrollPos < 10 );
setPrevScrollPos ( currentScrollPos );
2023-03-25 14:54:04 +01:00
}, 50 );
window . addEventListener ( 'scroll' , debouncedHandleScroll );
return () => window . removeEventListener ( 'scroll' , debouncedHandleScroll );
2023-02-24 20:57:51 +01:00
}, [ prevScrollPos , visible ]);
2023-03-02 21:51:06 +01:00
2023-03-20 17:08:05 +01:00
2023-03-12 10:27:59 +01:00
const onChallengeVerification = ( challengeVerification ) => {
if ( challengeVerification . challengeSuccess === true ) {
2023-04-04 14:42:22 +02:00
setSuccessMessage ( 'challenge success' , { publishedCid : challengeVerification . publication . cid })
2023-03-12 10:27:59 +01:00
}
else if ( challengeVerification . challengeSuccess === false ) {
2023-04-04 14:42:22 +02:00
setErrorMessage ( 'challenge failed' , { reason : challengeVerification . reason , errors : challengeVerification . errors });
setErrorMessage ( "Error: You seem to have mistyped the CAPTCHA. Please try again." );
2023-03-12 10:27:59 +01:00
}
2023-04-01 13:59:54 +02:00
};
2023-03-12 10:27:59 +01:00
const onChallenge = async ( challenges , comment ) => {
2023-04-03 15:08:45 +02:00
// console.log("onChallenge:", challenges, comment);
2023-03-12 10:27:59 +01:00
let challengeAnswers = [];
try {
challengeAnswers = await getChallengeAnswersFromUser ( challenges )
}
catch ( error ) {
2023-04-04 14:42:22 +02:00
setErrorMessage ( error );
2023-03-12 10:27:59 +01:00
}
if ( challengeAnswers ) {
await comment . publishChallengeAnswers ( challengeAnswers )
}
2023-04-01 13:59:54 +02:00
};
2023-03-12 10:27:59 +01:00
2023-04-03 15:08:45 +02:00
const publishCommentOptions = {
displayName : nameRef . current ? nameRef . current . value : undefined ,
content : commentRef . current ? commentRef . current . value : undefined ,
link : linkRef . current ? linkRef . current . value : undefined ,
parentCid : selectedThread ,
subplebbitAddress : selectedAddress ,
onChallenge ,
onChallengeVerification ,
};
const resetFields = () => {
nameRef . current . value = '' ;
commentRef . current . value = '' ;
linkRef . current . value = '' ;
};
const { publishComment } = usePublishComment ( publishCommentOptions );
2023-03-12 10:27:59 +01:00
const getChallengeAnswersFromUser = async ( challenges ) => {
return new Promise (( resolve , reject ) => {
const imageString = challenges ? . challenges [ 0 ]. challenge ;
const imageSource = `data:image/png;base64, ${ imageString } ` ;
const challengeImg = new Image ();
challengeImg . src = imageSource ;
challengeImg . onload = () => {
2023-03-12 22:07:15 +01:00
setIsCaptchaOpen ( true );
setCaptchaImage ( imageSource );
2023-03-12 10:27:59 +01:00
const handleKeyDown = ( event ) => {
if ( event . key === 'Enter' ) {
2023-03-12 22:07:15 +01:00
setCaptchaImage ( '' );
resolve ( captchaResponse );
setIsCaptchaOpen ( false );
2023-03-12 10:27:59 +01:00
document . removeEventListener ( 'keydown' , handleKeyDown );
2023-04-03 15:08:45 +02:00
event . preventDefault ();
2023-03-12 10:27:59 +01:00
}
};
2023-03-12 22:07:15 +01:00
setCaptchaResponse ( '' );
2023-03-12 10:27:59 +01:00
document . addEventListener ( 'keydown' , handleKeyDown );
};
challengeImg . onerror = () => {
2023-04-04 14:42:22 +02:00
reject ( setErrorMessage ( 'Could not load challenge image' ));
2023-03-12 10:27:59 +01:00
};
});
};
2023-03-08 09:49:42 +01:00
// mobile navbar board select functionality
2023-02-27 18:16:47 +01:00
const handleSelectChange = ( event ) => {
const selected = event . target . value ;
const selectedTitle = defaultSubplebbits . find (( subplebbit ) => subplebbit . address === selected ). title ;
setSelectedTitle ( selectedTitle );
setSelectedAddress ( selected );
2023-04-08 22:30:44 +02:00
navigate ( `/p/ ${ selected } ` );
2023-02-12 21:20:08 +01:00
};
2023-03-02 21:51:06 +01:00
2023-03-08 09:49:42 +01:00
// scroll to post when quote is clicked
function handleQuoteClick ( reply , event ) {
event . preventDefault ();
2023-03-30 22:17:42 +02:00
const cid = reply . shortCid ;
2023-03-08 09:49:42 +01:00
const targetElement = [... document . querySelectorAll ( '.post-reply' )]
. find ( el => el . innerHTML . includes ( cid ));
if ( targetElement ) {
targetElement . scrollIntoView ({ behavior : "instant" });
}
2023-03-12 22:07:15 +01:00
};
2023-03-02 21:51:06 +01:00
2023-02-12 21:20:08 +01:00
return (
< Container >
2023-03-12 22:07:15 +01:00
< CaptchaModal
isOpen = { isCaptchaOpen }
2023-04-01 13:59:54 +02:00
closeModal = {() => setIsCaptchaOpen ( false )}
2023-03-12 22:07:15 +01:00
captchaImage = { captchaImage } />
2023-03-17 14:35:03 +01:00
< ReplyModal
selectedStyle = { selectedStyle }
isOpen = { isReplyOpen }
2023-04-01 13:59:54 +02:00
closeModal = {() => setIsReplyOpen ( false )} />
2023-03-16 14:04:15 +01:00
< SettingsModal
selectedStyle = { selectedStyle }
isOpen = { isSettingsOpen }
2023-04-01 13:59:54 +02:00
closeModal = {() => setIsSettingsOpen ( false )} />
2023-02-12 21:20:08 +01:00
< NavBar selectedStyle = { selectedStyle }>
<>
{ defaultSubplebbits . map ( subplebbit => (
2023-03-11 12:32:42 +01:00
< span className = "boardList" key = { `span- ${ subplebbit . address } ` }>
2023-02-12 21:20:08 +01:00
[
2023-03-11 12:32:42 +01:00
< Link key = { `a- ${ subplebbit . address } ` }
2023-04-08 22:30:44 +02:00
to = { `/p/ ${ subplebbit . address } ` }
2023-04-01 13:59:54 +02:00
onClick = {() => {
setSelectedTitle ( subplebbit . title );
setSelectedAddress ( subplebbit . address );
}}
2023-04-01 14:51:07 +02:00
>{ subplebbit . title ? subplebbit . title : subplebbit . address }</ Link >
2023-02-12 21:20:08 +01:00
] & nbsp ;
</ span >
))}
2023-02-23 16:45:29 +01:00
< span className = "nav" >
[
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } /c/ ${ selectedThread } /settings` } onClick = {() => setIsSettingsOpen ( true )}> Settings </ Link >
2023-02-23 16:45:29 +01:00
]
[
2023-02-12 21:20:08 +01:00
< Link to = "/" onClick = {() => handleStyleChange ({ target : { value : "Yotsuba" }}
2023-02-23 16:45:29 +01:00
)}> Home </ Link >
]
2023-02-12 21:20:08 +01:00
</ span >
2023-02-24 20:57:51 +01:00
< div id = "board-nav-mobile" style = {{ top : visible ? 0 : '-23px' }}>
2023-02-23 16:45:29 +01:00
< div className = "board-select" >
< strong > Board </ strong >
& nbsp ;
2023-02-27 18:16:47 +01:00
< select id = "board-select-mobile" value = { selectedAddress } onChange = { handleSelectChange }>
2023-02-23 16:45:29 +01:00
{ defaultSubplebbits . map ( subplebbit => (
2023-03-11 12:32:42 +01:00
< option key = { `option- ${ subplebbit . address } ` } value = { subplebbit . address }
2023-04-01 14:51:07 +02:00
>{ subplebbit . title ? subplebbit . title : subplebbit . address }</ option >
2023-02-27 15:32:16 +01:00
))}
2023-02-23 16:45:29 +01:00
</ select >
</ div >
< div className = "page-jump" >
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } /c/ ${ selectedThread } /settings` } onClick = {() => setIsSettingsOpen ( true )}> Settings </ Link >
2023-02-23 16:45:29 +01:00
& nbsp ;
< Link to = "/" onClick = {() => handleStyleChange ({ target : { value : "Yotsuba" }}
)}> Home </ Link >
</ div >
</ div >
< div id = "separator-mobile" > & nbsp ;</ div >
< div id = "separator-mobile" > & nbsp ;</ div >
2023-02-12 21:20:08 +01:00
</>
</ NavBar >
< Header selectedStyle = { selectedStyle }>
<>
< div className = "banner" >
< ImageBanner />
</ div >
<>
< div className = "board-title" >{ selectedTitle }</ div >
< div className = "board-address" > p / { selectedAddress }</ div >
</>
</>
</ Header >
< Break selectedStyle = { selectedStyle } />
< PostForm selectedStyle = { selectedStyle } name = "post" action = "" method = "post" enctype = "multipart/form-data" >
2023-03-06 14:33:31 +01:00
< ReplyFormLink id = "post-form-link" showReplyFormLink = { showPostFormLink } selectedStyle = { selectedStyle } >
2023-02-24 18:13:02 +01:00
< div id = "return-button-mobile" >
< span className = "btn-wrap" >
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } ` }> Return </ Link >
2023-02-24 18:13:02 +01:00
</ span >
</ div >
< div id = "catalog-button-mobile" >
< span className = "btn-wrap" >
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } /catalog` }> Catalog </ Link >
2023-02-24 18:13:02 +01:00
</ span >
</ div >
< div id = "bottom-button-mobile" >
< span className = "btn-wrap" >
2023-04-01 13:59:54 +02:00
< a onClick = {() => window . scrollTo ( 0 , document . body . scrollHeight )} onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }> Bottom </ a >
2023-02-24 18:13:02 +01:00
</ span >
</ div >
< div id = "post-form-link-desktop" >
2023-02-12 21:20:08 +01:00
[
2023-02-21 14:49:00 +01:00
< a onClick = { handleClickForm } onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }> Post a Reply </ a >
2023-02-12 21:20:08 +01:00
]
2023-02-24 18:13:02 +01:00
</ div >
< div id = "post-form-link-mobile" >
< span className = "btn-wrap" >
< a onClick = { handleClickForm } onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }> Post a Reply </ a >
</ span >
</ div >
2023-02-12 21:20:08 +01:00
</ ReplyFormLink >
2023-03-12 10:27:59 +01:00
< PostFormTable id = "post-form" showPostForm = { showPostForm } selectedStyle = { selectedStyle } className = "post-form" >
2023-02-12 21:20:08 +01:00
< tbody >
2023-03-12 10:27:59 +01:00
< tr data - type = "Name" >
< td id = "td-name" > Name </ td >
2023-02-12 21:20:08 +01:00
< td >
2023-04-03 15:08:45 +02:00
< input name = "name" type = "text" tabIndex = { 1 } placeholder = "Anonymous" ref = { nameRef } />
< input id = "post-button" type = "submit" value = "Post" tabIndex = { 6 }
onClick = { async () => { await publishComment (); resetFields ();}} />
2023-02-12 21:20:08 +01:00
</ td >
</ tr >
< tr data - type = "Comment" >
< td > Comment </ td >
< td >
2023-04-03 15:08:45 +02:00
< textarea name = "com" cols = "48" rows = "4" tabIndex = { 4 } wrap = "soft" ref = { commentRef } />
2023-02-12 21:20:08 +01:00
</ td >
</ tr >
< tr data - type = "File" >
< td > Embed File </ td >
< td >
2023-04-03 15:08:45 +02:00
< input name = "embed" type = "text" tabIndex = { 7 } placeholder = "Paste link" ref = { linkRef } />
2023-04-01 13:59:54 +02:00
< button id = "t-help" type = "button" onClick = {
() => alert ( "- Embedding media is optional, posts can be text-only. \n- A CAPTCHA challenge will appear after posting. \n- The CAPTCHA is case-sensitive." )}
data - tip = "Help"
> ? </ button >
2023-03-12 10:27:59 +01:00
</ td >
</ tr >
2023-02-12 21:20:08 +01:00
</ tbody >
2023-03-12 10:27:59 +01:00
</ PostFormTable >
2023-02-12 21:20:08 +01:00
</ PostForm >
< TopBar selectedStyle = { selectedStyle }>
< hr />
< span className = "style-changer" >
Style :
2023-02-13 12:05:10 +01:00
< select id = "style-selector" onChange = { handleStyleChange } value = { selectedStyle }>
2023-02-12 21:20:08 +01:00
< option value = "Yotsuba" > Yotsuba </ option >
2023-03-08 12:49:44 +01:00
< option value = "Yotsuba-B" > Yotsuba B </ option >
2023-02-12 21:20:08 +01:00
< option value = "Futaba" > Futaba </ option >
< option value = "Burichan" > Burichan </ option >
< option value = "Tomorrow" > Tomorrow </ option >
< option value = "Photon" > Photon </ option >
</ select >
</ span >
2023-02-24 18:13:02 +01:00
< span className = "return-button" id = "return-button-desktop" >
2023-02-13 13:01:10 +01:00
[
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } ` }> Return </ Link >
2023-02-13 13:01:10 +01:00
]
</ span >
2023-02-24 18:13:02 +01:00
< span className = "return-button catalog-button" id = "catalog-button-desktop" >
2023-02-21 22:12:12 +01:00
[
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } /catalog` }> Catalog </ Link >
2023-02-21 22:12:12 +01:00
]
</ span >
2023-02-24 18:13:02 +01:00
< span className = "return-button catalog-button" id = "bottom-button-desktop" >
2023-02-21 22:12:12 +01:00
[
2023-04-01 13:59:54 +02:00
< a onClick = {() => window . scrollTo ( 0 , document . body . scrollHeight )}
onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }
onTouchStart = {() => window . scrollTo ( 0 , document . body . scrollHeight )}> Bottom </ a >
2023-02-21 22:12:12 +01:00
]
</ span >
2023-02-21 14:49:00 +01:00
{ comment ? (
2023-03-18 22:05:46 +01:00
comment . replyCount !== undefined ? (
comment . replyCount > 0 ? (
comment . replyCount === 1 ? (
< span className = "reply-stat" >{ comment . replyCount } reply </ span >
) : (
< span className = "reply-stat" >{ comment . replyCount } replies </ span >
)
) : (
< span className = "reply-stat" > No replies yet </ span >
)
2023-02-21 14:49:00 +01:00
) : (
2023-03-22 15:35:28 +01:00
< span className = "reply-stat" > Fetching IPFS ...</ span >
2023-03-18 22:05:46 +01:00
)
) : (
2023-03-22 15:35:28 +01:00
< span className = "reply-stat" > Fetching IPFS ...</ span >
2023-02-21 14:49:00 +01:00
)}
2023-02-12 21:20:08 +01:00
< hr />
</ TopBar >
2023-03-25 21:38:52 +01:00
< Tooltip id = "tooltip" className = "tooltip" />
2023-02-20 22:17:04 +01:00
< BoardForm selectedStyle = { selectedStyle }>
2023-03-25 15:34:10 +01:00
{ comment !== undefined ? (
2023-02-20 22:17:04 +01:00
<>
< div className = "thread" >
2023-02-27 12:35:23 +01:00
< div className = "op-container" >
2023-02-20 22:17:04 +01:00
< div className = "post op" >
< div className = "post-info" >
2023-03-23 15:49:57 +01:00
{ commentMediaInfo ? . url ? (
< div key = { `f- ${ comment . cid } ` } className = "file" style = {{ marginBottom : "5px" }}>
2023-03-11 12:32:42 +01:00
< div key = { `ft- ${ comment . cid } ` } className = "file-text" >
2023-03-23 15:49:57 +01:00
Link :& nbsp ;
< a key = { `fa- ${ comment . cid } ` } href = { commentMediaInfo . url } target = "_blank" >{
commentMediaInfo ? . url . length > 30 ?
commentMediaInfo ? . url . slice ( 0 , 30 ) + "(...)" :
commentMediaInfo ? . url
}</ a > & nbsp ;({ commentMediaInfo ? . type })
2023-02-22 16:31:45 +01:00
</ div >
2023-03-23 15:49:57 +01:00
{ commentMediaInfo ? . type === "webpage" ? (
< span key = { `fta- ${ comment . cid } ` } className = "file-thumb" >
< img key = { `fti- ${ comment . cid } ` } src = { comment . thumbnailUrl } alt = "thumbnail" onError = {( e ) => e . target . src = fallbackImgUrl } />
</ span >
) : null }
{ commentMediaInfo ? . type === "image" ? (
< span key = { `fta- ${ comment . cid } ` } className = "file-thumb" >
< img key = { `fti- ${ comment . cid } ` } src = { commentMediaInfo . url } alt = { commentMediaInfo . type } onError = {( e ) => e . target . src = fallbackImgUrl } />
</ span >
) : null }
{ commentMediaInfo ? . type === "video" ? (
< span key = { `fta- ${ comment . cid } ` } className = "file-thumb" >
2023-03-26 14:39:09 +02:00
< video controls key = { `fti- ${ comment . cid } ` } src = { commentMediaInfo . url } alt = { commentMediaInfo . type } onError = {( e ) => e . target . src = fallbackImgUrl } />
2023-03-23 15:49:57 +01:00
</ span >
) : null }
{ commentMediaInfo ? . type === "audio" ? (
< span key = { `fta- ${ comment . cid } ` } className = "file-thumb" >
2023-04-01 17:19:23 +02:00
< audio controls key = { `fti- ${ comment . cid } ` } src = { commentMediaInfo . url } alt = { commentMediaInfo . type } onError = {( e ) => e . target . src = fallbackImgUrl } />
2023-03-23 15:49:57 +01:00
</ span >
) : null }
2023-02-22 16:31:45 +01:00
</ div >
2023-03-23 15:49:57 +01:00
) : null }
2023-02-20 22:17:04 +01:00
< span className = "name-block" >
2023-03-01 17:55:35 +01:00
{ comment . title ? (
comment . title . length > 75 ?
<>
2023-03-11 12:32:42 +01:00
< span key = { `q- ${ comment . cid } ` } className = "title"
2023-03-25 21:38:52 +01:00
data - tooltip - id = "tooltip"
2023-03-01 17:55:35 +01:00
data - tooltip - content = { comment . title }
data - tooltip - place = "top" >
{ comment . title . slice ( 0 , 75 ) + " (...)" }
</ span >
</>
2023-03-11 12:32:42 +01:00
: < span key = { `q- ${ comment . cid } ` } className = "title" >
2023-03-01 17:55:35 +01:00
{ comment . title }
</ span >)
: null }
2023-02-22 11:22:36 +01:00
& nbsp ;
2023-03-22 12:59:51 +01:00
{ comment . author ? . displayName
? comment . author ? . displayName . length > 20
2023-03-01 17:55:35 +01:00
? <>
2023-03-11 12:32:42 +01:00
< span key = { `n- ${ comment . cid } ` } className = "name"
2023-03-25 21:38:52 +01:00
data - tooltip - id = "tooltip"
2023-03-22 12:59:51 +01:00
data - tooltip - content = { comment . author ? . displayName }
2023-03-01 17:55:35 +01:00
data - tooltip - place = "top" >
2023-03-22 12:59:51 +01:00
{ comment . author ? . displayName . slice ( 0 , 20 ) + " (...)" }
2023-03-01 17:55:35 +01:00
</ span >
</>
2023-03-11 12:32:42 +01:00
: < span key = { `n- ${ comment . cid } ` } className = "name" >
2023-03-22 12:59:51 +01:00
{ comment . author ? . displayName }</ span >
2023-03-11 12:32:42 +01:00
: < span key = { `n- ${ comment . cid } ` } className = "name" >
2023-03-01 17:55:35 +01:00
Anonymous </ span >}
& nbsp ;
2023-02-20 22:17:04 +01:00
& nbsp ;
< span className = "poster-address" >
2023-03-05 14:15:51 +01:00
( u /
2023-03-29 14:36:41 +02:00
< span key = { `pa- ${ comment . cid } ` } className = "poster-address" >
{ comment . author ? . shortAddress }
</ span >)
2023-02-20 22:17:04 +01:00
</ span >
2023-02-22 11:22:36 +01:00
& nbsp ;
2023-03-24 18:08:07 +01:00
< span className = "date-time" data - utc = "data" >{ getDate ( comment ? . timestamp )}</ span >
2023-02-22 11:22:36 +01:00
& nbsp ;
< span className = "post-number" >
2023-04-01 13:59:54 +02:00
< Link to = "" onClick = {() => {}} title = "Link to this post" > c / </ Link >
< button id = "reply-button" style = {{ all : 'unset' , cursor : 'pointer' }} onClick = {() => setIsReplyOpen ( true )} title = "Reply to this post" >{ comment . shortCid }</ button >
2023-03-16 13:55:39 +01:00
</ span > & nbsp ; & nbsp ;
2023-04-01 13:59:54 +02:00
< button key = { `pmb- ${ comment . cid } ` } className = "post-menu-button" onClick = {() => {}} title = "Post menu" style = {{ all : 'unset' , cursor : 'pointer' }}> ▶ </ button >
2023-02-22 11:22:36 +01:00
< div id = "backlink-id" className = "backlink" >
2023-03-07 18:00:00 +01:00
{ comment . replies ? . pages . topAll . comments
. sort (( a , b ) => a . timestamp - b . timestamp )
2023-03-28 11:23:27 +02:00
. map (( reply ) => (
< div key = { `div- ${ reply . cid } ` } style = {{ display : 'inline-block' }}>
2023-04-01 13:59:54 +02:00
< Link to = {() => {}} key = { `ql- ${ reply . cid } ` }
2023-03-08 09:49:42 +01:00
className = "quote-link"
onClick = {( event ) => handleQuoteClick ( reply , event )}>
2023-03-30 22:17:42 +02:00
c / { reply . shortCid }</ Link >
2023-03-07 18:00:00 +01:00
& nbsp ;
</ div >
))
}
2023-02-22 11:22:36 +01:00
</ div >
</ span >
2023-03-29 13:37:36 +02:00
< blockquote key = { `blockquote- ${ comment . cid } ` }>
< Post content = { comment . content } key = { `post- ${ comment . cid } ` } />
2023-02-20 22:17:04 +01:00
</ blockquote >
</ div >
</ div >
</ div >
2023-03-20 17:11:09 +01:00
{ comment . replyCount === undefined ? < PostLoader /> : null }
2023-02-21 22:12:12 +01:00
{ comment . replyCount > 0 &&
Object . keys ( comment . replies . pages . topAll . comments ). map (() => {
2023-03-08 09:49:42 +01:00
const renderedComments = renderThreadComments ( comment . replies . pages . topAll . comments );
2023-02-21 22:12:12 +01:00
return renderedComments . map ( reply => {
2023-03-29 16:38:54 +02:00
const replyMediaInfo = getCommentMediaInfo ( reply );
const fallbackImgUrl = "/assets/filedeleted-res.gif" ;
2023-02-20 22:17:04 +01:00
return (
2023-03-25 21:38:52 +01:00
< div key = { `pc- ${ reply . cid } - ${ Math . random () } ` } className = "reply-container" >
2023-03-11 12:32:42 +01:00
< div key = { `sa- ${ reply . cid } ` } className = "side-arrows" >{ '>>' }</ div >
< div key = { `pr- ${ reply . cid } ` } className = "post-reply" id = "post-reply" >
< div key = { `pi- ${ reply . cid } ` } className = "post-info" >
2023-02-21 22:12:12 +01:00
& nbsp ;
2023-03-11 12:32:42 +01:00
< span key = { `nb- ${ reply . cid } ` } className = "nameblock" >
2023-03-01 17:55:35 +01:00
{ reply . author . displayName
? reply . author . displayName . length > 20
? <>
2023-03-11 12:32:42 +01:00
< span key = { `mob-n- ${ reply . cid } ` } className = "name"
2023-03-25 21:38:52 +01:00
data - tooltip - id = "tooltip"
2023-03-01 17:55:35 +01:00
data - tooltip - content = { reply . author . displayName }
data - tooltip - place = "top" >
{ reply . author . displayName . slice ( 0 , 20 ) + " (...)" }
</ span >
</>
2023-03-11 12:32:42 +01:00
: < span key = { `mob-n- ${ reply . cid } ` } className = "name" >
2023-03-01 17:55:35 +01:00
{ reply . author . displayName }</ span >
2023-03-11 12:32:42 +01:00
: < span key = { `mob-n- ${ reply . cid } ` } className = "name" >
2023-03-01 17:55:35 +01:00
Anonymous </ span >}
2023-02-20 22:17:04 +01:00
& nbsp ;
2023-03-11 12:32:42 +01:00
< span key = { `pa- ${ reply . cid } ` } className = "poster-address" >
2023-03-05 14:15:51 +01:00
( u /
2023-03-29 14:36:41 +02:00
< span key = { `mob-ha- ${ reply . cid } ` }>
{ reply . author . shortAddress }
</ span >)
2023-02-21 22:12:12 +01:00
</ span >
</ span >
& nbsp ;
2023-03-24 18:08:07 +01:00
< span key = { `dt- ${ reply . cid } ` } className = "date-time" data - utc = "data" >{ getDate ( reply ? . timestamp )}</ span >
2023-02-21 22:12:12 +01:00
& nbsp ;
2023-03-11 12:32:42 +01:00
< span key = { `pn- ${ reply . cid } ` } className = "post-number" >
2023-04-01 13:59:54 +02:00
< Link to = "" key = { `pl1- ${ reply . cid } ` } onClick = {() => {}} title = "Link to this post" > c / </ Link >
< button id = "reply-button" style = {{ all : 'unset' , cursor : 'pointer' }} key = { `pl2- ${ reply . cid } ` } onClick = {() => setIsReplyOpen ( true )} title = "Reply to this post" >{ reply . shortCid }</ button >
2023-03-16 13:55:39 +01:00
</ span > & nbsp ;
2023-04-01 13:59:54 +02:00
< button key = { `pmb- ${ reply . cid } ` } className = "post-menu-button" onClick = {() => {}} title = "Post menu" style = {{ all : 'unset' , cursor : 'pointer' }}> ▶ </ button >
2023-03-08 09:49:42 +01:00
< div id = "backlink-id" className = "backlink" >
{ reply . replies ? . pages . topAll . comments
. sort (( a , b ) => a . timestamp - b . timestamp )
2023-03-28 11:23:27 +02:00
. map (( reply ) => (
< div key = { `div- ${ reply . cid } ` } style = {{ display : 'inline-block' }}>
2023-04-01 13:59:54 +02:00
< Link to = {() => {}} key = { `ql- ${ reply . cid } ` }
2023-03-08 09:49:42 +01:00
className = "quote-link"
onClick = {( event ) => handleQuoteClick ( reply , event )}>
2023-03-30 22:17:42 +02:00
c / { reply . shortCid }</ Link >
2023-03-08 09:49:42 +01:00
& nbsp ;
</ div >
))
}
</ div >
2023-02-20 22:17:04 +01:00
</ div >
2023-03-29 16:38:54 +02:00
{ replyMediaInfo ? . url ? (
< div key = { `f- ${ reply . cid } ` } className = "file"
style = {{ marginBottom : "5px" }}>
< div key = { `ft- ${ reply . cid } ` } className = "reply-file-text" >
Link :& nbsp ;
< a key = { `fa- ${ reply . cid } ` } href = { replyMediaInfo . url } target = "_blank" >{
replyMediaInfo ? . url . length > 30 ?
replyMediaInfo ? . url . slice ( 0 , 30 ) + "(...)" :
replyMediaInfo ? . url
}</ a > & nbsp ;({ replyMediaInfo ? . type })
</ div >
{ replyMediaInfo ? . type === "webpage" ? (
< span key = { `fta- ${ reply . cid } ` } className = "file-thumb-reply" >
< img key = { `fti- ${ reply . cid } ` }
src = { reply . thumbnailUrl }
alt = "thumbnail"
onError = {( e ) => e . target . src = fallbackImgUrl } />
</ span >
) : null }
{ replyMediaInfo ? . type === "image" ? (
< span key = { `fta- ${ reply . cid } ` } className = "file-thumb-reply" >
< img key = { `fti- ${ reply . cid } ` }
src = { replyMediaInfo . url }
alt = { replyMediaInfo . type }
onError = {( e ) => e . target . src = fallbackImgUrl } />
</ span >
) : null }
{ replyMediaInfo ? . type === "video" ? (
< span key = { `fta- ${ reply . cid } ` } className = "file-thumb-reply" >
< video controls
key = { `fti- ${ reply . cid } ` }
src = { replyMediaInfo . url } alt = { replyMediaInfo . type }
onError = {( e ) => e . target . src = fallbackImgUrl } />
</ span >
) : null }
{ replyMediaInfo ? . type === "audio" ? (
< span key = { `fta- ${ reply . cid } ` } className = "file-thumb-reply" >
< audio controls
key = { `fti- ${ reply . cid } ` }
src = { replyMediaInfo . url } alt = { replyMediaInfo . type }
onError = {( e ) => e . target . src = fallbackImgUrl } />
</ span >
) : null }
</ div >
) : null }
2023-03-11 12:32:42 +01:00
< blockquote key = { `pm- ${ reply . cid } ` } className = "post-message" >
2023-04-01 13:59:54 +02:00
< Link to = {() => {}} className = "quote-link"
2023-03-08 09:49:42 +01:00
onClick = {( event ) => handleQuoteClick ( reply , event )}>
2023-03-06 14:49:59 +01:00
{ `c/ ${ reply . parentCid . slice ( 0 , 8 ) } ` }{< br />}
2023-03-07 13:54:14 +01:00
</ Link >
2023-03-29 13:37:36 +02:00
< Post content = { reply . content } key = { `post- ${ reply . cid } ` } />
2023-02-21 22:12:12 +01:00
</ blockquote >
</ div >
</ div >
2023-02-20 22:17:04 +01:00
)
})
2023-02-21 22:12:12 +01:00
})}
2023-02-27 12:35:23 +01:00
</ div >
2023-03-25 21:38:52 +01:00
< div className = "thread-mobile" key = "thread-mobile" >
2023-02-27 12:35:23 +01:00
< hr />
2023-03-25 21:38:52 +01:00
< div className = "op-container" key = "op-container" >
2023-03-11 12:32:42 +01:00
< div key = { `mob-po- ${ comment . cid } ` } className = "post op" >
< div key = { `mob-pi- ${ comment . cid } ` } className = "post-info-mobile" >
2023-04-01 13:59:54 +02:00
< button style = {{ all : 'unset' , cursor : 'pointer' }} key = { `mob-pb- ${ comment . cid } ` } className = "post-menu-button-mobile" onClick = {() => {}}>...</ button >
2023-02-27 12:35:23 +01:00
< span className = "name-block-mobile" >
2023-03-22 12:59:51 +01:00
{ comment . author ? . displayName
? comment . author ? . displayName . length > 15
2023-02-28 16:34:33 +01:00
? <>
2023-03-11 12:32:42 +01:00
< span key = { `mob-n- ${ comment . cid } ` } className = "name-mobile"
2023-03-25 21:38:52 +01:00
data - tooltip - id = "tooltip"
2023-03-22 12:59:51 +01:00
data - tooltip - content = { comment . author ? . displayName }
2023-02-28 16:34:33 +01:00
data - tooltip - place = "top" >
2023-03-22 12:59:51 +01:00
{ comment . author ? . displayName . slice ( 0 , 15 ) + " (...)" }
2023-02-28 16:34:33 +01:00
</ span >
</>
2023-03-11 12:32:42 +01:00
: < span key = { `mob-n- ${ comment . cid } ` } className = "name-mobile" >
2023-03-22 12:59:51 +01:00
{ comment . author ? . displayName }</ span >
2023-03-11 12:32:42 +01:00
: < span key = { `mob-n- ${ comment . cid } ` } className = "name-mobile" >
2023-02-28 16:34:33 +01:00
Anonymous </ span >}
2023-02-27 12:35:23 +01:00
& nbsp ;
2023-03-11 12:32:42 +01:00
< span key = { `mob-pa- ${ comment . cid } ` } className = "poster-address-mobile" >
2023-03-05 14:15:51 +01:00
( u /
2023-03-29 14:36:41 +02:00
< span key = { `mob-ha- ${ comment . cid } ` } className = "highlight-address-mobile" >
{ comment . author ? . shortAddress }
</ span >
2023-02-28 16:34:33 +01:00
) & nbsp ;
2023-02-27 12:35:23 +01:00
</ span >
2023-03-11 12:32:42 +01:00
< br key = { `mob-br1- ${ comment . cid } ` } />
2023-02-28 16:34:33 +01:00
{ comment . title ? (
comment . title . length > 30 ?
<>
2023-03-11 12:32:42 +01:00
< span key = { `mob-t- ${ comment . cid } ` } className = "subject-mobile"
2023-03-25 21:38:52 +01:00
data - tooltip - id = "tooltip"
2023-02-28 16:34:33 +01:00
data - tooltip - content = { comment . title }
data - tooltip - place = "top" >
{ comment . title . slice ( 0 , 30 ) + " (...)" }
</ span >
</>
2023-03-11 12:32:42 +01:00
: < span key = { `mob-t- ${ comment . cid } ` } className = "subject-mobile" >
2023-02-28 16:34:33 +01:00
{ comment . title }
</ span >) : null }
2023-02-27 12:35:23 +01:00
</ span >
2023-03-11 12:32:42 +01:00
< span key = { `mob-dt- ${ comment . cid } ` } className = "date-time-mobile" >
2023-03-24 18:08:07 +01:00
{ getDate ( comment ? . timestamp )}
2023-02-27 12:35:23 +01:00
& nbsp ;
2023-04-01 13:59:54 +02:00
< button id = "reply-button" style = {{ all : 'unset' , cursor : 'pointer' }} key = { `mob-no- ${ comment . cid } ` } onClick = {() => setIsReplyOpen ( true )} title = "Link to this post" > c / </ button >
< Link to = "" key = { `mob-no2- ${ comment . cid } ` } onClick = {() => {}} title = "Reply to this post" >{ comment . cid ? . slice ( 0 , 8 )}</ Link >
2023-02-27 12:35:23 +01:00
</ span >
</ div >
2023-03-23 16:23:59 +01:00
{ commentMediaInfo ? . url ? (
commentMediaInfo . type === "webpage" ? (
< div key = { `mob-f- ${ comment . cid } ` } className = "file-mobile" >
< span key = { `mob-ft ${ comment . cid } ` } className = "file-thumb-mobile" >
< img key = { `mob-img- ${ comment . cid } ` } src = { comment . thumbnailUrl } alt = "thumbnail" onError = {( e ) => e . target . src = fallbackImgUrl } />
< div key = { `mob-fi- ${ comment . cid } ` } className = "file-info-mobile" >{ commentMediaInfo . type }</ div >
</ span >
</ div >
) : commentMediaInfo . type === "image" ? (
< div key = { `mob-f- ${ comment . cid } ` } className = "file-mobile" >
< span key = { `mob-ft ${ comment . cid } ` } className = "file-thumb-mobile" >
< img key = { `mob-img- ${ comment . cid } ` } src = { commentMediaInfo . url } alt = { commentMediaInfo . type } onError = {( e ) => e . target . src = fallbackImgUrl } />
< div key = { `mob-fi- ${ comment . cid } ` } className = "file-info-mobile" >{ commentMediaInfo . type }</ div >
</ span >
</ div >
) : commentMediaInfo . type === "video" ? (
< div key = { `mob-f- ${ comment . cid } ` } className = "file-mobile" >
< span key = { `mob-ft ${ comment . cid } ` } className = "file-thumb-mobile" >
2023-03-26 14:39:09 +02:00
< video controls key = { `mob-img- ${ comment . cid } ` } src = { commentMediaInfo . url } alt = { commentMediaInfo . type } onError = {( e ) => e . target . src = fallbackImgUrl } />
2023-03-23 16:23:59 +01:00
< div key = { `mob-fi- ${ comment . cid } ` } className = "file-info-mobile" >{ commentMediaInfo . type }</ div >
</ span >
</ div >
) : commentMediaInfo . type === "audio" ? (
< div key = { `mob-f- ${ comment . cid } ` } className = "file-mobile" >
< span key = { `mob-ft ${ comment . cid } ` } className = "file-thumb-mobile" >
2023-04-01 17:19:23 +02:00
< audio controls key = { `mob-img- ${ comment . cid } ` } src = { commentMediaInfo . url } alt = { commentMediaInfo . type } onError = {( e ) => e . target . src = fallbackImgUrl } />
2023-03-23 16:23:59 +01:00
< div key = { `mob-fi- ${ comment . cid } ` } className = "file-info-mobile" >{ commentMediaInfo . type }</ div >
</ span >
</ div >
) : null
) : null }
2023-03-11 12:32:42 +01:00
< blockquote key = { `mob-bq- ${ comment . cid } ` } className = "post-message-mobile" >
2023-02-27 12:35:23 +01:00
{ comment . content ? (
<>
2023-03-29 13:37:36 +02:00
< Post content = { comment . content } key = { `post-mobile- ${ comment . cid } ` } />
2023-02-27 12:35:23 +01:00
</>
) : null }
</ blockquote >
</ div >
</ div >
2023-03-20 17:11:09 +01:00
{ comment . replyCount === undefined ? < PostLoader /> : null }
2023-02-27 12:35:23 +01:00
{ comment . replyCount > 0 &&
Object . keys ( comment . replies . pages . topAll . comments ). map (() => {
2023-03-08 09:49:42 +01:00
const renderedComments = renderThreadComments ( comment . replies . pages . topAll . comments );
2023-02-27 12:35:23 +01:00
return renderedComments . map ( reply => {
return (
2023-03-25 21:38:52 +01:00
< div key = { `mob-rc- ${ reply . cid } - ${ Math . random () } ` } className = "reply-container" >
2023-03-11 12:32:42 +01:00
< div key = { `mob-pr- ${ reply . cid } ` } className = "post-reply" >
< div key = { `mob-pi- ${ reply . cid } ` } className = "post-info-mobile" >
2023-03-16 13:55:39 +01:00
< button className = "post-menu-button-mobile" title = "Post menu" style = {{ all : 'unset' , cursor : 'pointer' }}>...</ button >
2023-03-11 12:32:42 +01:00
< span key = { `mob-nb- ${ reply . cid } ` } className = "name-block-mobile" >
2023-02-28 16:34:33 +01:00
{ reply . author . displayName
? reply . author . displayName . length > 12
? <>
2023-03-11 12:32:42 +01:00
< span key = { `mob-n- ${ reply . cid } ` } className = "name-mobile"
2023-03-25 21:38:52 +01:00
data - tooltip - id = "tooltip"
2023-02-28 16:34:33 +01:00
data - tooltip - content = { reply . author . displayName }
data - tooltip - place = "top" >
{ reply . author . displayName . slice ( 0 , 12 ) + " (...)" }
</ span >
</>
2023-03-11 12:32:42 +01:00
: < span key = { `mob-n- ${ reply . cid } ` } className = "name-mobile" >
2023-02-28 16:34:33 +01:00
{ reply . author . displayName }</ span >
2023-03-11 12:32:42 +01:00
: < span key = { `mob-n- ${ reply . cid } ` } className = "name-mobile" >
2023-02-28 16:34:33 +01:00
Anonymous </ span >}
2023-02-27 12:35:23 +01:00
& nbsp ;
2023-03-11 12:32:42 +01:00
< span key = { `mob-pa- ${ reply . cid } ` } className = "poster-address-mobile" >
2023-03-05 14:15:51 +01:00
( u /
2023-03-29 14:36:41 +02:00
< span key = { `mob-ha- ${ reply . cid } ` } className = "highlight-address-mobile" >
{ reply . author . shortAddress }
</ span >
2023-02-27 12:35:23 +01:00
)
</ span >
2023-03-11 12:32:42 +01:00
< br key = { `mob-br- ${ reply . cid } ` } />
2023-02-27 12:35:23 +01:00
</ span >
2023-03-11 12:32:42 +01:00
< span key = { `mob-dt- ${ reply . cid } ` } className = "date-time-mobile" >
2023-03-24 18:08:07 +01:00
{ getDate ( reply ? . timestamp )} & nbsp ;
2023-04-01 13:59:54 +02:00
< Link to = "" key = { `mob-pl1- ${ reply . cid } ` } onClick = {() => {}} title = "Link to this post" > c / </ Link >
< button id = "reply-button" style = {{ all : 'unset' , cursor : 'pointer' }} key = { `mob-pl2- ${ reply . cid } ` } onClick = {() => setIsReplyOpen ( true )} title = "Reply to this post" >{ reply . shortCid }</ button >
2023-02-27 12:35:23 +01:00
</ span >
</ div >
2023-03-11 12:32:42 +01:00
< blockquote key = { `mob-pm- ${ reply . cid } ` } className = "post-message-mobile" >
2023-04-01 13:59:54 +02:00
< Link to = {() => {}} key = { `mob-ql- ${ reply . cid } ` } className = "quotelink-mobile"
2023-03-08 09:49:42 +01:00
onClick = {( event ) => handleQuoteClick ( reply , event )}>
2023-03-06 14:49:59 +01:00
{ `c/ ${ reply . parentCid . slice ( 0 , 8 ) } ` }{< br />}
2023-03-07 13:54:14 +01:00
</ Link >
2023-03-29 13:37:36 +02:00
< Post content = { reply . content } key = { `post-mobile- ${ reply . cid } ` } />
2023-02-27 12:35:23 +01:00
</ blockquote >
</ div >
</ div >
)
})
})}
</ div >
< BottomBar selectedStyle = { selectedStyle }>
2023-02-24 18:13:02 +01:00
< div id = "bottombar-desktop" >
< hr />
< span className = "bottom-bar-return" >
[
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } ` }> Return </ Link >
2023-02-24 18:13:02 +01:00
]
</ span >
< span className = "bottom-bar-catalog" >
[
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } /catalog` }> Catalog </ Link >
2023-02-24 18:13:02 +01:00
]
</ span >
< span className = "bottom-bar-top" >
[
2023-04-01 13:59:54 +02:00
< a onClick = {() => window . scrollTo ( 0 , 0 )}
onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }
onTouchStart = {() => window . scrollTo ( 0 , 0 )}> Top </ a >
2023-02-24 18:13:02 +01:00
]
</ span >
< span className = "quickreply-button" >
2023-02-21 22:12:12 +01:00
[
2023-04-01 13:59:54 +02:00
< Link to = "" onClick = {() => {}} onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }> Post a Reply </ Link >
2023-02-21 22:12:12 +01:00
]
2023-02-24 18:13:02 +01:00
</ span >
{ comment . replyCount > 0 ? (
< span className = "reply-stat" >{ comment . replyCount } replies </ span >
) : (
< span className = "reply-stat" > No replies yet </ span >
)}
< hr />
</ div >
2023-02-21 22:12:12 +01:00
</ BottomBar >
2023-02-27 12:35:23 +01:00
< div id = "bottombar-mobile" >
< TopBar selectedStyle = { selectedStyle }>
< hr />
< span className = "style-changer" >
Style :
< select id = "style-selector" onChange = { handleStyleChange } value = { selectedStyle }>
< option value = "Yotsuba" > Yotsuba </ option >
2023-03-08 12:49:44 +01:00
< option value = "Yotsuba-B" > Yotsuba B </ option >
2023-02-27 12:35:23 +01:00
< option value = "Futaba" > Futaba </ option >
< option value = "Burichan" > Burichan </ option >
< option value = "Tomorrow" > Tomorrow </ option >
< option value = "Photon" > Photon </ option >
</ select >
</ span >
{ comment ? (
2023-03-18 22:14:31 +01:00
comment . replyCount !== undefined ? (
comment . replyCount > 0 ? (
comment . replyCount === 1 ? (
< span className = "reply-stat" >{ comment . replyCount } reply </ span >
) : (
< span className = "reply-stat" >{ comment . replyCount } replies </ span >
)
) : (
< span className = "reply-stat" > No replies yet </ span >
)
2023-02-27 12:35:23 +01:00
) : (
2023-03-18 22:14:31 +01:00
< span className = "reply-stat" > Loading ...</ span >
)
) : (
2023-02-27 12:35:23 +01:00
null
)}
< hr />
</ TopBar >
2023-03-06 14:33:31 +01:00
< ReplyFormLink id = "post-form-link" selectedStyle = { selectedStyle } >
2023-02-27 12:35:23 +01:00
< div id = "post-form-link-mobile" className = "post-button-mobile" >
< span className = "btn-wrap" >
< a onClick = { handleClickForm } onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }> Post a Reply </ a >
2023-02-24 18:13:02 +01:00
</ span >
2023-02-27 12:35:23 +01:00
</ div >
< div id = "btns-container" >
< div id = "return-button-mobile" >
2023-02-24 18:13:02 +01:00
< span className = "btn-wrap" >
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } ` }> Return </ Link >
2023-02-24 18:13:02 +01:00
</ span >
</ div >
2023-02-27 12:35:23 +01:00
< div id = "catalog-button-mobile" >
< span className = "btn-wrap" >
2023-04-08 22:30:44 +02:00
< Link to = { `/p/ ${ selectedAddress } /catalog` }> Catalog </ Link >
2023-02-24 18:13:02 +01:00
</ span >
</ div >
2023-02-27 12:35:23 +01:00
< span className = "bottom-bar-top" >
< span className = "btn-wrap" >
2023-04-01 13:59:54 +02:00
< a onClick = {() => window . scrollTo ( 0 , 0 )}
onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }
onTouchStart = {() => window . scrollTo ( 0 , 0 )}> Top </ a >
2023-02-27 12:35:23 +01:00
</ span >
</ span >
</ div >
</ ReplyFormLink >
2023-02-20 22:17:04 +01:00
</ div >
</>
2023-03-25 21:38:52 +01:00
) : (
2023-03-19 18:30:07 +01:00
< PostLoader />
2023-02-20 22:17:04 +01:00
)}
</ BoardForm >
2023-02-12 21:20:08 +01:00
</ Container >
);
}
export default Thread ;