Updated as per requirnments

This commit is contained in:
Sujal Choudhari
2023-08-09 19:58:24 +05:30
parent c2e53f03b1
commit dd135001ff
3 changed files with 252 additions and 255 deletions
+12 -11
View File
@@ -32,22 +32,13 @@ export const Threads = styled.div`
.thread-icons { .thread-icons {
display: inline; display: inline;
width: 100px;
height: 16px; height: 16px;
margin: 2px 0 0 -101px;
position: absolute; position: absolute;
margin: 6px 60px 0 0px; width: 100px;
text-align: right; text-align: right;
top:0;
right:0;
z-index:4;
} }
.thread-icon-has-display{
transform: translate(68px, -4px);
scale: 0.8;
}
.offline-icon { .offline-icon {
height: 16px; height: 16px;
margin: 2px; margin: 2px;
@@ -60,6 +51,16 @@ export const Threads = styled.div`
margin-top: -2px; margin-top: -2px;
} }
.offline-icon-no-link-shifted {
height: 11px;
position: absolute;
margin-left: 35px;
margin-top: -2px;
}
.offline-icon-no-link-hovered {
transform: translate(16px,0);
}
.sticky-icon { .sticky-icon {
background-image: url(assets/sticky.gif); background-image: url(assets/sticky.gif);
width: 16px; width: 16px;
+18 -18
View File
@@ -124,8 +124,7 @@ const AllCatalog = () => {
const tryLoadMore = async () => { const tryLoadMore = async () => {
try { loadMore() } try { loadMore() }
catch (e) catch (e) { await new Promise(resolve => setTimeout(resolve, 1000)) }
{await new Promise(resolve => setTimeout(resolve, 1000))}
}; };
@@ -361,7 +360,8 @@ const AllCatalog = () => {
src={commentMediaInfo.url} alt={commentMediaInfo.type} src={commentMediaInfo.url} alt={commentMediaInfo.type}
onError={(e) => { onError={(e) => {
e.target.src = fallbackImgUrl e.target.src = fallbackImgUrl
e.target.onerror = null;}} /> e.target.onerror = null;
}} />
) : null} ) : null}
{commentMediaInfo?.type === "video" ? ( {commentMediaInfo?.type === "video" ? (
<video className="card" key={`fti-`} <video className="card" key={`fti-`}
@@ -378,11 +378,7 @@ const AllCatalog = () => {
) : null} ) : null}
</Link> </Link>
) : null} ) : null}
<div key={`ti-`} className={`thread-icons ${(commentMediaInfo && ( <div key={`ti-`} className={`thread-icons`} >
commentMediaInfo.type === 'image' ||
commentMediaInfo.type === 'video' ||
(commentMediaInfo.type === 'webpage' &&
commentMediaInfo.thumbnail))) ? "thread-icon-has-display" :""}`} >
{(commentMediaInfo && ( {(commentMediaInfo && (
commentMediaInfo.type === 'image' || commentMediaInfo.type === 'image' ||
commentMediaInfo.type === 'video' || commentMediaInfo.type === 'video' ||
@@ -395,7 +391,7 @@ const AllCatalog = () => {
) : ( ) : (
<OfflineIndicator <OfflineIndicator
address={thread.subplebbitAddress} address={thread.subplebbitAddress}
className="thread-icon offline-icon-no-link" className={`thread-icon ${linkCount > 0 ? "offline-icon-no-link-shifted" : "offline-icon-no-link"} ${isHoveringOnThread === thread.cid ? 'offline-icon-no-link-hovered' : ''}`}
tooltipPlace="top" /> tooltipPlace="top" />
)} )}
</div> </div>
@@ -410,9 +406,11 @@ const AllCatalog = () => {
</> </>
) : null} ) : null}
<PostMenu <PostMenu
style={{ display: isHoveringOnThread === thread.cid ? 'inline-block' : 'none', style={{
display: isHoveringOnThread === thread.cid ? 'inline-block' : 'none',
position: 'absolute', lineHeight: '1em', marginTop: '-1px', outline: 'none', position: 'absolute', lineHeight: '1em', marginTop: '-1px', outline: 'none',
zIndex: '999'}} zIndex: '999'
}}
key={`pmb-`} key={`pmb-`}
title="Post menu" title="Post menu"
ref={el => { ref={el => {
@@ -436,9 +434,11 @@ const AllCatalog = () => {
<PostMenuCatalog selectedStyle={selectedStyle} <PostMenuCatalog selectedStyle={selectedStyle}
ref={el => { postMenuCatalogRef.current = el }} ref={el => { postMenuCatalogRef.current = el }}
onClick={(event) => event.stopPropagation()} onClick={(event) => event.stopPropagation()}
style={{position: "absolute", style={{
position: "absolute",
top: menuPosition.top + 7, top: menuPosition.top + 7,
left: menuPosition.left}}> left: menuPosition.left
}}>
<div className={`post-menu-thread post-menu-thread-${thread.cid}`} <div className={`post-menu-thread post-menu-thread-${thread.cid}`}
style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }} style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }}
> >
@@ -585,7 +585,7 @@ const AllCatalog = () => {
<span className="boardList"> <span className="boardList">
[ [
<Link to={`/p/all`} onClick={() => window.scrollTo(0, 0)}>All</Link> <Link to={`/p/all`} onClick={() => window.scrollTo(0, 0)}>All</Link>
 /  /
<Link to={`/p/subscriptions`} onClick={() => window.scrollTo(0, 0)}>Subscriptions</Link> <Link to={`/p/subscriptions`} onClick={() => window.scrollTo(0, 0)}>Subscriptions</Link>
]&nbsp;[ ]&nbsp;[
{defaultSubplebbits.map((subplebbit, index) => ( {defaultSubplebbits.map((subplebbit, index) => (
@@ -634,7 +634,7 @@ const AllCatalog = () => {
<option key={`option-${subplebbit.address}`} value={subplebbit.address} <option key={`option-${subplebbit.address}`} value={subplebbit.address}
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option> >{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
))} ))}
</select>  </select>
<span id="button-span" style={{ cursor: 'pointer' }} onClick={ <span id="button-span" style={{ cursor: 'pointer' }} onClick={
() => alert( () => 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' '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'
@@ -666,7 +666,7 @@ const AllCatalog = () => {
<hr /> <hr />
<span className="style-changer"> <span className="style-changer">
Style: Style:
 
<select id="style-selector" onChange={handleStyleChange} value={selectedStyle}> <select id="style-selector" onChange={handleStyleChange} value={selectedStyle}>
<option value="Yotsuba">Yotsuba</option> <option value="Yotsuba">Yotsuba</option>
<option value="Yotsuba-B">Yotsuba B</option> <option value="Yotsuba-B">Yotsuba B</option>
@@ -726,7 +726,7 @@ const AllCatalog = () => {
marginTop: "2px", marginTop: "2px",
}}> }}>
Style: Style:
 
<select id="style-selector" onChange={handleStyleChange} value={selectedStyle}> <select id="style-selector" onChange={handleStyleChange} value={selectedStyle}>
<option value="Yotsuba">Yotsuba</option> <option value="Yotsuba">Yotsuba</option>
<option value="Yotsuba-B">Yotsuba B</option> <option value="Yotsuba-B">Yotsuba B</option>
@@ -743,7 +743,7 @@ const AllCatalog = () => {
<span className="boardList"> <span className="boardList">
[ [
<Link to={`/p/all`} onClick={() => window.scrollTo(0, 0)}>All</Link> <Link to={`/p/all`} onClick={() => window.scrollTo(0, 0)}>All</Link>
 /  /
<Link to={`/p/subscriptions`} onClick={() => window.scrollTo(0, 0)}>Subscriptions</Link> <Link to={`/p/subscriptions`} onClick={() => window.scrollTo(0, 0)}>Subscriptions</Link>
]&nbsp;[ ]&nbsp;[
{defaultSubplebbits.map((subplebbit, index) => ( {defaultSubplebbits.map((subplebbit, index) => (
@@ -369,11 +369,7 @@ const SubscriptionsCatalog = () => {
) : null} ) : null}
</Link> </Link>
) : null} ) : null}
<div key={`ti-`} className={`thread-icons ${(commentMediaInfo && ( <div key={`ti-`} className="thread-icons" >
commentMediaInfo.type === 'image' ||
commentMediaInfo.type === 'video' ||
(commentMediaInfo.type === 'webpage' &&
commentMediaInfo.thumbnail))) ? "thread-icon-has-display" : ""}`} >
{(commentMediaInfo && ( {(commentMediaInfo && (
commentMediaInfo.type === 'image' || commentMediaInfo.type === 'image' ||
commentMediaInfo.type === 'video' || commentMediaInfo.type === 'video' ||
@@ -381,12 +377,12 @@ const SubscriptionsCatalog = () => {
commentMediaInfo.thumbnail))) ? ( commentMediaInfo.thumbnail))) ? (
<OfflineIndicator <OfflineIndicator
address={thread.subplebbitAddress} address={thread.subplebbitAddress}
className="thread-icon offline-icon" className={`thread-icon offline-icon`}
tooltipPlace="top" /> tooltipPlace="top" />
) : ( ) : (
<OfflineIndicator <OfflineIndicator
address={thread.subplebbitAddress} address={thread.subplebbitAddress}
className="thread-icon offline-icon-no-link" className={`thread-icon ${linkCount> 0?"offline-icon-no-link-shifted": "offline-icon-no-link"} ${isHoveringOnThread === thread.cid ? 'offline-icon-no-link-hovered' : ''}`}
tooltipPlace="top" /> tooltipPlace="top" />
)} )}
</div> </div>