{subplebbit.suggested?.avatarUrl ? (
-
+
+ onClick={handleImageClick}
+ style={{cursor: "pointer"}} />
- ) : null}
+ ) : null}
Welcome to {subplebbit.title || subplebbit.address}
{ setIsAdminListOpen(!isAdminListOpen) }}
+ style={{cursor: 'pointer'}}
+ onClick={() => {setIsAdminListOpen(!isAdminListOpen)}}
>## Board Admins
{getDate(subplebbit.createdAt)}
-
+
-
+
- [
- { }} style={{ textDecoration: "none" }} className="reply-link">Reply
- ]
+ [
+ {}} style={{textDecoration: "none"}} className="reply-link">Reply
+ ]
- {
+ ref={el => {
threadMenuRefs.current[subplebbit.pubsubTopic] = el;
}}
- className='post-menu-button'
+ className='post-menu-button'
rotated={openMenuCid === subplebbit.pubsubTopic}
onClick={(event) => {
event.stopPropagation();
const rect = threadMenuRefs.current[subplebbit.pubsubTopic].getBoundingClientRect();
- setMenuPosition({ top: rect.top + window.scrollY, left: rect.left });
+ setMenuPosition({top: rect.top + window.scrollY, left: rect.left});
setOpenMenuCid(prevCid => (prevCid === subplebbit.pubsubTopic ? null : subplebbit.pubsubTopic));
}}
>
▶
{createPortal(
- { postMenuCatalogRef.current = el }}
- onClick={(event) => event.stopPropagation()}
- style={{
- position: "absolute",
- top: menuPosition.top + 7,
- left: menuPosition.left
- }}>
-
-
- handleOptionClick(subplebbit.pubsubTopic)}>Hide thread
- {/* {isModerator ? (
+ {postMenuCatalogRef.current = el}}
+ onClick={(event) => event.stopPropagation()}
+ style={{position: "absolute",
+ top: menuPosition.top + 7,
+ left: menuPosition.left}}>
+
+
+ handleOptionClick(subplebbit.pubsubTopic)}>Hide thread
+ {/* {isModerator ? (
<>
change description
>
) : null} */}
-
-
+
+
, document.body
)}
@@ -406,22 +387,22 @@ const Description = () => {
...
+ style={{ all: 'unset', cursor: 'pointer' }}>...
{ setIsAdminListOpen(!isAdminListOpen) }}
+ style={{cursor: 'pointer'}}
+ onClick={() => {setIsAdminListOpen(!isAdminListOpen)}}
>## Board Admins
-
+ style={{float: "right", marginRight: "18px"}}>
+
-
+
Welcome to {subplebbit.title || subplebbit.address}
+ style={{marginBottom: "-15px"}}>Welcome to {subplebbit.title || subplebbit.address}
{getDate(subplebbit.createdAt)}
@@ -432,8 +413,8 @@ const Description = () => {
+ onClick={handleImageClick}
+ style={{cursor: "pointer"}} />
image
@@ -446,7 +427,7 @@ const Description = () => {
- { }} className="button-mobile">View Thread
+ {}} className="button-mobile">View Thread
@@ -465,7 +446,7 @@ const Description = () => {
marginTop: "2px",
}}>
Style:
-
+
Yotsuba
Yotsuba B
@@ -479,43 +460,43 @@ const Description = () => {
marginTop: "42px",
}}>
<>
-
- [
+
+ [
window.scrollTo(0, 0)}>All
- /
+ /
window.scrollTo(0, 0)}>Subscriptions
- ]
+ ]
+
+ {defaultSubplebbits.map((subplebbit, index) => (
+
+ {index === 0 ? null : "\u00a0"}
+ {
+ setSelectedTitle(subplebbit.title);
+ setSelectedAddress(subplebbit.address);
+ }}
+ >{subplebbit.title ? subplebbit.title : subplebbit.address}
+ {index !== defaultSubplebbits.length - 1 ? " /" : null}
- {defaultSubplebbits.map((subplebbit, index) => (
-
- {index === 0 ? null : "\u00a0"}
- {
- setSelectedTitle(subplebbit.title);
- setSelectedAddress(subplebbit.address);
- }}
- >{subplebbit.title ? subplebbit.title : subplebbit.address}
- {index !== defaultSubplebbits.length - 1 ? " /" : null}
-
- ))}
-
- [
- {
- window.electron && window.electron.isElectron ? (
- setIsCreateBoardOpen(true)
- ) : (
- alert(
- 'You can create a board with the desktop version of plebchan, which you can download from here: https://github.com/plebbit/plebchan/releases/latest\n\nIf you are comfortable with the command line, you can also run a board (called "subplebbit") using plebbit-cli: https://github.com/plebbit/plebbit-cli\n\n'
- )
- )
- }
- }>Create Board
- ]
+ ))}
+
+ [
+ {
+ 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
+ ]
[
setIsSettingsOpen(true)}>Settings
]
[
- handleStyleChange({ target: { value: "Yotsuba" } }
+ handleStyleChange({target: {value: "Yotsuba"}}
)}>Home
]
@@ -532,13 +513,13 @@ const Description = () => {
marginTop: "5px",
marginBottom: "15px",
}}>
- About
+ About
+ •
+ App
•
- App
- •
- Twitter
- •
- Telegram
+ Twitter
+ •
+ Telegram
diff --git a/src/components/views/SubscriptionsCatalog.jsx b/src/components/views/SubscriptionsCatalog.jsx
index f67619dc..a3d6404e 100755
--- a/src/components/views/SubscriptionsCatalog.jsx
+++ b/src/components/views/SubscriptionsCatalog.jsx
@@ -1,32 +1,32 @@
-import { useAccount, useFeed, usePublishCommentEdit, useSubplebbits } from '@plebbit/plebbit-react-hooks';
-import { debounce } from 'lodash';
import React, { useCallback, useEffect, useRef, useState } from 'react';
-import { confirmAlert } from 'react-confirm-alert';
import { createPortal } from 'react-dom';
import { Helmet } from 'react-helmet-async';
-import InfiniteScroll from 'react-infinite-scroller';
-import { Link, useNavigate } from 'react-router-dom';
+import { Link, useNavigate} from 'react-router-dom';
+import { confirmAlert } from 'react-confirm-alert';
import { Tooltip } from 'react-tooltip';
-import packageJson from '../../../package.json';
+import { VirtuosoGrid } from 'react-virtuoso';
+import { useAccount, useFeed, usePublishCommentEdit, useSubplebbits } from '@plebbit/plebbit-react-hooks';
+import { debounce } from 'lodash';
import useGeneralStore from '../../hooks/stores/useGeneralStore';
-import useError from '../../hooks/useError';
-import useFeedStateString from '../../hooks/useFeedStateString';
-import useSuccess from '../../hooks/useSuccess';
+import { Container, NavBar, Header, Break, PostMenu, BoardForm } from '../styled/views/Board.styled';
+import { Threads, PostMenuCatalog, GridContainer } from '../styled/views/Catalog.styled';
+import { TopBar, Footer, AuthorDeleteAlert } from '../styled/views/Thread.styled';
+import CatalogLoader from '../CatalogLoader';
+import EditModal from '../modals/EditModal';
+import ImageBanner from '../ImageBanner';
+import VerifiedAuthor from '../VerifiedAuthor';
+import CreateBoardModal from '../modals/CreateBoardModal';
+import ModerationModal from '../modals/ModerationModal';
+import OfflineIndicator from '../OfflineIndicator';
+import SettingsModal from '../modals/SettingsModal';
import countLinks from '../../utils/countLinks';
import getCommentMediaInfo from '../../utils/getCommentMediaInfo';
import handleStyleChange from '../../utils/handleStyleChange';
-import CatalogLoader from '../CatalogLoader';
-import ImageBanner from '../ImageBanner';
-import OfflineIndicator from '../OfflineIndicator';
-import VerifiedAuthor from '../VerifiedAuthor';
-import CreateBoardModal from '../modals/CreateBoardModal';
-import EditModal from '../modals/EditModal';
-import ModerationModal from '../modals/ModerationModal';
-import SettingsModal from '../modals/SettingsModal';
-import { BoardForm, Break, Container, Header, NavBar, PostMenu } from '../styled/views/Board.styled';
-import { PostMenuCatalog, Threads } from '../styled/views/Catalog.styled';
-import { AuthorDeleteAlert, Footer, TopBar } from '../styled/views/Thread.styled';
-const { version } = packageJson
+import useError from '../../hooks/useError';
+import useFeedStateString from '../../hooks/useFeedStateString';
+import useSuccess from '../../hooks/useSuccess';
+import packageJson from '../../../package.json'
+const {version} = packageJson
const SubscriptionsCatalog = () => {
@@ -67,27 +67,27 @@ const SubscriptionsCatalog = () => {
const [deletePost, setDeletePost] = useState(false);
const [isImageSearchOpen, setIsImageSearchOpen] = useState(false);
const [commentCid, setCommentCid] = useState(null);
- const [menuPosition, setMenuPosition] = useState({ top: 0, left: 0 });
+ const [menuPosition, setMenuPosition] = useState({top: 0, left: 0});
const [openMenuCid, setOpenMenuCid] = useState(null);
const [moderatorPermissions, setModeratorPermissions] = useState({});
const [isCreateBoardOpen, setIsCreateBoardOpen] = useState(false);
- const { feed, hasMore, loadMore } = useFeed({ subplebbitAddresses: account?.subscriptions, sortType: 'active' });
+ const { feed, loadMore } = useFeed({subplebbitAddresses: account?.subscriptions, sortType: 'active'});
const [selectedFeed, setSelectedFeed] = useState(feed.sort((a, b) => b.timestamp - a.timestamp));
- const { subplebbits } = useSubplebbits({ subplebbitAddresses: account?.subscriptions, sortType: 'active' });
+ const {subplebbits} = useSubplebbits({subplebbitAddresses: account?.subscriptions, sortType: 'active'});
const stateString = useFeedStateString(subplebbits);
useEffect(() => {
let permissions = {};
-
+
selectedFeed.forEach(thread => {
const subplebbit = subplebbits.find(s => s && s.address === thread.subplebbitAddress);
-
- if (subplebbit && subplebbit.roles) {
+
+ if (subplebbit && subplebbit.roles) {
const role = subplebbit.roles[account?.author.address]?.role;
-
+
if (role === 'moderator' || role === 'admin' || role === 'owner') {
permissions[thread.subplebbitAddress] = true;
} else {
@@ -95,9 +95,9 @@ const SubscriptionsCatalog = () => {
}
}
});
-
+
setModeratorPermissions(permissions);
- }, [account?.author.address, selectedFeed, subplebbits]);
+ }, [account?.author.address, selectedFeed, subplebbits]);
const handleOptionClick = () => {
@@ -118,7 +118,7 @@ const SubscriptionsCatalog = () => {
} else {
document.removeEventListener('click', handleOutsideClick);
}
-
+
return () => {
document.removeEventListener('click', handleOutsideClick);
};
@@ -131,23 +131,24 @@ const SubscriptionsCatalog = () => {
setVisible(prevScrollPos > currentScrollPos || currentScrollPos < 10);
setPrevScrollPos(currentScrollPos);
}, 50);
-
+
window.addEventListener('scroll', debouncedHandleScroll);
-
+
return () => window.removeEventListener('scroll', debouncedHandleScroll);
}, [prevScrollPos, visible]);
const tryLoadMore = async () => {
- try { loadMore() }
- catch (e) { await new Promise(resolve => setTimeout(resolve, 1000)) }
+ try {loadMore()}
+ catch (e)
+ {await new Promise(resolve => setTimeout(resolve, 1000))}
};
const onChallengeVerification = (challengeVerification) => {
if (challengeVerification.challengeSuccess === true) {
- setNewSuccessMessage('Challenge Success');
- }
+ setNewSuccessMessage('Challenge Success');
+ }
else if (challengeVerification.challengeSuccess === false) {
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
console.log('challenge failed', challengeVerification);
@@ -171,16 +172,16 @@ const SubscriptionsCatalog = () => {
const getChallengeAnswersFromUser = async (challenges) => {
setChallengesArray(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 = () => {
setIsCaptchaOpen(true);
-
+
const handleKeyDown = async (event) => {
if (event.key === 'Enter') {
const currentCaptchaResponse = useGeneralStore.getState().captchaResponse;
@@ -196,7 +197,7 @@ const SubscriptionsCatalog = () => {
setResolveCaptchaPromise(resolve);
};
-
+
challengeImg.onerror = () => {
reject(setNewErrorMessage('Could not load challenges'));
};
@@ -213,8 +214,8 @@ const SubscriptionsCatalog = () => {
setNewErrorMessage(error.message); console.log(error);
},
});
-
-
+
+
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
@@ -261,8 +262,8 @@ const SubscriptionsCatalog = () => {
setOriginalCommentContent(comment.content);
setIsEditModalOpen(true);
}
-
-
+
+
useEffect(() => {
setPublishCommentEditOptions((prevOptions) => ({
...prevOptions,
@@ -278,7 +279,7 @@ const SubscriptionsCatalog = () => {
}
}, [editedComment, setIsAuthorEdit]);
-
+
useEffect(() => {
let isActive = true;
if (publishCommentEditOptions && triggerPublishCommentEdit) {
@@ -324,60 +325,60 @@ const SubscriptionsCatalog = () => {
return (
<>
- Subscriptions - Catalog - plebchan
+ Subscriptions - Catalog - plebchan
setIsCreateBoardOpen(false)} />
+ selectedStyle={selectedStyle}
+ isOpen={isCreateBoardOpen}
+ closeModal={() => setIsCreateBoardOpen(false)} />
setIsSettingsOpen(false)} />
- { setIsModerationOpen(false); setDeletePost(false) }}
- deletePost={deletePost} />
+ selectedStyle={selectedStyle}
+ isOpen={isSettingsOpen}
+ closeModal={() => setIsSettingsOpen(false)} />
+ {setIsModerationOpen(false); setDeletePost(false)}}
+ deletePost={deletePost} />
setIsEditModalOpen(false)}
- originalCommentContent={originalCommentContent} />
+ selectedStyle={selectedStyle}
+ isOpen={isEditModalOpen}
+ closeModal={() => setIsEditModalOpen(false)}
+ originalCommentContent={originalCommentContent} />
<>
-
- [
+
+ [
window.scrollTo(0, 0)}>All
- /
+ /
window.scrollTo(0, 0)}>Subscriptions
- ] [
- {defaultSubplebbits.map((subplebbit, index) => (
-
- {index === 0 ? null : "\u00a0"}
- {
- setSelectedTitle(subplebbit.title);
- setSelectedAddress(subplebbit.address);
- }}
- >{subplebbit.title ? subplebbit.title : subplebbit.address}
- {index !== defaultSubplebbits.length - 1 ? " /" : null}
-
- ))}
- ]
-
+ ] [
+ {defaultSubplebbits.map((subplebbit, index) => (
+
+ {index === 0 ? null : "\u00a0"}
+ {
+ setSelectedTitle(subplebbit.title);
+ setSelectedAddress(subplebbit.address);
+ }}
+ >{subplebbit.title ? subplebbit.title : subplebbit.address}
+ {index !== defaultSubplebbits.length - 1 ? " /" : null}
+
+ ))}
+ ]
+
[
- {
- window.electron && window.electron.isElectron ? (
- setIsCreateBoardOpen(true)
- ) : (
- alert(
- 'You can create a board with the desktop version of plebchan, which you can download from here: https://github.com/plebbit/plebchan/releases/latest\n\nIf you are comfortable with the command line, you can also run a board (called "subplebbit") using plebbit-cli: https://github.com/plebbit/plebbit-cli\n\n'
- )
+ {
+ 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
]
[
@@ -396,20 +397,20 @@ const SubscriptionsCatalog = () => {
All
Subscriptions
{defaultSubplebbits.map(subplebbit => (
- {subplebbit.title ? subplebbit.title : subplebbit.address}
- ))}
-
- alert(
- 'You can create a board with the desktop version of plebchan, which you can download from here: https://github.com/plebbit/plebchan/releases/latest\n\nIf you are comfortable with the command line, you can also run a board (called "subplebbit") using plebbit-cli: https://github.com/plebbit/plebbit-cli\n\n'
+ {subplebbit.title ? subplebbit.title : subplebbit.address}
+ ))}
+
+ 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