From 497b8d6d34dba0f96952e0687c9c1c4b80bcfe4b Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Sat, 6 Jan 2024 10:58:26 +0100 Subject: [PATCH 01/11] fix(index.html): disable auto zoom on safari mobile --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 38309a4a..20221a71 100644 --- a/public/index.html +++ b/public/index.html @@ -3,7 +3,7 @@ - + Date: Sat, 6 Jan 2024 17:28:12 +0100 Subject: [PATCH 02/11] feat(electron): improve navigation labels --- electron/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/electron/main.js b/electron/main.js index 14832ca5..6f13cd65 100644 --- a/electron/main.js +++ b/electron/main.js @@ -261,12 +261,12 @@ const createMainWindow = () => { } const appMenuBack = new MenuItem({ - label: '←', + label: 'Previous', enabled: mainWindow?.webContents?.canGoBack(), click: () => mainWindow?.webContents?.goBack(), }); const appMenuForward = new MenuItem({ - label: '→', + label: 'Next', enabled: mainWindow?.webContents?.canGoForward(), click: () => mainWindow?.webContents?.goForward(), }); From 3c1da1cfee6328054f5aff3d2ee34e3a46f3bde6 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Mon, 8 Jan 2024 11:01:55 +0100 Subject: [PATCH 03/11] feat(mod menu): show mod menu for single replies, put it last in tools for quicker access --- .../post/comment-tools/comment-tools.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/post/comment-tools/comment-tools.tsx b/src/components/post/comment-tools/comment-tools.tsx index f468c855..1e9e2f2a 100644 --- a/src/components/post/comment-tools/comment-tools.tsx +++ b/src/components/post/comment-tools/comment-tools.tsx @@ -39,6 +39,9 @@ const PostTools = ({ author, cid, hasLabel, index, isMod, subplebbitAddress, rep {t('save')} +
  • + {t('crosspost')} +
  • {isMod ? ( ) : ( @@ -46,9 +49,6 @@ const PostTools = ({ author, cid, hasLabel, index, isMod, subplebbitAddress, rep {t('report')} )} -
  • - {t('crosspost')} -
  • ); }; @@ -66,6 +66,9 @@ const ReplyTools = ({ author, cid, hasLabel, index, isMod, showReplyForm, subple {t('save')} +
  • + cid && showReplyForm?.()}>{t('reply_reply')} +
  • {isMod ? ( ) : ( @@ -73,9 +76,6 @@ const ReplyTools = ({ author, cid, hasLabel, index, isMod, showReplyForm, subple {t('report')} )} -
  • - cid && showReplyForm?.()}>{t('reply_reply')} -
  • ); }; @@ -104,6 +104,13 @@ const SingleReplyTools = ({ author, cid, hasLabel, index, isMod, parentCid, show
  • cid && showReplyForm?.()}>{t('reply_reply')}
  • + {isMod ? ( + + ) : ( +
  • + {t('report')} +
  • + )} ); }; From 0bcd1c9450c125dfe1be05fc233304389ecf91f4 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Mon, 8 Jan 2024 11:02:45 +0100 Subject: [PATCH 04/11] chore(mod menu): rename mod tools to mod menu --- .../post/comment-tools/comment-tools.tsx | 8 +++---- .../post/comment-tools/mod-menu/mod-menu.tsx | 22 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/post/comment-tools/comment-tools.tsx b/src/components/post/comment-tools/comment-tools.tsx index 1e9e2f2a..71165c5f 100644 --- a/src/components/post/comment-tools/comment-tools.tsx +++ b/src/components/post/comment-tools/comment-tools.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'; import { Author, useAccount, useComment, useSubplebbit } from '@plebbit/plebbit-react-hooks'; import styles from './comment-tools.module.css'; import HideMenu from './hide-menu'; -import ModTools from './mod-menu'; +import ModMenu from './mod-menu'; import ShareMenu from './share-menu'; import { FailedLabel, PendingLabel, SpoilerLabel } from '../label'; import { isInboxView } from '../../../lib/utils/view-utils'; @@ -43,7 +43,7 @@ const PostTools = ({ author, cid, hasLabel, index, isMod, subplebbitAddress, rep {t('crosspost')} {isMod ? ( - + ) : (
  • {t('report')} @@ -70,7 +70,7 @@ const ReplyTools = ({ author, cid, hasLabel, index, isMod, showReplyForm, subple cid && showReplyForm?.()}>{t('reply_reply')}
  • {isMod ? ( - + ) : (
  • {t('report')} @@ -105,7 +105,7 @@ const SingleReplyTools = ({ author, cid, hasLabel, index, isMod, parentCid, show cid && showReplyForm?.()}>{t('reply_reply')}
  • {isMod ? ( - + ) : (
  • {t('report')} diff --git a/src/components/post/comment-tools/mod-menu/mod-menu.tsx b/src/components/post/comment-tools/mod-menu/mod-menu.tsx index 443dcb5e..e95b579b 100644 --- a/src/components/post/comment-tools/mod-menu/mod-menu.tsx +++ b/src/components/post/comment-tools/mod-menu/mod-menu.tsx @@ -8,15 +8,15 @@ import challengesStore from '../../../../hooks/use-challenges'; const { addChallenge } = challengesStore.getState(); -type ModToolsProps = { +type ModMenuProps = { cid: string; }; -const ModTools = ({ cid }: ModToolsProps) => { +const ModMenu = ({ cid }: ModMenuProps) => { const { t } = useTranslation(); const post = useComment({ commentCid: cid }); const isReply = post?.parentCid; - const [isModToolsOpen, setIsModToolsOpen] = useState(false); + const [isModMenuOpen, setIsModMenuOpen] = useState(false); const defaultPublishOptions: PublishCommentEditOptions = { removed: post?.removed, @@ -39,9 +39,9 @@ const ModTools = ({ cid }: ModToolsProps) => { // close the modal after publishing useEffect(() => { if (state && state !== 'failed' && state !== 'initializing' && state !== 'ready') { - setIsModToolsOpen(false); + setIsModMenuOpen(false); } - }, [state, setIsModToolsOpen]); + }, [state, setIsModMenuOpen]); const onCheckbox = (e: React.ChangeEvent) => setPublishCommentEditOptions((state) => ({ ...state, [e.target.id]: e.target.checked })); @@ -50,8 +50,8 @@ const ModTools = ({ cid }: ModToolsProps) => { const { refs, floatingStyles, context } = useFloating({ placement: 'bottom-start', - open: isModToolsOpen, - onOpenChange: setIsModToolsOpen, + open: isModMenuOpen, + onOpenChange: setIsModMenuOpen, middleware: [offset(2), flip({ fallbackAxisSideDirection: 'end' }), shift()], whileElementsMounted: autoUpdate, }); @@ -67,12 +67,12 @@ const ModTools = ({ cid }: ModToolsProps) => { return ( <>
  • - setIsModToolsOpen(!isModToolsOpen)}>{t('moderation')} + setIsModMenuOpen(!isModMenuOpen)}>{t('moderation')}
  • - {isModToolsOpen && ( + {isModMenuOpen && (
    -
    +