2023-06-27 21:06:30 +02:00
import React , { useCallback , useEffect , useRef , useState } from 'react' ;
import { createPortal } from 'react-dom' ;
import { Helmet } from 'react-helmet-async' ;
import { Link , useNavigate , useParams } from 'react-router-dom' ;
import { Tooltip } from 'react-tooltip' ;
2023-07-31 08:59:17 +02:00
import { useSubplebbit } from '@plebbit/plebbit-react-hooks' ;
import { debounce } from 'lodash' ;
import { Container , NavBar , Header , Break , PostMenu , PostForm } from '../styled/views/Board.styled' ;
import { TopBar , BoardForm , Footer , ReplyFormLink } from '../styled/views/Thread.styled' ;
import { PostMenuCatalog } from '../styled/views/Catalog.styled' ;
2023-08-22 16:18:55 +02:00
import BoardStats from '../BoardStats' ;
2023-07-31 08:59:17 +02:00
import ImageBanner from '../ImageBanner' ;
import Post from '../Post' ;
import CreateBoardModal from '../modals/CreateBoardModal' ;
import AdminListModal from '../modals/AdminListModal' ;
import OfflineIndicator from '../OfflineIndicator' ;
import SettingsModal from '../modals/SettingsModal' ;
2023-06-27 21:06:30 +02:00
import getDate from '../../utils/getDate' ;
import handleImageClick from '../../utils/handleImageClick' ;
2023-08-22 14:17:38 +02:00
import handleShareClick from '../../utils/handleShareClick' ;
2023-06-27 21:06:30 +02:00
import handleStyleChange from '../../utils/handleStyleChange' ;
2023-07-31 08:59:17 +02:00
import useGeneralStore from '../../hooks/stores/useGeneralStore' ;
2023-08-13 16:25:16 +02:00
import packageJson from '../../../package.json' ;
const { version } = packageJson ;
2023-09-10 14:12:25 +02:00
const commitRef = process ? . env ? . REACT_APP_COMMIT_REF ? ` ${ process . env . REACT_APP_COMMIT_REF . slice ( 0 , 7 ) } ` : '' ;
2023-06-27 21:06:30 +02:00
const Description = () => {
const {
defaultSubplebbits ,
isSettingsOpen , setIsSettingsOpen ,
selectedAddress , setSelectedAddress ,
selectedStyle ,
setSelectedTitle ,
} = useGeneralStore ( state => state );
2023-07-31 08:59:17 +02:00
2023-06-27 21:06:30 +02:00
const navigate = useNavigate ();
const threadMenuRefs = useRef ({});
const postMenuRef = useRef ( null );
const postMenuCatalogRef = useRef ( null );
2023-06-28 15:25:28 +02:00
const [ isAdminListOpen , setIsAdminListOpen ] = useState ( false );
2023-06-27 21:06:30 +02:00
const [ prevScrollPos , setPrevScrollPos ] = useState ( 0 );
const [ visible , setVisible ] = useState ( true );
2023-07-31 08:59:17 +02:00
const [ menuPosition , setMenuPosition ] = useState ({ top : 0 , left : 0 });
2023-06-27 21:06:30 +02:00
const [ openMenuCid , setOpenMenuCid ] = useState ( null );
2023-07-19 18:16:01 +02:00
const [ isCreateBoardOpen , setIsCreateBoardOpen ] = useState ( false );
2023-06-27 21:06:30 +02:00
2023-07-31 08:59:17 +02:00
const { subplebbitAddress } = useParams ();
const subplebbit = useSubplebbit ({ subplebbitAddress : selectedAddress });
2023-06-27 21:06:30 +02:00
const handleOptionClick = () => {
setOpenMenuCid ( null );
};
const handleOutsideClick = useCallback (( e ) => {
if ( openMenuCid !== null && ! postMenuRef . current . contains ( e . target ) && ! postMenuCatalogRef . current . contains ( e . target )) {
setOpenMenuCid ( null );
}
}, [ openMenuCid , postMenuRef , postMenuCatalogRef ]);
useEffect (() => {
if ( openMenuCid !== null ) {
document . addEventListener ( 'click' , handleOutsideClick );
} else {
document . removeEventListener ( 'click' , handleOutsideClick );
}
2023-07-31 08:59:17 +02:00
2023-06-27 21:06:30 +02:00
return () => {
document . removeEventListener ( 'click' , handleOutsideClick );
};
}, [ openMenuCid , handleOutsideClick ]);
2023-07-31 08:59:17 +02:00
2023-06-27 21:06:30 +02:00
useEffect (() => {
window . scrollTo ( 0 , 0 );
}, []);
useEffect (() => {
const selectedSubplebbit = defaultSubplebbits . find (( subplebbit ) => subplebbit . address === subplebbitAddress );
2023-07-24 09:59:10 +02:00
if ( subplebbitAddress ) {
setSelectedAddress ( subplebbitAddress );
} else if ( subplebbit ? . address ) {
setSelectedAddress ( subplebbit . address )
}
2023-06-27 21:06:30 +02:00
if ( selectedSubplebbit ) {
setSelectedTitle ( selectedSubplebbit . title );
2023-07-24 09:59:10 +02:00
} else if ( subplebbit ? . title ) {
setSelectedTitle ( subplebbit . title );
2023-06-27 21:06:30 +02:00
}
2023-07-24 09:59:10 +02:00
}, [ subplebbitAddress , setSelectedAddress , setSelectedTitle , defaultSubplebbits , subplebbit ? . address , subplebbit ? . title ]);
2023-06-27 21:06:30 +02:00
// mobile navbar scroll effect
useEffect (() => {
const debouncedHandleScroll = debounce (() => {
const currentScrollPos = window . scrollY ;
setVisible ( prevScrollPos > currentScrollPos || currentScrollPos < 10 );
setPrevScrollPos ( currentScrollPos );
}, 50 );
2023-07-31 08:59:17 +02:00
2023-06-27 21:06:30 +02:00
window . addEventListener ( 'scroll' , debouncedHandleScroll );
2023-07-31 08:59:17 +02:00
2023-06-27 21:06:30 +02:00
return () => window . removeEventListener ( 'scroll' , debouncedHandleScroll );
}, [ prevScrollPos , visible ]);
// mobile navbar board select functionality
const handleSelectChange = ( event ) => {
const selected = event . target . value ;
if ( selected === 'subscriptions' ) {
navigate ( `/p/subscriptions` );
return ;
} else if ( selected === 'all' ) {
navigate ( `/p/all` );
return ;
}
const selectedTitle = defaultSubplebbits . find (( subplebbit ) => subplebbit . address === selected ). title ;
setSelectedTitle ( selectedTitle );
setSelectedAddress ( selected );
navigate ( `/p/ ${ selected } ` );
};
return (
<>
< Helmet >
2023-07-31 08:59:17 +02:00
< title >
2023-06-27 21:06:30 +02:00
{ "Board Description - " + ( subplebbit . title || subplebbit . address ) + " - plebchan" }
2023-07-31 08:59:17 +02:00
</ title >
</ Helmet >
2023-06-27 21:06:30 +02:00
< Container >
2023-07-19 18:16:01 +02:00
< CreateBoardModal
2023-07-31 08:59:17 +02:00
selectedStyle = { selectedStyle }
isOpen = { isCreateBoardOpen }
closeModal = {() => setIsCreateBoardOpen ( false )} />
2023-06-28 15:25:28 +02:00
< AdminListModal
2023-07-31 08:59:17 +02:00
selectedStyle = { selectedStyle }
isOpen = { isAdminListOpen }
closeModal = {() => setIsAdminListOpen ( false )}
roles = { subplebbit . roles } />
2023-06-27 21:06:30 +02:00
< SettingsModal
2023-07-31 08:59:17 +02:00
selectedStyle = { selectedStyle }
isOpen = { isSettingsOpen }
closeModal = {() => setIsSettingsOpen ( false )} />
2023-06-27 21:06:30 +02:00
< NavBar selectedStyle = { selectedStyle }>
<>
2023-07-31 08:59:17 +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-07-31 08:59:17 +02:00
/
2023-07-14 14:32:33 +02:00
< Link to = { `/p/subscriptions` } onClick = {() => window . scrollTo ( 0 , 0 )}> Subscriptions </ Link >
2023-07-31 08:59:17 +02:00
] & nbsp ;[
{ defaultSubplebbits . map (( subplebbit , index ) => (
< span className = "boardList" key = { `span- ${ subplebbit . address } ` }>
{ index === 0 ? null : "\u00a0" }
< Link to = { `/p/ ${ subplebbit . address } ` } key = { `a- ${ subplebbit . address } ` } onClick = {() => {
setSelectedTitle ( subplebbit . title );
setSelectedAddress ( subplebbit . address );
}}
>{ subplebbit . title ? subplebbit . title : subplebbit . address }</ Link >
{ index !== defaultSubplebbits . length - 1 ? " /" : null }
</ span >
))}
]
</ span >
2023-06-27 21:06:30 +02:00
< span className = "nav" >
[
2023-07-31 08:59:17 +02:00
< span id = "button-span" style = {{ cursor : 'pointer' }} onClick = {
() => {
window . electron && window . electron . isElectron ? (
setIsCreateBoardOpen ( true )
) : (
alert (
'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-06-27 21:06:30 +02:00
)
2023-07-31 08:59:17 +02:00
)
}
2023-06-27 21:06:30 +02:00
}> Create Board </ span >
]
[
2023-08-16 08:51:28 +02:00
< Link to = { `/p/ ${ selectedAddress } /description/settings` } onClick = {() => setIsSettingsOpen ( true )}> Settings </ Link >
2023-06-27 21:06:30 +02:00
]
[
< Link to = "/" > Home </ Link >
]
</ span >
< div id = "board-nav-mobile" style = {{ top : visible ? 0 : '-23px' }}>
< 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-06-27 21:06:30 +02:00
{ defaultSubplebbits . map ( subplebbit => (
2023-07-31 08:59:17 +02:00
< option key = { `option- ${ subplebbit . address } ` } value = { subplebbit . address }
>{ subplebbit . title ? subplebbit . title : subplebbit . address }</ option >
))}
</ select >
< span id = "button-span" style = {{ cursor : 'pointer' }} onClick = {
() => alert (
'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-06-27 21:06:30 +02:00
)
}> Create Board </ span >
</ div >
< div className = "page-jump" >
2023-08-16 08:51:28 +02:00
< Link to = { `/p/ ${ selectedAddress } /description/settings` } onClick = {() => setIsSettingsOpen ( true )}> Settings </ Link >
2023-06-27 21:06:30 +02:00
& nbsp ;
2023-07-31 08:59:17 +02:00
< Link to = "/" onClick = {() => { handleStyleChange ({ target : { value : "Yotsuba" }}); window . scrollTo ( 0 , 0 );}}> Home </ Link >
2023-06-27 21:06:30 +02:00
</ div >
</ div >
</ div >
< div id = "separator-mobile" > & nbsp ;</ div >
< div id = "separator-mobile" > & nbsp ;</ div >
</>
</ NavBar >
< Header selectedStyle = { selectedStyle }>
<>
< div className = "banner" >
< ImageBanner />
</ div >
2023-07-31 08:59:17 +02:00
<>
2023-06-27 21:06:30 +02:00
< div className = "board-title" >{ subplebbit . title ?? null }</ div >
< div className = "board-address" > p / { subplebbit . address }
2023-07-31 08:59:17 +02:00
< OfflineIndicator
address = { subplebbit . address }
className = "offline"
tooltipPlace = "top" />
2023-06-27 21:06:30 +02:00
</ div >
2023-07-31 08:59:17 +02:00
</>
2023-06-27 21:06:30 +02:00
</>
</ Header >
< Break selectedStyle = { selectedStyle } />
< PostForm selectedStyle = { selectedStyle }>
2023-07-31 08:59:17 +02:00
< ReplyFormLink id = "post-form-link" selectedStyle = { selectedStyle } style = {{ marginBottom : '10px' }}>
< div id = "return-button-mobile" >
< span className = "btn-wrap" onClick = {()=> { window . scrollTo ( 0 , 0 )}}>
2023-06-27 21:06:30 +02:00
< Link to = { `/p/ ${ selectedAddress } ` }> Return </ Link >
</ span >
</ div >
< div id = "catalog-button-mobile" >
< span className = "btn-wrap" >
2023-07-31 08:59:17 +02:00
< Link to = { `/p/ ${ selectedAddress } /catalog` } onClick = {()=> { window . scrollTo ( 0 , 0 )}}> Catalog </ Link >
2023-06-27 21:06:30 +02:00
</ span >
</ div >
< div id = "bottom-button-mobile" >
< span className = "btn-wrap" >
2023-07-31 08:59:17 +02:00
< span style = {{ cursor : 'pointer' }} onClick = {() => window . scrollTo ( 0 , document . body . scrollHeight )} onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }> Bottom </ span >
2023-06-27 21:06:30 +02:00
</ span >
</ div >
</ ReplyFormLink >
</ PostForm >
2023-08-22 16:18:55 +02:00
< BoardStats subplebbitAddress = { selectedAddress } />
2023-06-27 21:06:30 +02:00
< TopBar selectedStyle = { selectedStyle }>
< span className = "style-changer" >
Style :
2023-07-31 08:59:17 +02:00
2023-06-27 21:06:30 +02:00
< 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" >
[
< Link to = { `/p/ ${ selectedAddress } ` }> Return </ Link >
]
</ span >
< span className = "return-button catalog-button" id = "catalog-button-desktop" >
[
< Link to = { `/p/ ${ selectedAddress } /catalog` }> Catalog </ Link >
]
</ span >
< span className = "return-button catalog-button" id = "bottom-button-desktop" >
[
2023-07-31 08:59:17 +02:00
< span id = "button" style = {{ cursor : 'pointer' }} onClick = {() => window . scrollTo ( 0 , document . body . scrollHeight )}
onMouseOver = {( event ) => event . target . style . cursor = 'pointer' }
onTouchStart = {() => window . scrollTo ( 0 , document . body . scrollHeight )}> Bottom </ span >
2023-06-27 21:06:30 +02:00
]
</ span >
</ TopBar >
< Tooltip id = "tooltip" className = "tooltip" />
< BoardForm selectedStyle = { selectedStyle }>
<>
< div className = "thread" >
< div className = "op-container" style = {{
2023-07-31 08:59:17 +02:00
display : subplebbit . rules ? "grid" : "block" ,
marginBottom : '10px' ,
2023-06-27 21:06:30 +02:00
}}>
< div className = "post op op-desktop" >
< hr />
< div className = "post-info" >
{ subplebbit . suggested ? . avatarUrl ? (
2023-07-31 08:59:17 +02:00
< div className = "file" style = {{ marginBottom : "5px" }}>
2023-06-27 21:06:30 +02:00
< div className = "file-text" >
Link :& nbsp ;
2023-07-31 08:59:17 +02:00
< a href = { subplebbit . suggested ? . avatarUrl }
target = "_blank" rel = "noopener noreferrer" >{
subplebbit . suggested ? . avatarUrl . length > 30 ?
subplebbit . suggested ? . avatarUrl . slice ( 0 , 30 ) + "..." :
subplebbit . suggested ? . avatarUrl
}
2023-06-27 21:06:30 +02:00
</ a > & nbsp ;( image )
</ div >
< div className = "img-container" >
< span className = "file-thumb" >
< img src = { subplebbit . suggested ? . avatarUrl } alt = "board avatar"
2023-07-31 08:59:17 +02:00
onClick = { handleImageClick }
style = {{ cursor : "pointer" }} />
2023-06-27 21:06:30 +02:00
</ span >
</ div >
</ div >
2023-07-31 08:59:17 +02:00
) : null }
2023-06-27 21:06:30 +02:00
< span className = "name-block" >
< span className = "title" > Welcome to { subplebbit . title || subplebbit . address }</ span >
& nbsp ;
2023-06-28 15:25:28 +02:00
< span className = "name capcode"
2023-07-31 08:59:17 +02:00
style = {{ cursor : 'pointer' }}
onClick = {() => { setIsAdminListOpen ( ! isAdminListOpen )}}
2023-06-28 15:25:28 +02:00
> ## Board Admins </ span >
2023-06-27 21:06:30 +02:00
& nbsp ;
< span className = "date-time" >{ getDate ( subplebbit . createdAt )}</ span >
& nbsp ;
2023-07-31 08:59:17 +02:00
< img src = "assets/sticky.gif" alt = "Sticky" title = "Sticky" style = {{ marginBottom : "-1px" , imageRendering : 'pixelated' }} />
2023-06-27 21:06:30 +02:00
& nbsp ;
2023-07-31 08:59:17 +02:00
< img src = "assets/closed.gif" alt = "Closed" title = "Closed" style = {{ marginBottom : "-1px" , imageRendering : 'pixelated' }} />
2023-06-27 21:06:30 +02:00
< span > & nbsp ;
2023-07-31 08:59:17 +02:00
[
< Link to = {() => {}} style = {{ textDecoration : "none" }} className = "reply-link" > Reply </ Link >
]
2023-06-27 21:06:30 +02:00
</ span >
2023-07-31 08:59:17 +02:00
< PostMenu
2023-06-27 21:06:30 +02:00
title = "Post menu"
2023-07-31 08:59:17 +02:00
ref = { el => {
2023-06-27 21:06:30 +02:00
threadMenuRefs . current [ subplebbit . pubsubTopic ] = el ;
}}
2023-07-31 08:59:17 +02:00
className = 'post-menu-button'
2023-06-27 21:06:30 +02:00
rotated = { openMenuCid === subplebbit . pubsubTopic }
onClick = {( event ) => {
event . stopPropagation ();
const rect = threadMenuRefs . current [ subplebbit . pubsubTopic ]. getBoundingClientRect ();
2023-07-31 08:59:17 +02:00
setMenuPosition ({ top : rect . top + window . scrollY , left : rect . left });
2023-06-27 21:06:30 +02:00
setOpenMenuCid ( prevCid => ( prevCid === subplebbit . pubsubTopic ? null : subplebbit . pubsubTopic ));
}}
>
▶
</ PostMenu >
{ createPortal (
2023-07-31 08:59:17 +02:00
< 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- ${ subplebbit . pubsubTopic } ` }
style = {{ display : openMenuCid === subplebbit . pubsubTopic ? 'block' : 'none' }}
>
< ul className = "post-menu-catalog" >
2023-08-22 14:17:38 +02:00
< li onClick = {() => {
handleOptionClick ( "description" );
handleShareClick ( selectedAddress , "description" );
2023-09-13 17:36:13 +02:00
}}> Share board </ li >
2023-07-31 08:59:17 +02:00
{ /* {isModerator ? (
2023-06-27 21:06:30 +02:00
<>
change description
</>
) : null} */ }
2023-07-31 08:59:17 +02:00
</ ul >
</ div >
2023-06-27 21:06:30 +02:00
</ PostMenuCatalog >, document . body
)}
</ span >
< blockquote >
< div className = "custom-paragraph" >
2023-07-13 16:03:22 +02:00
< Post content = { subplebbit . description } />
2023-06-27 21:06:30 +02:00
</ div >
</ blockquote >
</ div >
</ div >
</ div >
</ div >
< div className = "thread-mobile" >
< hr />
< div className = "op-container" >
< div className = "post op op-mobile" >
< div className = "post-info-mobile" >
< button className = "post-menu-button-mobile"
2023-07-31 08:59:17 +02:00
style = {{ all : 'unset' , cursor : 'pointer' }}>...</ button >
2023-06-27 21:06:30 +02:00
< span className = "name-block-mobile" >
2023-06-28 15:25:28 +02:00
< span className = "name-mobile capcode"
2023-07-31 08:59:17 +02:00
style = {{ cursor : 'pointer' }}
onClick = {() => { setIsAdminListOpen ( ! isAdminListOpen )}}
2023-06-28 15:25:28 +02:00
> ## Board Admins </ span >
2023-06-27 21:06:30 +02:00
& nbsp ;
< span className = "thread-icons-mobile"
2023-07-31 08:59:17 +02:00
style = {{ float : "right" , marginRight : "18px" }}>
< img src = "assets/sticky.gif" alt = "Sticky" title = "Sticky" style = {{ marginTop : "-1px" , marginRight : "2px" , imageRendering : 'pixelated' }} />
2023-06-27 21:06:30 +02:00
& nbsp ;
2023-07-31 08:59:17 +02:00
< img src = "assets/closed.gif" alt = "Closed" title = "Closed" style = {{ marginTop : "-1px" , marginRight : "2px" , imageRendering : 'pixelated' }} />
2023-06-27 21:06:30 +02:00
</ span >
< br />
< span className = "subject-mobile"
2023-07-31 08:59:17 +02:00
style = {{ marginBottom : "-15px" }}> Welcome to { subplebbit . title || subplebbit . address }</ span >
2023-06-27 21:06:30 +02:00
& nbsp ;
</ span >
< span className = "date-time-mobile post-number-mobile" >{ getDate ( subplebbit . createdAt )}</ span >
& nbsp ;
</ div >
{ subplebbit . suggested ? . avatarUrl ? (
< div className = "file-mobile" >
< div className = "img-container" >
< span className = "file-thumb-mobile" >
< img src = { subplebbit . suggested . avatarUrl } alt = "board avatar"
2023-07-31 08:59:17 +02:00
onClick = { handleImageClick }
style = {{ cursor : "pointer" }} />
2023-06-27 21:06:30 +02:00
< div className = "file-info-mobile" > image </ div >
</ span >
</ div >
</ div >
) : null }
< blockquote className = "post-message-mobile" >
< div className = "custom-paragraph" >
2023-07-13 16:03:22 +02:00
< Post content = { subplebbit . description } />
2023-06-27 21:06:30 +02:00
</ div >
</ blockquote >
</ div >
< div className = "post-link-mobile" >
2023-07-31 08:59:17 +02:00
< Link to = {() => {}} className = "button-mobile" > View Thread </ Link >
2023-06-27 21:06:30 +02:00
</ div >
</ div >
</ div >
</>
</ BoardForm >
< Footer selectedStyle = { selectedStyle }>
< Break id = "break" selectedStyle = { selectedStyle } style = {{
marginTop : "-36px" ,
width : "100%" ,
}} />
< Break selectedStyle = { selectedStyle } style = {{
width : "100%" ,
}} />
< span className = "style-changer" style = {{
float : "right" ,
marginTop : "2px" ,
}}>
Style :
2023-07-31 08:59:17 +02:00
2023-06-27 21:06:30 +02:00
< 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 >
< NavBar selectedStyle = { selectedStyle } style = {{
marginTop : "42px" ,
}}>
<>
2023-07-31 08:59:17 +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-07-31 08:59:17 +02:00
/
2023-07-14 14:32:33 +02:00
< Link to = { `/p/subscriptions` } onClick = {() => window . scrollTo ( 0 , 0 )}> Subscriptions </ Link >
2023-07-31 08:59:17 +02:00
] & nbsp ;
</ span >
{ defaultSubplebbits . map (( subplebbit , index ) => (
< span className = "boardList" key = { `span- ${ subplebbit . address } ` }>
{ index === 0 ? null : "\u00a0" }
< Link to = { `/p/ ${ subplebbit . address } ` } key = { `a- ${ subplebbit . address } ` } onClick = {() => {
setSelectedTitle ( subplebbit . title );
setSelectedAddress ( subplebbit . address );
}}
>{ subplebbit . title ? subplebbit . title : subplebbit . address }</ Link >
{ index !== defaultSubplebbits . length - 1 ? " /" : null }
2023-06-27 21:06:30 +02:00
</ span >
2023-07-31 08:59:17 +02:00
))}
< span className = "nav" >
[
< span id = "button-span" style = {{ cursor : 'pointer' }} onClick = {
() => {
window . electron && window . electron . isElectron ? (
setIsCreateBoardOpen ( true )
) : (
alert (
'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'
)
)
}
}> Create Board </ span >
]
2023-06-27 21:06:30 +02:00
[
2023-08-16 08:51:28 +02:00
< Link to = { `/p/ ${ selectedAddress } /description/settings` } onClick = {() => setIsSettingsOpen ( true )}> Settings </ Link >
2023-06-27 21:06:30 +02:00
]
[
2023-07-31 08:59:17 +02:00
< Link to = "/" onClick = {() => handleStyleChange ({ target : { value : "Yotsuba" }}
2023-06-27 21:06:30 +02:00
)}> Home </ Link >
]
</ span >
</>
</ NavBar >
< div id = "version" >
2023-09-10 14:12:25 +02:00
plebchan v { version }{ commitRef }. GPL - 2.0
2023-06-27 21:06:30 +02:00
</ div >
< div className = "footer-links"
style = {{
textAlign : "center" ,
fontSize : "x-small" ,
fontFamily : "arial" ,
marginTop : "5px" ,
marginBottom : "15px" ,
}}>
2023-07-31 08:59:17 +02:00
< a style = {{ textDecoration : 'underline' }} href = "https://plebbit.com" target = "_blank" rel = "noopener noreferrer" > About </ a >
& nbsp ; • & nbsp ;
< a style = {{ textDecoration : 'underline' }} href = "https://github.com/plebbit/plebchan/releases/latest" target = "_blank" rel = "noopener noreferrer" > App </ a >
2023-06-27 21:06:30 +02:00
& nbsp ; • & nbsp ;
2023-07-31 08:59:17 +02:00
< a style = {{ textDecoration : 'underline' }} href = "https://twitter.com/plebchan_eth" target = "_blank" rel = "noopener noreferrer" > Twitter </ a >
& nbsp ; • & nbsp ;
< a style = {{ textDecoration : 'underline' }} href = "https://t.me/plebbit" target = "_blank" rel = "noopener noreferrer" > Telegram </ a >
2023-06-27 21:06:30 +02:00
</ div >
</ Footer >
</ Container >
</>
);
}
export default Description ;