From 0645e6261621e5971d6f1b8057271c9451f2d024 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 25 Nov 2024 19:52:24 +0100 Subject: [PATCH 01/14] missing cursor pointer --- .../post/comment-tools/mod-menu/mod-menu.module.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/post/comment-tools/mod-menu/mod-menu.module.css b/src/components/post/comment-tools/mod-menu/mod-menu.module.css index b23edf01..ba703441 100644 --- a/src/components/post/comment-tools/mod-menu/mod-menu.module.css +++ b/src/components/post/comment-tools/mod-menu/mod-menu.module.css @@ -62,4 +62,8 @@ .banInput { width: 3.5em; } +} + +.modal .menuItem label { + cursor: pointer; } \ No newline at end of file From 00848a90e378ea1ef7562a0731ad00cb208a538c Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 25 Nov 2024 19:53:13 +0100 Subject: [PATCH 02/14] missing space --- src/components/reply/reply.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/reply/reply.tsx b/src/components/reply/reply.tsx index 2a78e8e1..e35496ef 100644 --- a/src/components/reply/reply.tsx +++ b/src/components/reply/reply.tsx @@ -392,7 +392,7 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl {edit && {t('edited_timestamp', { timestamp: getFormattedTimeAgo(edit.timestamp) })}} {' '} {pinned && - {t('stickied_comment')}} - {collapsed && ({childrenString})} + {collapsed && ({childrenString}) } {stateLabel}{' '} {!collapsed && flair && ( <> From a02ed8f1163ca311a6137c3001a7d2402184d2cc Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 25 Nov 2024 21:44:22 +0100 Subject: [PATCH 03/14] fix(reply): pending edit label appeared cut off --- src/components/reply/reply.module.css | 22 ++++++++++++ src/components/reply/reply.tsx | 46 +++++++++++++++++------- src/hooks/use-element-position.ts | 52 +++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 13 deletions(-) create mode 100644 src/hooks/use-element-position.ts diff --git a/src/components/reply/reply.module.css b/src/components/reply/reply.module.css index a77d031c..9fe9abd1 100644 --- a/src/components/reply/reply.module.css +++ b/src/components/reply/reply.module.css @@ -67,6 +67,7 @@ } .tagline { + display: inline-block; color: var(--text); font-size: x-small; } @@ -354,4 +355,25 @@ .md { padding-right: 5px; } +} + +.portalLabel { + pointer-events: none; + font-size: x-small; + font-family: verdana, arial, helvetica, sans-serif; + font-size: x-small; + display: inline-block; + margin-left: 4px; +} + +.collapsedStateLabel { + display: inline-block; + margin-left: 4px; +} + +.stamp { + font-family: inherit; + font-size: x-small; + line-height: normal; + vertical-align: middle; } \ No newline at end of file diff --git a/src/components/reply/reply.tsx b/src/components/reply/reply.tsx index e35496ef..0e1b61b1 100644 --- a/src/components/reply/reply.tsx +++ b/src/components/reply/reply.tsx @@ -1,4 +1,4 @@ -import { Fragment, useCallback, useEffect, useMemo, useState } from 'react'; +import { Fragment, useCallback, useEffect, useMemo, useState, useRef } from 'react'; import { Comment, useAccountComment, useAuthorAddress, useAuthorAvatar, useBlock, useComment, useEditedComment, useSubplebbit } from '@plebbit/plebbit-react-hooks'; import { flattenCommentsPages } from '@plebbit/plebbit-react-hooks/dist/lib/utils'; import { Link, useLocation, useParams } from 'react-router-dom'; @@ -23,6 +23,8 @@ import { isInboxView, isPostContextView, isPostView } from '../../lib/utils/view import Plebbit from '@plebbit/plebbit-js/dist/browser/index.js'; import Markdown from '../markdown'; import { getHostname } from '../../lib/utils/url-utils'; +import { createPortal } from 'react-dom'; +import { useElementPosition } from '../../hooks/use-element-position'; interface ReplyAuthorProps { address: string; @@ -329,16 +331,6 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl const [upvoted, upvote] = useUpvote(reply); const [downvoted, downvote] = useDownvote(reply); - const stateLabel = ( - - {state === 'failed' && - ); - const unnestedReplies = useMemo(() => flattenCommentsPages(reply.replies), [reply.replies]); const childrenCount = unnestedReplies.length; const childrenString = childrenCount === 1 ? t('child', { childrenCount }) : t('children', { childrenCount }); @@ -357,6 +349,18 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl setCollapsed(!collapsed); }; + const taglineRef = useRef(null); + const labelPosition = useElementPosition(taglineRef, collapsed); + const stateLabel = ( + + {state === 'failed' && + ); + return (
{isSingleReply && !isInInboxView && } @@ -371,7 +375,7 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl
{!isInInboxView && ( -

+

[{collapsed ? '+' : '–'}] @@ -393,7 +397,7 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl {' '} {pinned && - {t('stickied_comment')}} {collapsed && ({childrenString}) } - {stateLabel}{' '} + {!collapsed && stateLabel} {!collapsed && flair && ( <> {' '} @@ -512,6 +516,22 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl )}

+ {collapsed && + labelPosition && + createPortal( +
+ {stateLabel} +
, + document.body, + )}
); }; diff --git a/src/hooks/use-element-position.ts b/src/hooks/use-element-position.ts new file mode 100644 index 00000000..04000c2d --- /dev/null +++ b/src/hooks/use-element-position.ts @@ -0,0 +1,52 @@ +import { useState, useEffect } from 'react'; + +interface Position { + top: number; + left: number; +} + +export const useElementPosition = (ref: React.RefObject, enabled: boolean | undefined) => { + const [position, setPosition] = useState(null); + + useEffect(() => { + if (!ref.current || !enabled) { + setPosition(null); + return; + } + + let rafId: number; + let lastTop: number = 0; + let lastLeft: number = 0; + + const updatePosition = () => { + if (!ref.current) return; + + const rect = ref.current.getBoundingClientRect(); + const newTop = window.scrollY + rect.top + rect.height / 2; + const newLeft = rect.right + 5; + + // Only update state if position actually changed + if (newTop !== lastTop || newLeft !== lastLeft) { + lastTop = newTop; + lastLeft = newLeft; + setPosition({ top: newTop, left: newLeft }); + } + + rafId = requestAnimationFrame(updatePosition); + }; + + // Start the animation frame loop + updatePosition(); + + // Also watch for size changes + const resizeObserver = new ResizeObserver(updatePosition); + resizeObserver.observe(ref.current); + + return () => { + cancelAnimationFrame(rafId); + resizeObserver.disconnect(); + }; + }, [ref, enabled]); + + return position; +}; From 61c9f3061839d9112085001a4c7933d05a2b1961 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Thu, 28 Nov 2024 23:56:02 +0100 Subject: [PATCH 04/14] fix(header): seedit logo should show in subs without their own logo --- src/components/header/header.module.css | 3 +-- src/components/header/header.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/header/header.module.css b/src/components/header/header.module.css index c05db094..083b45c2 100644 --- a/src/components/header/header.module.css +++ b/src/components/header/header.module.css @@ -41,8 +41,7 @@ width: 84px; max-height: 26px; margin-top: 16px; - margin-right: 5px; - padding-right: 1ex; + padding-right: 5px; filter: var(--filter90); } diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index 7818da24..593ac8e5 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -364,10 +364,12 @@ const Header = () => { (isInProfileView && !isInHomeAboutView) || (isInAllView && !isInAllAboutView) || (isInAuthorView && !isInHomeAboutView); - const logoSrc = isInSubplebbitView ? suggested?.avatarUrl : 'assets/logo/seedit.png'; + const logoSrc = isInSubplebbitView && suggested?.avatarUrl ? suggested?.avatarUrl : 'assets/logo/seedit.png'; const logoIsAvatar = isInSubplebbitView && suggested?.avatarUrl; const logoLink = isInSubplebbitView ? `/p/${params.subplebbitAddress}` : isInProfileView ? '/profile' : '/'; + console.log(isInAuthorView); + return (
{ >
- {(logoIsAvatar || (!isInSubplebbitView && !isInProfileView && !isInAuthorView)) && ( + {(logoIsAvatar || (!isInSubplebbitView && !isInProfileView && !isInAuthorView) || (isInSubplebbitView && !suggested?.avatarUrl)) && ( )} - {!isInSubplebbitView && !isInProfileView && !isInAuthorView && ( + {((!isInSubplebbitView && !isInProfileView && !isInAuthorView) || (isInSubplebbitView && !suggested?.avatarUrl)) && ( )} From 448673dd5b54f9ca1f08b4fab03a08a8cf698e0f Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 2 Dec 2024 10:33:28 +0100 Subject: [PATCH 05/14] fix(ellipsis animation): dots could appear cut off and cause displacement changing width of string --- .../loading-ellipsis.module.css | 53 +++++++++++++++---- .../loading-ellipsis/loading-ellipsis.tsx | 15 +++++- 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/src/components/loading-ellipsis/loading-ellipsis.module.css b/src/components/loading-ellipsis/loading-ellipsis.module.css index 9dfe4e9f..7e1e6993 100644 --- a/src/components/loading-ellipsis/loading-ellipsis.module.css +++ b/src/components/loading-ellipsis/loading-ellipsis.module.css @@ -1,21 +1,52 @@ -.ellipsis:after { - overflow: hidden; +.nowrap { + white-space: nowrap; +} + +.ellipsis { display: inline-block; - vertical-align: text-bottom; - -webkit-animation: ellipsis steps(4,end) 1500ms infinite; - animation: ellipsis steps(4,end) 1500ms infinite; - content: "\2026"; /* ascii code for the ellipsis character */ - width: 0px; + width: 4ch; +} + +.ellipsis:after { + display: inline-block; + vertical-align: bottom; + -webkit-animation: ellipsis 1500ms steps(4, end) infinite; + animation: ellipsis 1500ms steps(4, end) infinite; + content: ""; } @keyframes ellipsis { - to { - width: 1.25em; + 0% { + content: ""; + } + 25% { + content: "."; + } + 50% { + content: ".."; + } + 75% { + content: "..."; + } + 100% { + content: ""; } } @-webkit-keyframes ellipsis { - to { - width: 1.25em; + 0% { + content: ""; + } + 25% { + content: "."; + } + 50% { + content: ".."; + } + 75% { + content: "..."; + } + 100% { + content: ""; } } \ No newline at end of file diff --git a/src/components/loading-ellipsis/loading-ellipsis.tsx b/src/components/loading-ellipsis/loading-ellipsis.tsx index 639d62f4..b94f4600 100644 --- a/src/components/loading-ellipsis/loading-ellipsis.tsx +++ b/src/components/loading-ellipsis/loading-ellipsis.tsx @@ -5,7 +5,20 @@ interface LoadingEllipsisProps { } const LoadingEllipsis = ({ string }: LoadingEllipsisProps) => { - return {string}; + const words = string.split(' '); + const lastWord = words.pop(); + const restOfString = words.join(' '); + + return ( + + {restOfString} + {restOfString && ' '} + + {lastWord} + + + + ); }; export default LoadingEllipsis; From 260933dc168289f4f072e64747f0b09fe02dcf94 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 2 Dec 2024 11:19:23 +0100 Subject: [PATCH 06/14] Update all.tsx --- src/views/all/all.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/all/all.tsx b/src/views/all/all.tsx index 6d30d546..4881283a 100644 --- a/src/views/all/all.tsx +++ b/src/views/all/all.tsx @@ -62,7 +62,7 @@ const All = () => { footerContent = ( <> {subplebbitAddressesWithNewerPosts.length > 0 ? ( -
+
{ showMorePostsSuggestion && monthlyFeed.length > feed.length && (weeklyFeed.length > feed.length ? ( -
+
{ />
) : ( -
+
Date: Mon, 2 Dec 2024 16:38:16 +0100 Subject: [PATCH 07/14] fix pending label placement in collapsed replies --- src/components/header/header.tsx | 2 -- src/components/reply/reply.tsx | 13 +++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index 593ac8e5..96bf87ec 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -368,8 +368,6 @@ const Header = () => { const logoIsAvatar = isInSubplebbitView && suggested?.avatarUrl; const logoLink = isInSubplebbitView ? `/p/${params.subplebbitAddress}` : isInProfileView ? '/profile' : '/'; - console.log(isInAuthorView); - return (
{!isInInboxView && ( -

+

[{collapsed ? '+' : '–'}] @@ -396,7 +396,12 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl {edit && {t('edited_timestamp', { timestamp: getFormattedTimeAgo(edit.timestamp) })}} {' '} {pinned && - {t('stickied_comment')}} - {collapsed && ({childrenString}) } + {collapsed && ( + + {' '} + ({childrenString}){' '} + + )} {!collapsed && stateLabel} {!collapsed && flair && ( <> @@ -404,7 +409,7 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl )} - {state === 'pending' && loadingString} + {state === 'pending' && !collapsed && <> {loadingString}}

)} {isInInboxView && ( @@ -528,7 +533,7 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl transform: 'translateY(-50%)', }} > - {stateLabel} + {stateLabel} {state === 'pending' && loadingString}
, document.body, )} From 9d8e5ce69c891190a0e27797f164f82a3017fa8d Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 2 Dec 2024 16:42:06 +0100 Subject: [PATCH 08/14] refactor thumbnail fetching logic into hook --- src/components/post/post.tsx | 34 ++++------------------------- src/components/reply/reply.tsx | 23 +++++-------------- src/hooks/use-comment-media-info.ts | 20 +++++++++++++++++ 3 files changed, 29 insertions(+), 48 deletions(-) create mode 100644 src/hooks/use-comment-media-info.ts diff --git a/src/components/post/post.tsx b/src/components/post/post.tsx index 74348fcf..f054d590 100644 --- a/src/components/post/post.tsx +++ b/src/components/post/post.tsx @@ -1,10 +1,10 @@ -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import styles from './post.module.css'; import { Link, useLocation, useParams } from 'react-router-dom'; import { Comment, useAuthorAddress, useBlock, useComment, useEditedComment, useSubplebbit, useSubscribe } from '@plebbit/plebbit-react-hooks'; import { useTranslation } from 'react-i18next'; import { isAllView, isPostView, isProfileHiddenView, isSubplebbitView } from '../../lib/utils/view-utils'; -import { CommentMediaInfo, fetchWebpageThumbnailIfNeeded, getCommentMediaInfo, getHasThumbnail } from '../../lib/utils/media-utils'; +import { getHasThumbnail } from '../../lib/utils/media-utils'; import { getPostScore } from '../../lib/utils/post-utils'; import { getHostname } from '../../lib/utils/url-utils'; import { getFormattedTimeAgo, formatLocalizedUTCTimestamp } from '../../lib/utils/time-utils'; @@ -17,6 +17,7 @@ import Thumbnail from './thumbnail'; import useDownvote from '../../hooks/use-downvote'; import useUpvote from '../../hooks/use-upvote'; import _ from 'lodash'; +import { useCommentMediaInfo } from '../../hooks/use-comment-media-info'; interface PostAuthorProps { authorAddress: string; @@ -70,33 +71,6 @@ interface PostProps { post: Comment | undefined; } -const ThumbnailLoader = ({ post }: PostProps) => { - const { cid } = post || {}; - // Reset state by remounting component when post changes - return useThumbnailContent(cid, post); -}; - -const useThumbnailContent = (key: string, post: any) => { - const [commentMediaInfo, setCommentMediaInfo] = useState(); - - useEffect(() => { - const loadThumbnail = async () => { - const initialInfo = getCommentMediaInfo(post); - // some sites have CORS access, so the thumbnail can be fetched client-side, which is helpful if subplebbit.settings.fetchThumbnailUrls is false - if (initialInfo?.type === 'webpage' && !initialInfo.thumbnail) { - const newMediaInfo = await fetchWebpageThumbnailIfNeeded(initialInfo); - setCommentMediaInfo(newMediaInfo); - } else { - setCommentMediaInfo(initialInfo); - } - }; - - loadThumbnail(); - }, [post]); - - return commentMediaInfo; -}; - const Post = ({ index, post = {} }: PostProps) => { // handle single comment thread const op = useComment({ commentCid: post?.parentCid ? post?.postCid : '' }); @@ -147,7 +121,7 @@ const Post = ({ index, post = {} }: PostProps) => { const isInProfileHiddenView = isProfileHiddenView(location.pathname); const isInSubplebbitView = isSubplebbitView(location.pathname, params); - const commentMediaInfo = ThumbnailLoader({ post }); + const commentMediaInfo = useCommentMediaInfo(post); const [isExpanded, setIsExpanded] = useState(isInPostView); const toggleExpanded = () => setIsExpanded(!isExpanded); diff --git a/src/components/reply/reply.tsx b/src/components/reply/reply.tsx index 4e4b7933..661683db 100644 --- a/src/components/reply/reply.tsx +++ b/src/components/reply/reply.tsx @@ -1,11 +1,13 @@ -import { Fragment, useCallback, useEffect, useMemo, useState, useRef } from 'react'; +import { Fragment, useEffect, useMemo, useState, useRef } from 'react'; import { Comment, useAccountComment, useAuthorAddress, useAuthorAvatar, useBlock, useComment, useEditedComment, useSubplebbit } from '@plebbit/plebbit-react-hooks'; import { flattenCommentsPages } from '@plebbit/plebbit-react-hooks/dist/lib/utils'; import { Link, useLocation, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import styles from './reply.module.css'; +import { useCommentMediaInfo } from '../../hooks/use-comment-media-info'; +import { useElementPosition } from '../../hooks/use-element-position'; import useReplies from '../../hooks/use-replies'; -import { CommentMediaInfo, fetchWebpageThumbnailIfNeeded, getCommentMediaInfo, getHasThumbnail } from '../../lib/utils/media-utils'; +import { CommentMediaInfo, getHasThumbnail } from '../../lib/utils/media-utils'; import { formatLocalizedUTCTimestamp, getFormattedTimeAgo } from '../../lib/utils/time-utils'; import CommentEditForm from '../comment-edit-form'; import LoadingEllipsis from '../loading-ellipsis/'; @@ -24,7 +26,6 @@ import Plebbit from '@plebbit/plebbit-js/dist/browser/index.js'; import Markdown from '../markdown'; import { getHostname } from '../../lib/utils/url-utils'; import { createPortal } from 'react-dom'; -import { useElementPosition } from '../../hooks/use-element-position'; interface ReplyAuthorProps { address: string; @@ -301,21 +302,7 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl const showCommentEditForm = () => setIsEditing(true); const hideCommentEditForm = () => setIsEditing(false); - // some sites have CORS access, so the thumbnail can be fetched client-side, which is helpful if subplebbit.settings.fetchThumbnailUrls is false - const initialCommentMediaInfo = useMemo(() => getCommentMediaInfo(reply), [reply]); - const [commentMediaInfo, setCommentMediaInfo] = useState(initialCommentMediaInfo); - - const fetchThumbnail = useCallback(async () => { - if (initialCommentMediaInfo?.type === 'webpage' && !initialCommentMediaInfo.thumbnail) { - const newMediaInfo = await fetchWebpageThumbnailIfNeeded(initialCommentMediaInfo); - setCommentMediaInfo(newMediaInfo); - } - }, [initialCommentMediaInfo]); - - useEffect(() => { - fetchThumbnail(); - }, [fetchThumbnail]); - + const commentMediaInfo = useCommentMediaInfo(reply); const hasThumbnail = getHasThumbnail(commentMediaInfo, link); const { t, i18n } = useTranslation(); diff --git a/src/hooks/use-comment-media-info.ts b/src/hooks/use-comment-media-info.ts new file mode 100644 index 00000000..711fa75e --- /dev/null +++ b/src/hooks/use-comment-media-info.ts @@ -0,0 +1,20 @@ +import { useCallback, useEffect, useMemo, useState } from 'react'; +import { Comment } from '@plebbit/plebbit-react-hooks'; +import { getCommentMediaInfo, fetchWebpageThumbnailIfNeeded } from '../lib/utils/media-utils'; + +export const useCommentMediaInfo = (comment: Comment) => { + // some sites have CORS access, so the thumbnail can be fetched client-side, which is helpful if subplebbit.settings.fetchThumbnailUrls is false + const initialCommentMediaInfo = useMemo(() => getCommentMediaInfo(comment), [comment]); + const [commentMediaInfo, setCommentMediaInfo] = useState(initialCommentMediaInfo); + const fetchThumbnail = useCallback(async () => { + if (initialCommentMediaInfo?.type === 'webpage' && !initialCommentMediaInfo.thumbnail) { + const newMediaInfo = await fetchWebpageThumbnailIfNeeded(initialCommentMediaInfo); + setCommentMediaInfo(newMediaInfo); + } + }, [initialCommentMediaInfo]); + useEffect(() => { + fetchThumbnail(); + }, [fetchThumbnail]); + + return commentMediaInfo; +}; From ed435c207c4cc6bbd8e86c5669bd464ddd6c522d Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 2 Dec 2024 16:52:28 +0100 Subject: [PATCH 09/14] rename rpc and data path settings and variables --- src/views/about/about.tsx | 2 +- .../plebbit-options/plebbit-options.tsx | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/views/about/about.tsx b/src/views/about/about.tsx index df001d9c..a33ead23 100644 --- a/src/views/about/about.tsx +++ b/src/views/about/about.tsx @@ -96,7 +96,7 @@ const FAQ = () => { Seedit desktop , which automatically runs a full node and lets you create communities with the ease of a reddit-like graphical user interface. You can also open a remote - connection to an RPC node to create communities even on web and on mobile devices. In the near + connection to an RPC node to create communities even on web and on mobile devices. In the near future, we plan to include a public RPC connection turned on by default, so you can create communities on any device without running your own node.


diff --git a/src/views/settings/plebbit-options/plebbit-options.tsx b/src/views/settings/plebbit-options/plebbit-options.tsx index d02eb7e2..1b1e68b4 100644 --- a/src/views/settings/plebbit-options/plebbit-options.tsx +++ b/src/views/settings/plebbit-options/plebbit-options.tsx @@ -13,7 +13,7 @@ interface SettingsProps { maticRpcRef?: RefObject; avaxRpcRef?: RefObject; plebbitRpcRef?: RefObject; - nodeDataPathRef?: RefObject; + plebbitDataPathRef?: RefObject; } const IPFSGatewaysSettings = ({ ipfsGatewayUrlsRef, mediaIpfsGatewayUrlRef }: SettingsProps) => { @@ -129,16 +129,16 @@ const PlebbitRPCSettings = ({ plebbitRpcRef }: SettingsProps) => { ); }; -const NodeDataPathSettings = ({ nodeDataPathRef }: SettingsProps) => { +const PlebbitDataPathSettings = ({ plebbitDataPathRef }: SettingsProps) => { const plebbitRpc = usePlebbitRpcSettings(); const { plebbitRpcSettings } = plebbitRpc || {}; const isConnectedToRpc = plebbitRpc?.state === 'succeeded'; const path = plebbitRpcSettings?.plebbitOptions?.dataPath || ''; return ( -
+
- +
); @@ -158,7 +158,7 @@ const PlebbitOptions = () => { const maticRpcRef = useRef(null); const avaxRpcRef = useRef(null); const plebbitRpcRef = useRef(null); - const nodeDataPathRef = useRef(null); + const plebbitDataPathRef = useRef(null); const handleSave = async () => { const ipfsGatewayUrls = ipfsGatewayUrlsRef.current?.value.split('\n').map((url) => url.trim()); @@ -169,7 +169,7 @@ const PlebbitOptions = () => { const maticRpcUrls = maticRpcRef.current?.value.split('\n').map((url) => url.trim()); const avaxRpcUrls = avaxRpcRef.current?.value.split('\n').map((url) => url.trim()); const plebbitRpcClientsOptions = plebbitRpcRef.current?.value.trim(); - const dataPath = nodeDataPathRef.current?.value.trim(); + const dataPath = plebbitDataPathRef.current?.value.trim(); const chainProviders = { eth: { @@ -234,16 +234,16 @@ const PlebbitOptions = () => {
-
- node rpc +
+ plebbit rpc
- node data path + plebbit data path - +
-
- plebbit data path - - - -
+ {isElectron && ( +
+ plebbit data path + + + +
+ )} From 221dab8e83f75290e2073a0775350568649b9dd5 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 2 Dec 2024 17:01:31 +0100 Subject: [PATCH 11/14] fix(reply form): only show offline info message if the user clicks on textarea making it appear by itself was distracting and it would displace the UI while the user is reading the replies --- src/components/reply-form/reply-form.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/reply-form/reply-form.tsx b/src/components/reply-form/reply-form.tsx index cf22ba19..45b6ae79 100644 --- a/src/components/reply-form/reply-form.tsx +++ b/src/components/reply-form/reply-form.tsx @@ -87,6 +87,7 @@ const ReplyForm = ({ cid, isReplyingToReply, hideReplyForm, subplebbitAddress, p const { t } = useTranslation(); const [showOptions, setShowOptions] = useState(false); const [showFormattingHelp, setShowFormattingHelp] = useState(false); + const [isTextareaFocused, setIsTextareaFocused] = useState(false); const { setContent, resetContent, replyIndex, publishReply } = usePublishReply({ cid, subplebbitAddress, postCid }); const mdContainerClass = isReplyingToReply ? `${styles.mdContainer} ${styles.mdContainerReplying}` : styles.mdContainer; @@ -149,7 +150,7 @@ const ReplyForm = ({ cid, isReplyingToReply, hideReplyForm, subplebbitAddress, p return (
- {isOffline &&
{offlineTitle}
} + {isOffline && isTextareaFocused &&
{offlineTitle}
}
{t('media_url')}: setContent.link(e.target.value)} /> @@ -160,7 +161,13 @@ const ReplyForm = ({ cid, isReplyingToReply, hideReplyForm, subplebbitAddress, p
-