This commit is contained in:
Tom (plebeius.eth)
2024-06-01 18:13:41 +02:00
parent 911ec8f65f
commit ee69ab60ed
6 changed files with 86 additions and 52 deletions
@@ -25,6 +25,24 @@
padding: 10px 0;
}
.desktopBoardButtons {
display: flex;
align-items: center;
justify-content: space-between; /* Ensure elements are spaced out properly */
}
.desktopBoardButtons::after {
content: "";
display: table;
clear: both;
}
.desktopBoardButtons .rightSideButtons {
margin-left: auto; /* Push the right-side buttons to the right */
display: flex;
align-items: center;
}
@media (max-width: 640px) {
.desktopBoardButtons {
display: none;
@@ -35,8 +53,4 @@
.mobileBoardButtons {
display: none;
}
.rightSideButtons {
float: right;
}
}
}
+43 -35
View File
@@ -68,11 +68,12 @@ const SortOptions = () => {
};
return (
<>
Sort by:{' '}
Sort by:&nbsp;
<select value={sortType} onChange={handleSortChange}>
<option value='active'>Bump order</option>
<option value='new'>Creation date</option>
</select>{' '}
</select>
&nbsp;
</>
);
};
@@ -134,45 +135,52 @@ export const DesktopBoardButtons = () => {
const isInSubscriptionsView = isSubscriptionsView(location.pathname);
return (
<div className={styles.desktopBoardButtons}>
<>
<hr />
{isInPostView || isInPendingPostPage ? (
<>
[
<ReturnButton address={subplebbitAddress} isInAllView={isInAllView} isInSubscriptionsView={isInSubscriptionsView} />
] [
<CatalogButton address={subplebbitAddress} isInAllView={isInAllView} isInSubscriptionsView={isInSubscriptionsView} />
] [
<OptionsButton />]{' '}
{isInPostView && (
<span className={styles.rightSideButtons}>
[<SubscribeButton address={subplebbitAddress} />]
</span>
)}
</>
) : (
<>
[
{isInCatalogView ? (
<div className={styles.desktopBoardButtons}>
{isInPostView || isInPendingPostPage ? (
<>
[
<ReturnButton address={subplebbitAddress} isInAllView={isInAllView} isInSubscriptionsView={isInSubscriptionsView} />
) : (
] [
<CatalogButton address={subplebbitAddress} isInAllView={isInAllView} isInSubscriptionsView={isInSubscriptionsView} />
)}
] [
<OptionsButton />
] [
<RefreshButton />]{' '}
<span className={styles.rightSideButtons}>
{isInCatalogView && <SortOptions />}
{!(isInAllView || isInSubscriptionsView) && (
<>
] [
<OptionsButton />]
{isInPostView && (
<span className={styles.rightSideButtons}>
[
<SubscribeButton address={subplebbitAddress} />]
</span>
)}
</>
) : (
<>
{isInCatalogView ? (
<>
[
<ReturnButton address={subplebbitAddress} isInAllView={isInAllView} isInSubscriptionsView={isInSubscriptionsView} />]{' '}
</>
) : (
<>
[
<CatalogButton address={subplebbitAddress} isInAllView={isInAllView} isInSubscriptionsView={isInSubscriptionsView} />]{' '}
</>
)}
</span>
</>
)}
</div>
[
<OptionsButton />] [
<RefreshButton />]
<span className={styles.rightSideButtons}>
{isInCatalogView && <SortOptions />}
{!(isInAllView || isInSubscriptionsView) && (
<>
[
<SubscribeButton address={subplebbitAddress} />]
</>
)}
</span>
</>
)}
</div>
</>
);
};
@@ -7,12 +7,14 @@ import { Comment, useBlock } from '@plebbit/plebbit-react-hooks';
import styles from './post-menu-desktop.module.css';
import { getCommentMediaInfo } from '../../../../lib/utils/media-utils';
import { copyShareLinkToClipboard, isValidURL } from '../../../../lib/utils/url-utils';
import { isCatalogView, isPostPageView } from '../../../../lib/utils/view-utils';
import { isAllView, isCatalogView, isPostPageView, isSubscriptionsView } from '../../../../lib/utils/view-utils';
import _ from 'lodash';
interface PostMenuDesktopProps {
cid: string;
isDescription?: boolean;
isInAllView?: boolean;
isInSubscriptionsView?: boolean;
isRules?: boolean;
subplebbitAddress: string;
onClose: () => void;
@@ -67,10 +69,10 @@ const ImageSearchButton = ({ url, onClose }: { url: string; onClose: () => void
);
};
const ViewOnButton = ({ cid, isDescription, isRules, subplebbitAddress, onClose }: PostMenuDesktopProps) => {
const ViewOnButton = ({ cid, isDescription, isInAllView, isInSubscriptionsView, isRules, subplebbitAddress, onClose }: PostMenuDesktopProps) => {
const { t } = useTranslation();
const [isClientRedirectMenuOpen, setIsClientRedirectMenuOpen] = useState(false);
const viewOnOtherClientLink = `p/${subplebbitAddress}${isDescription || isRules ? '' : `/c/${cid}`}`;
const viewOnOtherClientLink = `p/${isInAllView ? 'all' : isInSubscriptionsView ? 'subscriptions' : subplebbitAddress}${isDescription || isRules ? '' : `/c/${cid}`}`;
const { refs, floatingStyles } = useFloating({
placement: 'right-start',
@@ -85,13 +87,13 @@ const ViewOnButton = ({ cid, isDescription, isRules, subplebbitAddress, onClose
ref={refs.setReference}
onClick={onClose}
>
{t('view_on')} »
{_.capitalize(t('view_on'))} »
{isClientRedirectMenuOpen && (
<div ref={refs.setFloating} style={floatingStyles} className={styles.dropdownMenu}>
<a href={`https://seedit.app/#/${viewOnOtherClientLink}`} target='_blank' rel='noreferrer'>
<a href={`https://seedit.eth.limo/#/${viewOnOtherClientLink}`} target='_blank' rel='noreferrer'>
<div className={styles.postMenuItem}>Seedit</div>
</a>
<a href={`https://plebones.netlify.app/#/${viewOnOtherClientLink}`} target='_blank' rel='noreferrer'>
<a href={`https://plebones.eth.limo/#/${viewOnOtherClientLink}`} target='_blank' rel='noreferrer'>
<div className={styles.postMenuItem}>Plebones</div>
</a>
</div>
@@ -111,8 +113,10 @@ const PostMenuDesktop = ({ post }: { post: Comment }) => {
const location = useLocation();
const params = useParams();
const isInAllView = isAllView(location.pathname);
const isInCatalogView = isCatalogView(location.pathname);
const isInPostPageView = isPostPageView(location.pathname, params);
const isInSubscriptionsView = isSubscriptionsView(location.pathname);
const { refs, floatingStyles, context } = useFloating({
placement: 'bottom-start',
@@ -158,7 +162,15 @@ const PostMenuDesktop = ({ post }: { post: Comment }) => {
</div>
)}
{link && isValidURL(link) && (type === 'image' || type === 'gif' || thumbnail) && url && <ImageSearchButton url={url} onClose={handleClose} />}
<ViewOnButton cid={cid} isDescription={isDescription} isRules={isRules} subplebbitAddress={subplebbitAddress} onClose={handleClose} />
<ViewOnButton
cid={cid}
isDescription={isDescription}
isInAllView={isInAllView}
isInSubscriptionsView={isInSubscriptionsView}
isRules={isRules}
subplebbitAddress={subplebbitAddress}
onClose={handleClose}
/>
</div>
</FloatingFocusManager>,
document.body,
@@ -51,10 +51,10 @@ const ViewOnButtons = ({ cid, isDescription, isRules, subplebbitAddress, onClose
const viewOnOtherClientLink = `p/${subplebbitAddress}${isDescription || isRules ? '' : `/c/${cid}`}`;
return (
<div onClick={onClose}>
<a href={`https://seedit.app/#/${viewOnOtherClientLink}`} target='_blank' rel='noreferrer'>
<a href={`https://seedit.eth.limo/#/${viewOnOtherClientLink}`} target='_blank' rel='noreferrer'>
<div className={styles.postMenuItem}>{t('view_on_client', { client: 'Seedit' })}</div>
</a>
<a href={`https://plebones.netlify.app/#/${viewOnOtherClientLink}`} target='_blank' rel='noreferrer'>
<a href={`https://plebones.eth.limo/#/${viewOnOtherClientLink}`} target='_blank' rel='noreferrer'>
<div className={styles.postMenuItem}>{t('view_on_client', { client: 'Plebones' })}</div>
</a>
</div>
@@ -23,7 +23,7 @@ const SubplebbitDescription = ({ avatarUrl, createdAt, description, shortAddress
isDescription: true,
subplebbitAddress,
timestamp: isInAllView ? multisubMetadata?.createdAt : createdAt,
author: { displayName: `'## ${t('board_mods')}` },
author: { displayName: `## ${t('board_mods')}` },
content: isInAllView ? multisubMetadata?.description : description,
link: avatarUrl,
title: t('welcome_to_board', {
+2 -2
View File
@@ -56,8 +56,8 @@ const TopBarMobile = ({ subplebbitAddress }: { subplebbitAddress: string }) => {
const boardSelect = (
<select value={selectValue} onChange={(e) => navigate(`/p/${e.target.value}${isInCatalogView ? '/catalog' : ''}`)}>
{!currentSubplebbitIsInList && subplebbitAddress && <option value={subplebbitAddress}>{displaySubplebbitAddress}</option>}
<option value='all'>{t('all')}</option>
<option value='subscriptions'>{t('subscriptions')}</option>
<option value='all'>all</option>
<option value='subscriptions'>subscriptions</option>
{subplebbitAddresses.map((address: any, index: number) => {
const subplebbitAddress = address?.includes('.') ? address : address?.slice(0, 10).concat('...');
return (