feat(author sidebar): add to author and profile mobile views on top of posts, remove about tab

This commit is contained in:
plebeius.eth
2023-12-14 17:12:29 +01:00
parent 4ac0d4437e
commit 1e07ce2ff9
7 changed files with 22 additions and 8 deletions

View File

@@ -109,11 +109,11 @@ const AuthorSidebar = () => {
<>
<div>
<span className={styles.karma}>{postScore}</span> post karma
{isAuthorPage && postScore && ' (estimated)'}
{isAuthorPage && postScore ? ' (estimated)' : null}
</div>
<div>
<span className={styles.karma}>{replyScore}</span> comment karma
{isAuthorPage && replyScore && ' (estimated)'}
{isAuthorPage && replyScore ? ' (estimated)' : null}
</div>
</>
) : null}

View File

@@ -313,7 +313,7 @@ const Header = () => {
<div className={`${styles.tabs} ${hasFewTabs ? styles.fewTabs : ''}`}>
<ul className={styles.tabMenu}>
<HeaderTabs />
{(isSubplebbitPage || isSubplebbitSubmitPage || isPostPage || isProfilePage || isAuthorPage) && <AboutButton />}
{(isSubplebbitPage || isSubplebbitSubmitPage || isPostPage) && <AboutButton />}
</ul>
</div>
)}

View File

@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
import styles from './sort-dropdown.module.css';
const SortDropdown = () => {
const sortLabels = ['new', 'old']
const sortLabels = ['new', 'old'];
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const dropdownRef = useRef<HTMLDivElement>(null);

View File

@@ -7,7 +7,13 @@ div[data-viewport-type="window"] {
}
@media (max-width: 768px) {
.sidebar {
.sidebarDesktop {
display: none;
}
.sidebarMobile {
width: 300px;
display: inline-block;
padding: 10px 0 0px 5px;
}
}

View File

@@ -20,6 +20,7 @@ const Author = () => {
const params = useParams();
const isAuthorCommentsPage = isAuthorCommentsView(location.pathname, params);
const isAuthorSubmittedPage = isAuthorSubmittedView(location.pathname, params);
const isMobile = window.innerWidth < 768;
const { authorComments, lastCommentCid, hasMore, loadMore } = useAuthorComments({ commentCid, authorAddress });
@@ -72,7 +73,7 @@ const Author = () => {
return (
<div className={styles.content}>
<div className={styles.sidebar}>
<div className={isMobile ? styles.sidebarMobile : styles.sidebarDesktop}>
<AuthorSidebar />
</div>
<SortDropdown />

View File

@@ -7,7 +7,13 @@ div[data-viewport-type="window"] {
}
@media (max-width: 768px) {
.sidebar {
.sidebarDesktop {
display: none;
}
.sidebarMobile {
width: 300px;
display: inline-block;
padding: 10px 0 0px 5px;
}
}

View File

@@ -22,6 +22,7 @@ const Profile = () => {
const isDownvotedPage = isDownvotedView(location.pathname);
const isCommentsPage = isProfileCommentsView(location.pathname);
const isSubmittedPage = isProfileSubmittedView(location.pathname);
const isMobile = window.innerWidth < 768;
const upvotedCommentCids = useMemo(() => accountVotes?.filter((vote) => vote.vote === 1).map((vote) => vote.commentCid) || [], [accountVotes]);
const downvotedCommentCids = useMemo(() => accountVotes?.filter((vote) => vote.vote === -1).map((vote) => vote.commentCid) || [], [accountVotes]);
@@ -61,7 +62,7 @@ const Profile = () => {
return (
<div className={styles.content}>
<div className={styles.sidebar}>
<div className={isMobile ? styles.sidebarMobile : styles.sidebarDesktop}>
<AuthorSidebar />
</div>
<SortDropdown />