2023-05-09 15:58:19 +02:00
import React , { useEffect , useMemo , useState } from 'react' ;
2023-04-21 10:47:39 +02:00
import { Helmet } from 'react-helmet-async' ;
2023-04-16 16:12:59 +02:00
import { Link , useNavigate , useParams } from 'react-router-dom' ;
2023-04-10 10:51:16 +02:00
import { Tooltip } from 'react-tooltip' ;
2023-07-15 13:43:18 +02:00
import { useAccount , useAccountComment , useSubplebbit } from '@plebbit/plebbit-react-hooks' ;
2023-04-10 10:51:16 +02:00
import useGeneralStore from '../../hooks/stores/useGeneralStore' ;
2023-05-24 12:15:43 +02:00
import { Container , NavBar , Header , Break , PostForm , BoardForm } from '../styled/views/Board.styled' ;
import { ReplyFormLink , TopBar , BottomBar } from '../styled/views/Thread.styled' ;
2023-04-10 10:51:16 +02:00
import ImageBanner from '../ImageBanner' ;
import Post from '../Post' ;
import PostLoader from '../PostLoader' ;
2023-07-19 18:16:01 +02:00
import CreateBoardModal from '../modals/CreateBoardModal' ;
2023-05-24 12:15:43 +02:00
import SettingsModal from '../modals/SettingsModal' ;
2023-04-10 10:51:16 +02:00
import getCommentMediaInfo from '../../utils/getCommentMediaInfo' ;
import getDate from '../../utils/getDate' ;
2023-07-07 17:48:24 +02:00
import handleImageClick from '../../utils/handleImageClick' ;
2023-04-13 17:08:35 +02:00
import handleQuoteClick from '../../utils/handleQuoteClick' ;
2023-04-10 10:51:16 +02:00
import handleStyleChange from '../../utils/handleStyleChange' ;
import useError from '../../hooks/useError' ;
2023-05-09 15:58:19 +02:00
import useStateString from '../../hooks/useStateString' ;
2023-08-13 16:25:16 +02:00
import packageJson from '../../../package.json' ;
const { version } = packageJson ;
2023-04-10 10:51:16 +02:00
const Pending = () => {
const {
defaultSubplebbits ,
isSettingsOpen , setIsSettingsOpen ,
2023-04-13 18:02:19 +02:00
selectedAddress , setSelectedAddress ,
2023-04-10 10:51:16 +02:00
selectedStyle ,
2023-07-15 13:43:18 +02:00
setSelectedTitle ,
2023-04-10 10:51:16 +02:00
showPostFormLink
} = useGeneralStore ( state => state );
2023-04-16 16:12:59 +02:00
const { index } = useParams ();
2023-04-22 18:02:47 +02:00
const account = useAccount ();
2023-04-16 16:12:59 +02:00
const comment = useAccountComment ({ commentIndex : index });
2023-06-14 16:24:25 +02:00
const [, setNewErrorMessage ] = useError ();
2023-07-07 17:48:24 +02:00
const [ isThumbnailClicked , setIsThumbnailClicked ] = useState ({});
const [ isMobileThumbnailClicked , setIsMobileThumbnailClicked ] = useState ({});
2023-07-19 18:16:01 +02:00
const [ isCreateBoardOpen , setIsCreateBoardOpen ] = useState ( false );
2023-07-07 17:48:24 +02:00
2023-07-15 13:43:18 +02:00
const subplebbit = useSubplebbit ({ subplebbitAddress : comment ? . subplebbitAddress })
const selectedTitle = subplebbit ? . title ;
2023-07-07 17:48:24 +02:00
const handleThumbnailClick = ( index , isMobile = false ) => {
if ( isMobile ) {
setIsMobileThumbnailClicked ( prevState => ({
... prevState ,
[ index ] : ! prevState [ index ],
}));
} else {
setIsThumbnailClicked ( prevState => ({
... prevState ,
[ index ] : ! prevState [ index ],
}));
}
};
2023-05-09 15:58:19 +02:00
2023-05-10 16:01:49 +02:00
useEffect (() => {
setSelectedAddress ( comment ? . subplebbitAddress );
}, [ comment , setSelectedAddress ]);
2023-05-15 04:44:33 +00:00
const stateString = useStateString ( comment )
2023-05-09 15:58:19 +02:00
const errorString = useMemo (() => {
if ( comment ? . state === 'failed' ) {
let errorString = 'Failed fetching pending thread. Pending index: ' + index ;
if ( comment . error ) {
errorString += `: ${ comment . error . toString (). slice ( 0 , 300 ) } `
}
return errorString
}
}, [ comment ? . state , comment ? . error , index ])
useEffect (() => {
2023-06-14 16:24:25 +02:00
if ( errorString ) {
setNewErrorMessage ( errorString );
2023-05-09 15:58:19 +02:00
}
2023-06-14 16:24:25 +02:00
}, [ errorString , setNewErrorMessage ]);
2023-05-09 15:58:19 +02:00
2023-04-10 10:51:16 +02:00
const [ visible ] = useState ( true );
2023-05-07 17:13:19 +02:00
2023-04-10 10:51:16 +02:00
const navigate = useNavigate ();
2023-04-14 15:59:57 +02:00
const [ commentMediaInfo , setCommentMediaInfo ] = useState ( null );
2023-04-29 12:47:30 +02:00
const fallbackImgUrl = "assets/filedeleted-res.gif" ;
2023-04-10 10:51:16 +02:00
// mobile navbar board select functionality
const handleSelectChange = ( event ) => {
const selected = event . target . value ;
2023-05-16 16:37:50 +02:00
if ( selected === 'subscriptions' ) {
navigate ( `/p/subscriptions` );
return ;
} else if ( selected === 'all' ) {
navigate ( `/p/all` );
return ;
}
2023-04-10 10:51:16 +02:00
const selectedTitle = defaultSubplebbits . find (( subplebbit ) => subplebbit . address === selected ). title ;
setSelectedTitle ( selectedTitle );
setSelectedAddress ( selected );
navigate ( `/p/ ${ selected } ` );
};
2023-04-14 15:59:57 +02:00
// get comment media info
useEffect (() => {
if ( comment && comment . link ) {
const mediaInfo = getCommentMediaInfo ( comment );
setCommentMediaInfo ( mediaInfo );
}
}, [ comment ]);
2023-04-10 10:51:16 +02:00
return (
2023-04-21 10:47:39 +02:00
<>
< Helmet >
< title >{ `plebchan - Pending Thread # ${ parseInt ( index ) + 1 } ` }</ title >
</ Helmet >
< Container >
2023-07-19 18:16:01 +02:00
< CreateBoardModal
selectedStyle = { selectedStyle }
isOpen = { isCreateBoardOpen }
closeModal = {() => setIsCreateBoardOpen ( false )} />
2023-04-21 10:47:39 +02:00
< SettingsModal
selectedStyle = { selectedStyle }
isOpen = { isSettingsOpen }
closeModal = {() => setIsSettingsOpen ( false )} />
< NavBar selectedStyle = { selectedStyle }>
2023-04-10 10:51:16 +02:00
<>
2023-05-10 15:41:38 +02:00
< span className = "boardList" >
[
2023-07-14 14:32:33 +02:00
< Link to = { `/p/all` } onClick = {() => window . scrollTo ( 0 , 0 )}> All </ Link >
2023-05-16 16:37:50 +02:00
/
2023-07-14 14:32:33 +02:00
< Link to = { `/p/subscriptions` } onClick = {() => window . scrollTo ( 0 , 0 )}> Subscriptions </ Link >
2023-05-10 15:41:38 +02:00
] & nbsp ;[
{ defaultSubplebbits . map (( subplebbit , index ) => (
2023-04-21 10:47:39 +02:00
< span className = "boardList" key = { `span- ${ subplebbit . address } ` }>
2023-05-10 15:41:38 +02:00
{ index === 0 ? null : "\u00a0" }
< Link to = { `/p/ ${ subplebbit . address } ` } key = { `a- ${ subplebbit . address } ` } onClick = {() => {
setSelectedTitle ( subplebbit . title );
setSelectedAddress ( subplebbit . address );
2023-04-21 10:47:39 +02:00
}}
>{ subplebbit . title ? subplebbit . title : subplebbit . address }</ Link >
2023-05-10 15:41:38 +02:00
{ index !== defaultSubplebbits . length - 1 ? " /" : null }
2023-04-21 10:47:39 +02:00
</ span >
))}
2023-05-10 15:41:38 +02:00
]
</ span >
2023-04-21 10:47:39 +02:00
< span className = "nav" >
2023-05-27 12:33:25 +02:00
[
< span id = "button-span" style = {{ cursor : 'pointer' }} onClick = {
2023-07-19 18:16:01 +02:00
() => {
window . electron && window . electron . isElectron ? (
setIsCreateBoardOpen ( true )
) : (
alert (
2023-07-20 10:00:58 +02:00
'You can create a board with the desktop version of plebchan:\nhttps://github.com/plebbit/plebchan/releases/latest\n\nIf you are comfortable with the command line, use plebbit-cli:\nhttps://github.com/plebbit/plebbit-cli\n\n'
2023-05-27 12:33:25 +02:00
)
2023-07-19 18:16:01 +02:00
)
}
2023-05-27 12:33:25 +02:00
}> Create Board </ span >
]
2023-04-21 10:47:39 +02:00
[
2023-05-10 15:41:38 +02:00
< Link to = { `/profile/c/ ${ index } /settings` } onClick = {() => setIsSettingsOpen ( true )}> Settings </ Link >
2023-04-21 10:47:39 +02:00
]
[
2023-05-27 12:55:16 +02:00
< Link to = "/" > Home </ Link >
2023-04-21 10:47:39 +02:00
]
</ span >
< div id = "board-nav-mobile" style = {{ top : visible ? 0 : '-23px' }}>
2023-07-07 17:48:24 +02:00
< div className = "nav-container" >
< div className = "board-select" >
< strong > Board </ strong >
& nbsp ;
< select id = "board-select-mobile" value = { selectedAddress } onChange = { handleSelectChange }>
< option value = "all" > All </ option >
< option value = "subscriptions" > Subscriptions </ option >
2023-08-15 17:31:31 +02:00
{ ! defaultSubplebbits . some ( subplebbit => subplebbit . address === selectedAddress ) && (
< option value = { selectedAddress }>{ selectedAddress }</ option >
)}
2023-07-07 17:48:24 +02:00
{ defaultSubplebbits . map ( subplebbit => (
< option key = { `option- ${ subplebbit . address } ` } value = { subplebbit . address }
>{ subplebbit . title ? subplebbit . title : subplebbit . address }</ option >
))}
</ select >
< span id = "button-span" style = {{ cursor : 'pointer' }} onClick = {
2023-05-27 11:04:23 +02:00
() => alert (
2023-07-20 10:00:58 +02:00
'You can create a board with the desktop version of plebchan:\nhttps://github.com/plebbit/plebchan/releases/latest\n\nIf you are comfortable with the command line, use plebbit-cli:\nhttps://github.com/plebbit/plebbit-cli\n\n'
2023-05-27 11:04:23 +02:00
)
2023-07-07 17:48:24 +02:00
}> Create Board </ span >
</ div >
< div className = "page-jump" >
< Link to = { `/p/ ${ selectedAddress } /settings` } onClick = {() => setIsSettingsOpen ( true )}> Settings </ Link >
& nbsp ;
< Link to = "/" onClick = {() => { handleStyleChange ({ target : { value : "Yotsuba" }}); window . scrollTo ( 0 , 0 );}}> Home </ Link >
</ div >
2023-04-10 10:51:16 +02:00
</ div >
</ div >
2023-04-21 10:47:39 +02:00
< div id = "separator-mobile" > & nbsp ;</ div >
< div id = "separator-mobile" > & nbsp ;</ div >
</>
</ NavBar >
< Header selectedStyle = { selectedStyle }>
<>
< div className = "banner" >
< ImageBanner />
</ div >
<>
< div className = "board-title" >{ selectedTitle ?? null }</ div >
< div className = "board-address" >{ selectedAddress ? ( "p/" + selectedAddress ) : null }</ div >
</>
</>
</ Header >
< Break selectedStyle = { selectedStyle } />
< PostForm selectedStyle = { selectedStyle } name = "post" action = "" method = "post" enctype = "multipart/form-data" >
< ReplyFormLink id = "post-form-link" showReplyFormLink = { showPostFormLink } selectedStyle = { selectedStyle } >
< div id = "return-button-mobile" >
< span className = "btn-wrap" >
2023-05-10 22:20:59 +02:00
< Link to = { `/p/ ${ selectedAddress } ` } onClick = {()=> { window . scrollTo ( 0 , 0 )}}> Return </ Link >
2023-04-21 10:47:39 +02:00
</ span >
</ div >
< div id = "catalog-button-mobile" >
< span className = "btn-wrap" >
2023-05-10 22:20:59 +02:00
< Link to = { `/p/ ${ selectedAddress } /catalog` } onClick = {()=> { window . scrollTo ( 0 , 0 )}}> Catalog </ Link >
2023-04-21 10:47:39 +02:00
</ span >
</ div >
< div > & nbsp ;</ div >
</ ReplyFormLink >
</ PostForm >
< TopBar selectedStyle = { selectedStyle }>
< hr />
< span className = "style-changer" >
Style :
< select id = "style-selector" onChange = { handleStyleChange } value = { selectedStyle }>
< option value = "Yotsuba" > Yotsuba </ option >
< option value = "Yotsuba-B" > Yotsuba B </ option >
< option value = "Futaba" > Futaba </ option >
< option value = "Burichan" > Burichan </ option >
< option value = "Tomorrow" > Tomorrow </ option >
< option value = "Photon" > Photon </ option >
</ select >
</ span >
< span className = "return-button" id = "return-button-desktop" >
[
2023-05-10 22:20:59 +02:00
< Link to = { `/p/ ${ selectedAddress } ` } onClick = {()=> { window . scrollTo ( 0 , 0 )}}> Return </ Link >
2023-04-21 10:47:39 +02:00
]
</ span >
< span className = "return-button catalog-button" id = "catalog-button-desktop" >
[
2023-05-10 22:20:59 +02:00
< Link to = { `/p/ ${ selectedAddress } /catalog` } onClick = {()=> { window . scrollTo ( 0 , 0 )}}> Catalog </ Link >
2023-04-21 10:47:39 +02:00
]
</ span >
2023-05-16 12:40:29 +02:00
< span className = { stateString ? "reply-stat ellipsis" : "" }>{ stateString }</ span >
2023-04-21 10:47:39 +02:00
< hr />
</ TopBar >
< Tooltip id = "tooltip" className = "tooltip" />
< BoardForm selectedStyle = { selectedStyle }>
{ comment !== undefined ? (
<>
< div className = "thread" >
< div className = "op-container" >
< div className = "post op" >
< div className = "post-info" >
2023-07-07 17:48:24 +02:00
{ commentMediaInfo ? . url ? (
< div key = { `f- ${ index } ` } className = "file" style = {{ marginBottom : "5px" }}>
< div key = { `ft- ${ index } ` } className = "file-text" >
2023-04-21 10:47:39 +02:00
Link :& nbsp ;
2023-07-07 17:48:24 +02:00
< a key = { `fa- ${ index } ` } href = { commentMediaInfo . url } target = "_blank"
rel = "noopener noreferrer" >{
2023-04-21 10:47:39 +02:00
commentMediaInfo ? . url . length > 30 ?
commentMediaInfo ? . url . slice ( 0 , 30 ) + "(...)" :
commentMediaInfo ? . url
2023-07-07 17:48:24 +02:00
}</ a > & nbsp ;({ commentMediaInfo ? . type === "iframe" ? "video" : commentMediaInfo ? . type })
{ isThumbnailClicked [ index ] ? (
< span >
- [
< span className = 'reply-link'
style = {{ textDecoration : 'underline' , cursor : 'pointer' }}
onClick = {() => { handleThumbnailClick ( index )}}> Close </ span >
]
</ span >
) : null }
2023-04-21 10:47:39 +02:00
</ div >
2023-07-07 17:48:24 +02:00
{ commentMediaInfo ? . type === 'iframe' && (
< div key = { `enlarge- ${ index } ` }
className = { `img-container ${ isThumbnailClicked [ index ] ? 'expanded-container' : '' } ` }>
< span key = { `fta- ${ index } ` } className = "file-thumb" >
{( isThumbnailClicked [ index ] || ! commentMediaInfo . thumbnail ) && commentMediaInfo . embedUrl ? (
< iframe
className = 'enlarged'
key = { `fti- ${ index } ` }
src = { commentMediaInfo . embedUrl }
width = { commentMediaInfo . thumbnail ? "560" : "250" }
height = "315"
style = {{ border : "none" }}
title = "Embedded content"
allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen />
) : (
< img
key = { `fti- ${ index } ` }
src = { commentMediaInfo . thumbnail }
alt = "thumbnail"
onClick = {() => { handleThumbnailClick ( index )}}
style = {{ cursor : "pointer" }}
onError = {( e ) => e . target . src = fallbackImgUrl } />
)}
</ span >
</ div >
)}
2023-04-21 10:47:39 +02:00
{ commentMediaInfo ? . type === "webpage" ? (
2023-07-07 17:48:24 +02:00
< div key = { `enlarge- ${ index } ` } className = "img-container" >
< span key = { `fta- ${ index } ` } className = "file-thumb" >
{ comment . thumbnailUrl ? (
< img key = { `fti- ${ index } ` }
src = { commentMediaInfo . thumbnail } alt = { commentMediaInfo . type }
onClick = { handleImageClick }
style = {{ cursor : "pointer" }}
onError = {( e ) => e . target . src = fallbackImgUrl } />
) : null }
</ span >
</ div >
2023-04-21 10:47:39 +02:00
) : null }
{ commentMediaInfo ? . type === "image" ? (
2023-07-07 17:48:24 +02:00
< div key = { `enlarge- ${ index } ` } className = "img-container" >
< span key = { `fta- ${ index } ` } className = "file-thumb" >
< img key = { `fti- ${ index } ` }
src = { commentMediaInfo . url } alt = { commentMediaInfo . type }
onClick = { handleImageClick }
style = {{ cursor : "pointer" }}
onError = {( e ) => e . target . src = fallbackImgUrl } />
</ span >
</ div >
2023-04-21 10:47:39 +02:00
) : null }
{ commentMediaInfo ? . type === "video" ? (
2023-07-07 17:48:24 +02:00
< div key = { `enlarge- ${ index } ` } className = { `img-container ${ isThumbnailClicked [ index ] ? 'expanded-container' : '' } ` }>
< span key = { `fta- ${ index } ` } className = "file-thumb" >
{ isThumbnailClicked [ index ] ? (
< video
className = 'enlarged'
key = { `fti- ${ index } ` }
src = { commentMediaInfo . url }
controls
style = {{ cursor : "pointer" }}
onError = {( e ) => e . target . src = fallbackImgUrl }
/>
) : (
< video
key = { `fti- ${ index } ` }
src = { commentMediaInfo . url }
alt = "thumbnail"
onClick = {() => { handleThumbnailClick ( index )}}
style = {{ cursor : "pointer" }}
onError = {( e ) => e . target . src = fallbackImgUrl }
/>
)}
2023-04-21 10:47:39 +02:00
</ span >
2023-07-07 17:48:24 +02:00
</ div >
2023-04-21 10:47:39 +02:00
) : null }
{ commentMediaInfo ? . type === "audio" ? (
2023-07-07 17:48:24 +02:00
< span key = { `fta- ${ index } ` } className = "file-thumb" >
< audio controls key = { `fti- ${ index } ` }
src = { commentMediaInfo . url } alt = { commentMediaInfo . type }
onError = {( e ) => e . target . src = fallbackImgUrl } />
2023-04-21 10:47:39 +02:00
</ span >
) : null }
</ div >
) : null }
< span className = "name-block" >
{ comment . title ? (
comment . title . length > 75 ?
2023-04-10 10:51:16 +02:00
<>
2023-04-21 10:47:39 +02:00
< span key = { `q- ${ "pending" } ` } className = "title"
2023-04-10 10:51:16 +02:00
data - tooltip - id = "tooltip"
data - tooltip - content = { comment . title }
data - tooltip - place = "top" >
2023-04-21 10:47:39 +02:00
{ comment . title . slice ( 0 , 75 ) + " (...)" }
2023-04-10 10:51:16 +02:00
</ span >
</>
2023-04-21 10:47:39 +02:00
: < span key = { `q- ${ "pending" } ` } className = "title" >
{ comment . title }
</ span >)
: null }
2023-04-10 10:51:16 +02:00
& nbsp ;
2023-04-21 10:47:39 +02:00
{ comment . author ? . displayName
? comment . author ? . displayName . length > 20
? <>
< span key = { `n- ${ "pending" } ` } className = "name"
data - tooltip - id = "tooltip"
data - tooltip - content = { comment . author ? . displayName }
data - tooltip - place = "top" >
{ comment . author ? . displayName . slice ( 0 , 20 ) + " (...)" }
</ span >
</>
: < span key = { `n- ${ "pending" } ` } className = "name" >
{ comment . author ? . displayName }</ span >
: < span key = { `n- ${ "pending" } ` } className = "name" >
Anonymous </ span >}
& nbsp ;
2023-04-10 10:51:16 +02:00
& nbsp ;
2023-04-21 10:47:39 +02:00
< span className = "poster-address" >
2023-07-15 14:11:34 +02:00
( u / { account ? . author ? . shortAddress })
2023-04-21 10:47:39 +02:00
</ span >
& nbsp ;
< span className = "date-time" data - utc = "data" >{ getDate ( comment ? . timestamp )}</ span >
& nbsp ;
< span className = "post-number" >
2023-04-25 14:53:20 +02:00
< Link to = "" title = "Link to this post" > c / </ Link >
2023-04-21 10:47:39 +02:00
< span key = "pending" style = {{ color : 'red' , fontWeight : '700' }}> Pending </ span >
</ span > & nbsp ; & nbsp ;
2023-04-25 14:53:20 +02:00
< button key = { `pmb- ${ "pending" } ` } className = "post-menu-button" title = "Post menu" style = {{ all : 'unset' , cursor : 'pointer' }}> ▶ </ button >
2023-04-10 10:51:16 +02:00
</ span >
2023-04-21 10:47:39 +02:00
< blockquote key = { `blockquote- ${ "pending" } ` }>
< Post content = { comment . content } comment = { comment } handleQuoteClick = { handleQuoteClick } key = { `post- ${ "pending" } ` } />
</ blockquote >
2023-04-10 10:51:16 +02:00
</ div >
</ div >
</ div >
2023-04-21 10:47:39 +02:00
</ div >
< div className = "thread-mobile" key = "thread-mobile" >
< hr />
< div className = "op-container" key = "op-container" >
< div key = { `mob-po- ${ "pending" } ` } className = "post op" >
< div key = { `mob-pi- ${ "pending" } ` } className = "post-info-mobile" >
< button style = {{ all : 'unset' , cursor : 'pointer' }} key = { `mob-pb- ${ "pending" } ` } className = "post-menu-button-mobile" onClick = {() => {}}>...</ button >
< span className = "name-block-mobile" >
{ comment . author ? . displayName
? comment . author ? . displayName . length > 15
? <>
< span key = { `mob-n- ${ "pending" } ` } className = "name-mobile"
data - tooltip - id = "tooltip"
data - tooltip - content = { comment . author ? . displayName }
data - tooltip - place = "top" >
{ comment . author ? . displayName . slice ( 0 , 15 ) + " (...)" }
</ span >
</>
: < span key = { `mob-n- ${ "pending" } ` } className = "name-mobile" >
{ comment . author ? . displayName }</ span >
: < span key = { `mob-n- ${ "pending" } ` } className = "name-mobile" >
Anonymous </ span >}
& nbsp ;
< span key = { `mob-pa- ${ "pending" } ` } className = "poster-address-mobile" >
2023-07-15 14:11:34 +02:00
( u / { account ? . author ? . shortAddress }) & nbsp ;
2023-04-21 10:47:39 +02:00
</ span >
< br key = { `mob-br1- ${ "pending" } ` } />
{ comment . title ? (
comment . title . length > 30 ?
<>
< span key = { `mob-t- ${ "pending" } ` } className = "subject-mobile"
data - tooltip - id = "tooltip"
data - tooltip - content = { comment . title }
data - tooltip - place = "top" >
{ comment . title . slice ( 0 , 30 ) + " (...)" }
</ span >
</>
: < span key = { `mob-t- ${ "pending" } ` } className = "subject-mobile" >
{ comment . title }
</ span >) : null }
</ span >
< span key = { `mob-dt- ${ "pending" } ` } className = "date-time-mobile" >
{ getDate ( comment ? . timestamp )}
& nbsp ;
< button id = "reply-button" style = {{ all : 'unset' }} key = { `mob-no- ${ "pending" } ` }> c / </ button >
& nbsp ;
< span key = "pending-mob" style = {{ color : 'red' , fontWeight : '700' }}> Pending </ span >
</ span >
</ div >
2023-07-07 17:48:24 +02:00
{ comment . link ? (
< div key = { `mob-f- ${ index } ` } className = "file-mobile" >
{ commentMediaInfo ? . type === 'iframe' && (
< div key = { `enlarge-mob- ${ index } ` } className = "img-container" >
< span key = { `mob-fta- ${ index } ` } className = "file-thumb-mobile" >
{( isMobileThumbnailClicked [ index ] || ! commentMediaInfo . thumbnail ) && commentMediaInfo . embedUrl ? (
< div style = {{ width : "92vw" }}>
< iframe
key = { `mob-fti- ${ index } ` }
src = { commentMediaInfo . embedUrl }
style = {{ border : "none" , height : "250px" }}
title = "Embedded content"
allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen />
</ div >
) : (
< img
key = { `mob-fti- ${ index } ` }
src = { commentMediaInfo . thumbnail }
alt = "thumbnail"
onClick = {() => { handleThumbnailClick ( index , true )}}
style = {{ cursor : "pointer" }}
onError = {( e ) => e . target . src = fallbackImgUrl } />
)}
{ commentMediaInfo ? . type === "video" || "iframe" ? (
isMobileThumbnailClicked [ index ] ? (
< div style = {{ textAlign : "center" , marginTop : "15px" , marginBottom : "15px" }}>
< span className = 'button-mobile' style = {{ float : "none" , cursor : "pointer" }}
onClick = {() => { handleThumbnailClick ( index , true )}}
> Close </ span >
</ div >
) : (
< div key = { `mob-fi- ${ index } ` } className = "file-info-mobile" > video </ div >
)) : < div key = { `mob-fi- ${ index } ` } className = "file-info-mobile" > video </ div >}
</ span >
</ div >
)}
{ commentMediaInfo ? . url ? (
commentMediaInfo . type === "webpage" ? (
< div key = { `enlarge-mob- ${ index } ` } className = "img-container" >
< span key = { `mob-ft ${ comment . cid } ` } className = "file-thumb-mobile" >
{ comment . thumbnailUrl ? (
< img key = { `mob-img- ${ index } ` }
src = { commentMediaInfo . thumbnail } alt = "thumbnail"
onClick = { handleImageClick }
style = {{ cursor : "pointer" }}
onError = {( e ) => e . target . src = fallbackImgUrl } />
) : null }
< div key = { `mob-fi- ${ index } ` } className = "file-info-mobile" >{ commentMediaInfo ? . type }</ div >
</ span >
</ div >
) : commentMediaInfo . type === "image" ? (
< div key = { `enlarge-mob- ${ index } ` } className = "img-container" >
< span key = { `mob-ft ${ comment . cid } ` } className = "file-thumb-mobile" >
< img key = { `mob-img- ${ index } ` }
src = { commentMediaInfo . url } alt = { commentMediaInfo . type }
onClick = { handleImageClick }
style = {{ cursor : "pointer" }}
onError = {( e ) => e . target . src = fallbackImgUrl } />
< div key = { `mob-fi- ${ index } ` } className = "file-info-mobile" >{ commentMediaInfo ? . type }</ div >
</ span >
</ div >
) : commentMediaInfo . type === "video" ? (
< span key = { `mob-ft ${ comment . cid } ` } className = "file-thumb-mobile" >
{ isMobileThumbnailClicked [ index ] ? (
< video key = { `fti- ${ index } ` }
src = { commentMediaInfo . url } alt = { commentMediaInfo . type }
controls
style = {{ cursor : 'pointer' }}
onError = {( e ) => e . target . src = fallbackImgUrl } />
) : (
< video
key = { `fti- ${ index } ` }
src = { commentMediaInfo . url }
alt = "thumbnail"
onClick = {() => { handleThumbnailClick ( index , true )}}
style = {{ cursor : "pointer" }}
id = "video-thumbnail-mobile"
onError = {( e ) => e . target . src = fallbackImgUrl }
/>
)}
{ commentMediaInfo ? . type === "video" || "iframe" ? (
isMobileThumbnailClicked [ index ] ? (
< div style = {{ textAlign : "center" , marginTop : "15px" , marginBottom : "15px" }}>
< span className = 'button-mobile' style = {{ float : "none" , cursor : "pointer" }}
onClick = {() => { handleThumbnailClick ( index , true )}}
> Close </ span >
</ div >
) : (
< div key = { `mob-fi- ${ index } ` } className = "file-info-mobile" > video </ div >
)) : < div key = { `mob-fi- ${ index } ` } className = "file-info-mobile" > video </ div >}
</ span >
) : commentMediaInfo . type === "audio" ? (
< span key = { `mob-ft ${ comment . cid } ` } className = "file-thumb-mobile" >
< audio key = { `mob-img- ${ index } ` }
src = { commentMediaInfo . url } alt = { commentMediaInfo . type }
onError = {( e ) => e . target . src = fallbackImgUrl } />
< div key = { `mob-fi- ${ index } ` } className = "file-info-mobile" >{ commentMediaInfo ? . type }</ div >
</ span >
) : null
) : null }
2023-04-21 10:47:39 +02:00
</ div >
2023-07-07 17:48:24 +02:00
) : null }
2023-04-21 10:47:39 +02:00
< blockquote key = { `mob-bq- ${ "pending" } ` } className = "post-message-mobile" >
{ comment . content ? (
<>
< Post content = { comment . content } handleQuoteClick = { handleQuoteClick } comment = { comment } key = { `post-mobile- ${ "pending" } ` } />
</>
) : null }
</ blockquote >
</ div >
</ div >
</ div >
< BottomBar selectedStyle = { selectedStyle }>
< div id = "bottombar-desktop" >
< hr />
</ div >
</ BottomBar >
</>
) : (
< PostLoader />
)}
</ BoardForm >
2023-04-23 11:57:13 +02:00
< div style = {{
textAlign : "center" ,
fontSize : "11px" ,
marginTop : "2em" ,
marginBottom : "2em" ,
}}>
2023-04-24 20:00:11 +00:00
plebchan v { version }. GPL - 2.0
2023-04-23 11:57:13 +02:00
</ div >
2023-04-21 10:47:39 +02:00
</ Container >
</>
2023-04-10 10:51:16 +02:00
);
}
export default Pending ;