From 3bc672cbaa69bf75d8e6ceb6e377cab44391d63b Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Fri, 30 Aug 2024 21:09:32 +0200 Subject: [PATCH 01/20] Update use-anon-mode-store.ts --- src/stores/use-anon-mode-store.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/stores/use-anon-mode-store.ts b/src/stores/use-anon-mode-store.ts index d20ea97a..2d35667c 100644 --- a/src/stores/use-anon-mode-store.ts +++ b/src/stores/use-anon-mode-store.ts @@ -66,6 +66,4 @@ const initializeAnonModeStore = async () => { initializeAnonModeStore(); -initializeAnonModeStore(); - export default useAnonModeStore; From 51e3ef8506bb8288281995a2d9f2e0abed1f34a1 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Fri, 30 Aug 2024 21:18:39 +0200 Subject: [PATCH 02/20] display anon mode address immediately upon publishing --- src/components/post-desktop/post-desktop.tsx | 8 ++++++- src/components/post-mobile/post-mobile.tsx | 9 ++++++-- src/components/reply-modal/reply-modal.tsx | 23 +++++++++++++------- src/hooks/use-anon-mode.ts | 11 ++++++++-- src/stores/use-anon-mode-store.ts | 10 +++++++++ 5 files changed, 48 insertions(+), 13 deletions(-) diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index 972d2e41..11ac1e86 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -9,6 +9,8 @@ import { hashStringToColor, getTextColorForBackground } from '../../lib/utils/po import { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-utils'; import { isValidURL } from '../../lib/utils/url-utils'; import { isAllView, isPendingPostView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils'; +import useAnonModeStore from '../../stores/use-anon-mode-store'; +import useAnonMode from '../../hooks/use-anon-mode'; import useAuthorAddressClick from '../../hooks/use-author-address-click'; import useEditCommentPrivileges from '../../hooks/use-author-privileges'; import useCountLinksInReplies from '../../hooks/use-count-links-in-replies'; @@ -64,8 +66,12 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }: const isInPostPageView = isPostPageView(location.pathname, params); const isInSubscriptionsView = isSubscriptionsView(location.pathname, params); + // comment.author.shortAddress is undefined while the comment publishing state is pending, use account instead + // in anon mode, use the newly generated signer.address instead, which will be comment.author.address + const { anonMode } = useAnonMode(); + const { currentAnonSignerAddress } = useAnonModeStore(); const account = useAccount(); - const accountShortAddress = account?.author?.shortAddress; // if reply by account is pending, it doesn't have an author yet + const accountShortAddress = anonMode ? currentAnonSignerAddress && Plebbit.getShortAddress(currentAnonSignerAddress) : account?.author?.shortAddress; const { isCommentAuthorMod, isAccountMod, isAccountCommentAuthor } = useEditCommentPrivileges({ commentAuthorAddress: address, subplebbitAddress }); diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index 3d6bfcf6..430dbe00 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -8,6 +8,8 @@ import { getCommentMediaInfo, getHasThumbnail } from '../../lib/utils/media-util import { getTextColorForBackground, hashStringToColor } from '../../lib/utils/post-utils'; import { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-utils'; import { isAllView, isPendingPostView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils'; +import useAnonModeStore from '../../stores/use-anon-mode-store'; +import useAnonMode from '../../hooks/use-anon-mode'; import useAuthorAddressClick from '../../hooks/use-author-address-click'; import useCountLinksInReplies from '../../hooks/use-count-links-in-replies'; import useHide from '../../hooks/use-hide'; @@ -44,9 +46,12 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P const isReply = parentCid; - // pending reply by account is not yet published + // comment.author.shortAddress is undefined while the comment publishing state is pending, use account instead + // in anon mode, use the newly generated signer.address instead, which will be comment.author.address + const { anonMode } = useAnonMode(); + const { currentAnonSignerAddress } = useAnonModeStore(); const account = useAccount(); - const accountShortAddress = account?.author?.shortAddress; + const accountShortAddress = anonMode ? currentAnonSignerAddress && Plebbit.getShortAddress(currentAnonSignerAddress) : account?.author?.shortAddress; const stateString = useStateString(post); diff --git a/src/components/reply-modal/reply-modal.tsx b/src/components/reply-modal/reply-modal.tsx index 1bae61b3..f053f365 100644 --- a/src/components/reply-modal/reply-modal.tsx +++ b/src/components/reply-modal/reply-modal.tsx @@ -15,6 +15,7 @@ import styles from './reply-modal.module.css'; import { LinkTypePreviewer } from '../post-form'; import _ from 'lodash'; import useAnonMode from '../../hooks/use-anon-mode'; +import useAnonModeStore from '../../stores/use-anon-mode-store'; interface ReplyModalProps { closeModal: () => void; @@ -40,6 +41,8 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s const address = comment?.author?.address; const hasCalledAnonAddressRef = useRef(false); + const { setCurrentAnonSignerAddress } = useAnonModeStore(); + const getAnonAddressForReply = useCallback(async () => { if (anonMode && !hasCalledAnonAddressRef.current) { hasCalledAnonAddressRef.current = true; @@ -52,18 +55,22 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s displayName: displayName || undefined, }, }); + setCurrentAnonSignerAddress(existingSigner.address); } else { const newSigner = await getNewSigner(); - setPublishReplyOptions({ - signer: newSigner, - author: { - address: newSigner.address, - displayName: displayName || undefined, - }, - }); + if (newSigner) { + setPublishReplyOptions({ + signer: newSigner, + author: { + address: newSigner.address, + displayName: displayName || undefined, + }, + }); + setCurrentAnonSignerAddress(newSigner.address); + } } } - }, [address, getExistingSigner, getNewSigner, setPublishReplyOptions, anonMode, displayName]); + }, [address, getExistingSigner, getNewSigner, setPublishReplyOptions, anonMode, displayName, setCurrentAnonSignerAddress]); const onPublishReply = () => { const currentContent = textRef.current?.value.slice(contentPrefix.length).trim() || ''; diff --git a/src/hooks/use-anon-mode.ts b/src/hooks/use-anon-mode.ts index e932ded5..22f0bc65 100644 --- a/src/hooks/use-anon-mode.ts +++ b/src/hooks/use-anon-mode.ts @@ -2,12 +2,13 @@ import { useAccount } from '@plebbit/plebbit-react-hooks'; import useAnonModeStore from '../stores/use-anon-mode-store'; const useAnonMode = (postCid?: string) => { - const { anonMode, threadSigners, setThreadSigner, setAddressSigner, getAddressSigner } = useAnonModeStore((state) => ({ + const { anonMode, threadSigners, setThreadSigner, setAddressSigner, getAddressSigner, setCurrentAnonSignerAddress } = useAnonModeStore((state) => ({ anonMode: state.anonMode, threadSigners: state.threadSigners, setThreadSigner: state.setThreadSigner, setAddressSigner: state.setAddressSigner, getAddressSigner: state.getAddressSigner, + setCurrentAnonSignerAddress: state.setCurrentAnonSignerAddress, })); const threadSigner = postCid ? threadSigners[postCid] : undefined; @@ -25,6 +26,7 @@ const useAnonMode = (postCid?: string) => { } else { setAddressSigner(signer); } + setCurrentAnonSignerAddress(signer.address); } return signer; } catch (error) { @@ -33,6 +35,7 @@ const useAnonMode = (postCid?: string) => { } else { try { const signer = await account?.plebbit.createSigner({ type: 'ed25519', privateKey: threadSigner?.privateKey }); + setCurrentAnonSignerAddress(signer.address); return signer; } catch (error) { console.error('Failed to retrieve anonymous signer:', error); @@ -43,7 +46,11 @@ const useAnonMode = (postCid?: string) => { }; const getExistingSigner = (address: string) => { - return getAddressSigner(address); + const signer = getAddressSigner(address); + if (signer) { + setCurrentAnonSignerAddress(signer.address); + } + return signer; }; return { anonMode, getNewSigner, getExistingSigner }; diff --git a/src/stores/use-anon-mode-store.ts b/src/stores/use-anon-mode-store.ts index 2d35667c..e9448766 100644 --- a/src/stores/use-anon-mode-store.ts +++ b/src/stores/use-anon-mode-store.ts @@ -10,6 +10,8 @@ interface AnonModeState { getThreadSigner: (postCid: string) => any | undefined; setAddressSigner: (signer: any) => void; getAddressSigner: (address: string) => any | undefined; + currentAnonSignerAddress: string | null; + setCurrentAnonSignerAddress: (address: string | null) => void; } const anonModeStore = localForageLru.createInstance({ @@ -39,6 +41,11 @@ const useAnonModeStore = create((set, get) => ({ anonModeStore.setItem(signer.address, signer); }, getAddressSigner: (address: string) => get().addressSigners[address], + currentAnonSignerAddress: null, + setCurrentAnonSignerAddress: (address: string | null) => { + set({ currentAnonSignerAddress: address }); + anonModeStore.setItem('currentAnonSignerAddress', address); + }, })); const initializeAnonModeStore = async () => { @@ -57,10 +64,13 @@ const initializeAnonModeStore = async () => { } }); + const currentAnonSignerAddress = await anonModeStore.getItem('currentAnonSignerAddress'); + useAnonModeStore.setState((state) => ({ anonMode, // Set the retrieved anonMode state threadSigners: { ...threadSigners, ...state.threadSigners }, addressSigners: { ...addressSigners, ...state.addressSigners }, + currentAnonSignerAddress: currentAnonSignerAddress || null, })); }; From d92ce2027384438461d1a512fa47e34599735fee Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Fri, 30 Aug 2024 21:29:45 +0200 Subject: [PATCH 03/20] update translations --- public/translations/ar/default.json | 2 +- public/translations/bn/default.json | 2 +- public/translations/cs/default.json | 2 +- public/translations/da/default.json | 2 +- public/translations/de/default.json | 2 +- public/translations/el/default.json | 2 +- public/translations/en/default.json | 2 +- public/translations/es/default.json | 2 +- public/translations/fa/default.json | 2 +- public/translations/fi/default.json | 2 +- public/translations/fil/default.json | 2 +- public/translations/fr/default.json | 2 +- public/translations/he/default.json | 2 +- public/translations/hi/default.json | 2 +- public/translations/hu/default.json | 2 +- public/translations/id/default.json | 2 +- public/translations/it/default.json | 2 +- public/translations/ja/default.json | 2 +- public/translations/ko/default.json | 2 +- public/translations/mr/default.json | 2 +- public/translations/nl/default.json | 2 +- public/translations/no/default.json | 2 +- public/translations/pl/default.json | 2 +- public/translations/pt/default.json | 2 +- public/translations/ro/default.json | 2 +- public/translations/ru/default.json | 2 +- public/translations/sq/default.json | 2 +- public/translations/sv/default.json | 2 +- public/translations/te/default.json | 2 +- public/translations/th/default.json | 2 +- public/translations/tr/default.json | 2 +- public/translations/uk/default.json | 2 +- public/translations/ur/default.json | 2 +- public/translations/vi/default.json | 2 +- public/translations/zh/default.json | 2 +- src/components/post-desktop/post-desktop.tsx | 4 ++-- src/components/post-mobile/post-mobile.tsx | 8 ++++---- .../crypto-address-setting/crypto-address-setting.tsx | 4 ++-- 38 files changed, 43 insertions(+), 43 deletions(-) diff --git a/public/translations/ar/default.json b/public/translations/ar/default.json index 8e02e0d3..5e596692 100644 --- a/public/translations/ar/default.json +++ b/public/translations/ar/default.json @@ -204,7 +204,7 @@ "by": "بواسطة", "last_reply_by": "آخر رد بواسطة", "showing_all_replies": "عرض جميع الردود.", - "highlight_posts": "تسليط الضوء على المشاركات من خلال هذا العنوان للمستخدم", + "highlight_posts": "تمييز المشاركات بواسطة هذا المعرف", "display_name_too_long": "اسم العرض طويل جداً", "title_too_long": "العنوان طويل جداً", "1_post_by_this_id": "مشاركة واحدة بهذا المعرف", diff --git a/public/translations/bn/default.json b/public/translations/bn/default.json index 56091f53..6b4dd35b 100644 --- a/public/translations/bn/default.json +++ b/public/translations/bn/default.json @@ -204,7 +204,7 @@ "by": "দ্বারা", "last_reply_by": "শেষ উত্তর দেননি", "showing_all_replies": "সব উত্তর দেখাচ্ছি।", - "highlight_posts": "এই ব্যবহারকারী ঠিকানা দ্বারা পোস্টগুলি হাইলাইট করুন", + "highlight_posts": "এই আইডি দ্বারা পোস্ট হাইলাইট করুন", "display_name_too_long": "প্রদর্শনী নাম অত্যন্ত দীর্ঘ", "title_too_long": "শিরোনাম অত্যন্ত দীর্ঘ", "1_post_by_this_id": "এই আইডি দ্বারা 1 পোস্ট", diff --git a/public/translations/cs/default.json b/public/translations/cs/default.json index c48bfafd..b1188596 100644 --- a/public/translations/cs/default.json +++ b/public/translations/cs/default.json @@ -204,7 +204,7 @@ "by": "od", "last_reply_by": "Poslední odpověď od", "showing_all_replies": "Zobrazuji všechny odpovědi.", - "highlight_posts": "Zvýraznit příspěvky z této uživatelské adresy", + "highlight_posts": "Zdůraznit příspěvky podle tohoto ID", "display_name_too_long": "Zobrazované jméno je příliš dlouhé", "title_too_long": "Název je příliš dlouhý", "1_post_by_this_id": "1 příspěvek s tímto ID", diff --git a/public/translations/da/default.json b/public/translations/da/default.json index 8fde6055..3cacc31f 100644 --- a/public/translations/da/default.json +++ b/public/translations/da/default.json @@ -204,7 +204,7 @@ "by": "af", "last_reply_by": "Seneste svar fra", "showing_all_replies": "Viser alle svar.", - "highlight_posts": "Fremhæv indlæg fra denne brugeradresse", + "highlight_posts": "Fremhæv indlæg fra denne ID", "display_name_too_long": "Visningsnavn for langt", "title_too_long": "Titel for lang", "1_post_by_this_id": "1 post med dette ID", diff --git a/public/translations/de/default.json b/public/translations/de/default.json index 4bdcc568..8b4478e9 100644 --- a/public/translations/de/default.json +++ b/public/translations/de/default.json @@ -204,7 +204,7 @@ "by": "von", "last_reply_by": "Letzte Antwort von", "showing_all_replies": "Zeige alle Antworten.", - "highlight_posts": "Beiträge von dieser Benutzeradresse hervorheben", + "highlight_posts": "Beiträge nach dieser ID hervorheben", "display_name_too_long": "Angezeigter Name zu lang", "title_too_long": "Titel zu lang", "1_post_by_this_id": "1 Beitrag mit dieser ID", diff --git a/public/translations/el/default.json b/public/translations/el/default.json index 1520c657..021f085a 100644 --- a/public/translations/el/default.json +++ b/public/translations/el/default.json @@ -204,7 +204,7 @@ "by": "από", "last_reply_by": "Τελευταία απάντηση από", "showing_all_replies": "Εμφανίζονται όλες οι απαντήσεις.", - "highlight_posts": "Επισήμανση δημοσιεύσεων από αυτήν τη διεύθυνση χρήστη", + "highlight_posts": "Επισήμανση αναρτήσεων με αυτήν την ταυτότητα", "display_name_too_long": "Το όνομα εμφάνισης είναι πολύ μεγάλο", "title_too_long": "Το τίτλος είναι πολύ μεγάλος", "1_post_by_this_id": "1 ανάρτηση με αυτό το ID", diff --git a/public/translations/en/default.json b/public/translations/en/default.json index b9e799da..e60cecc7 100644 --- a/public/translations/en/default.json +++ b/public/translations/en/default.json @@ -204,7 +204,7 @@ "by": "by", "last_reply_by": "Last reply by", "showing_all_replies": "Showing all replies.", - "highlight_posts": "Highlight posts by this user address", + "highlight_posts": "Highlight posts by this ID", "display_name_too_long": "display name too long", "title_too_long": "title too long", "1_post_by_this_id": "1 post by this ID", diff --git a/public/translations/es/default.json b/public/translations/es/default.json index 0b1dfbb5..5c4191ad 100644 --- a/public/translations/es/default.json +++ b/public/translations/es/default.json @@ -204,7 +204,7 @@ "by": "por", "last_reply_by": "Última respuesta de", "showing_all_replies": "Mostrando todas las respuestas.", - "highlight_posts": "Resaltar publicaciones de esta dirección de usuario", + "highlight_posts": "Resaltar publicaciones por este ID", "display_name_too_long": "nombre de visualización demasiado largo", "title_too_long": "título demasiado largo", "1_post_by_this_id": "1 publicación con este ID", diff --git a/public/translations/fa/default.json b/public/translations/fa/default.json index 062f8ec5..2c9e09a3 100644 --- a/public/translations/fa/default.json +++ b/public/translations/fa/default.json @@ -204,7 +204,7 @@ "by": "توسط", "last_reply_by": "آخرین پاسخ توسط", "showing_all_replies": "نمایش تمام پاسخ‌ها.", - "highlight_posts": "برجسته سازی پست ها از این آدرس کاربر", + "highlight_posts": "برجسته کردن پست‌ها با این شناسه", "display_name_too_long": "نام نمایشی خیلی طولانی است", "title_too_long": "عنوان خیلی طولانی است", "1_post_by_this_id": "1 پست با این شناسه", diff --git a/public/translations/fi/default.json b/public/translations/fi/default.json index d2c93a5f..47b2be89 100644 --- a/public/translations/fi/default.json +++ b/public/translations/fi/default.json @@ -204,7 +204,7 @@ "by": "kirjoittanut", "last_reply_by": "Viimeisin vastaus", "showing_all_replies": "Näytetään kaikki vastaukset.", - "highlight_posts": "Korosta tämän käyttäjän osoitteen viestit", + "highlight_posts": "Korosta postauksia tällä ID:llä", "display_name_too_long": "Näyttönimi liian pitkä", "title_too_long": "Otsikko on liian pitkä", "1_post_by_this_id": "1 viesti tällä tunnuksella", diff --git a/public/translations/fil/default.json b/public/translations/fil/default.json index 2e7cf0ab..55fc9cb4 100644 --- a/public/translations/fil/default.json +++ b/public/translations/fil/default.json @@ -204,7 +204,7 @@ "by": "ni", "last_reply_by": "Huling sagot ni", "showing_all_replies": "Nagpapakita ng lahat ng mga sagot.", - "highlight_posts": "I-highlight ang mga post mula sa user address na ito", + "highlight_posts": "I-highlight ang mga post gamit ang ID na ito", "display_name_too_long": "ang display name ay masyadong mahaba", "title_too_long": "ang pamagat ay masyadong mahaba", "1_post_by_this_id": "1 post sa pamamagitan ng ID na ito", diff --git a/public/translations/fr/default.json b/public/translations/fr/default.json index 7c834e7c..b8d46d09 100644 --- a/public/translations/fr/default.json +++ b/public/translations/fr/default.json @@ -204,7 +204,7 @@ "by": "par", "last_reply_by": "Dernière réponse par", "showing_all_replies": "Affichage de toutes les réponses.", - "highlight_posts": "Mettre en évidence les messages de cette adresse utilisateur", + "highlight_posts": "Mettre en évidence les publications par cet ID", "display_name_too_long": "nom d'affichage trop long", "title_too_long": "titre trop long", "1_post_by_this_id": "1 publication avec cet identifiant", diff --git a/public/translations/he/default.json b/public/translations/he/default.json index 08755782..31e7b6d6 100644 --- a/public/translations/he/default.json +++ b/public/translations/he/default.json @@ -204,7 +204,7 @@ "by": "על ידי", "last_reply_by": "תגובה אחרונה מאת", "showing_all_replies": "מציג את כל התגובות.", - "highlight_posts": "הדגשת הודעות מכתובת המשתמש הזו", + "highlight_posts": "הדגש פוסטים לפי מזהה זה", "display_name_too_long": "שם התצוגה ארוך מדי", "title_too_long": "הכותרת ארוכה מדי", "1_post_by_this_id": "פוסט אחד עם המזהה הזה", diff --git a/public/translations/hi/default.json b/public/translations/hi/default.json index 4a4bb937..064e5628 100644 --- a/public/translations/hi/default.json +++ b/public/translations/hi/default.json @@ -204,7 +204,7 @@ "by": "द्वारा", "last_reply_by": "अंतिम उत्तर दिया गया है", "showing_all_replies": "सभी उत्तर दिखा रहा है।", - "highlight_posts": "इस उपयोगकर्ता पते से पोस्ट्स को हाइलाइट करें", + "highlight_posts": "इस ID द्वारा पोस्ट को हाइलाइट करें", "display_name_too_long": "प्रदर्शन नाम बहुत लंबा है", "title_too_long": "शीर्षक बहुत लंबा है", "1_post_by_this_id": "इस आईडी द्वारा 1 पोस्ट", diff --git a/public/translations/hu/default.json b/public/translations/hu/default.json index 2e252e9c..5cb4ee4f 100644 --- a/public/translations/hu/default.json +++ b/public/translations/hu/default.json @@ -204,7 +204,7 @@ "by": "által", "last_reply_by": "Utolsó válasz írta", "showing_all_replies": "Az összes válasz megjelenítése.", - "highlight_posts": "Kiemelt bejegyzések ebből a felhasználói címből", + "highlight_posts": "Kiemelés ezen ID által", "display_name_too_long": "a megjelenített név túl hosszú", "title_too_long": "a cím túl hosszú", "1_post_by_this_id": "1 bejegyzés ezzel az azonosítóval", diff --git a/public/translations/id/default.json b/public/translations/id/default.json index 90d15b7f..0a377ea3 100644 --- a/public/translations/id/default.json +++ b/public/translations/id/default.json @@ -204,7 +204,7 @@ "by": "oleh", "last_reply_by": "Balasan terakhir oleh", "showing_all_replies": "Menampilkan semua balasan.", - "highlight_posts": "Sorot posting dari alamat pengguna ini", + "highlight_posts": "Sorot pos dengan ID ini", "display_name_too_long": "nama tampilan terlalu panjang", "title_too_long": "judul terlalu panjang", "1_post_by_this_id": "1 pos dengan ID ini", diff --git a/public/translations/it/default.json b/public/translations/it/default.json index 86ac5988..d37aef4c 100644 --- a/public/translations/it/default.json +++ b/public/translations/it/default.json @@ -204,7 +204,7 @@ "by": "da", "last_reply_by": "Ultima risposta da", "showing_all_replies": "Mostrando tutte le risposte.", - "highlight_posts": "Evidenziare i post da questo indirizzo di utente", + "highlight_posts": "Evidenzia i post con questo ID", "display_name_too_long": "nome visualizzato troppo lungo", "title_too_long": "titolo troppo lungo", "1_post_by_this_id": "1 post con questo ID", diff --git a/public/translations/ja/default.json b/public/translations/ja/default.json index 66b4eba8..0c2d765f 100644 --- a/public/translations/ja/default.json +++ b/public/translations/ja/default.json @@ -204,7 +204,7 @@ "by": "によって", "last_reply_by": "最後の返信者", "showing_all_replies": "すべての返信を表示しています。", - "highlight_posts": "このユーザーアドレスによる投稿を強調表示する", + "highlight_posts": "このIDによる投稿を強調表示", "display_name_too_long": "表示名が長すぎます", "title_too_long": "タイトルが長すぎます", "1_post_by_this_id": "このIDで1件の投稿", diff --git a/public/translations/ko/default.json b/public/translations/ko/default.json index 21f8dd21..458625c0 100644 --- a/public/translations/ko/default.json +++ b/public/translations/ko/default.json @@ -204,7 +204,7 @@ "by": "작성자:", "last_reply_by": "마지막 답글 작성자:", "showing_all_replies": "모든 답글을 표시합니다.", - "highlight_posts": "이 사용자 주소의 게시물 강조 표시", + "highlight_posts": "이 ID로 게시물 강조 표시", "display_name_too_long": "표시 이름이 너무 깁니다", "title_too_long": "제목이 너무 깁니다", "1_post_by_this_id": "이 ID로 게시된 1개의 글", diff --git a/public/translations/mr/default.json b/public/translations/mr/default.json index c7daec0b..6a72b834 100644 --- a/public/translations/mr/default.json +++ b/public/translations/mr/default.json @@ -204,7 +204,7 @@ "by": "व्यक्ती", "last_reply_by": "शेवटचा प्रतिसाद व्यक्ती", "showing_all_replies": "सर्व प्रतिसाद दाखवत आहे.", - "highlight_posts": "या वापरकर्त्याच्या पत्त्यापासून पोस्ट्स हायलाइट करा", + "highlight_posts": "या ID द्वारे पोस्ट हायलाइट करा", "display_name_too_long": "डिस्प्ले नाम खूप लांब आहे", "title_too_long": "शीर्षक खूप लांब आहे", "1_post_by_this_id": "या ID वर 1 पोस्ट", diff --git a/public/translations/nl/default.json b/public/translations/nl/default.json index 17e8e4dd..a26c02cf 100644 --- a/public/translations/nl/default.json +++ b/public/translations/nl/default.json @@ -204,7 +204,7 @@ "by": "door", "last_reply_by": "Laatste reactie door", "showing_all_replies": "Alle antwoorden weergeven.", - "highlight_posts": "Berichten van dit gebruikersadres markeren", + "highlight_posts": "Markeer berichten op basis van deze ID", "display_name_too_long": "weergavenaam te lang", "title_too_long": "titel te lang", "1_post_by_this_id": "1 bericht met dit ID", diff --git a/public/translations/no/default.json b/public/translations/no/default.json index c4c0da7a..84aa557f 100644 --- a/public/translations/no/default.json +++ b/public/translations/no/default.json @@ -204,7 +204,7 @@ "by": "av", "last_reply_by": "Siste svar fra", "showing_all_replies": "Viser alle svar.", - "highlight_posts": "Fremhev innlegg fra denne brukeradressen", + "highlight_posts": "Uthev innlegg med denne ID-en", "display_name_too_long": "visningsnavn for langt", "title_too_long": "tittel for lang", "1_post_by_this_id": "1 post med denne ID-en", diff --git a/public/translations/pl/default.json b/public/translations/pl/default.json index e08bd44c..fe0e8b02 100644 --- a/public/translations/pl/default.json +++ b/public/translations/pl/default.json @@ -204,7 +204,7 @@ "by": "przez", "last_reply_by": "Ostatnia odpowiedź od", "showing_all_replies": "Wyświetlanie wszystkich odpowiedzi.", - "highlight_posts": "Wyróżnij posty z tego adresu użytkownika", + "highlight_posts": "Wyróżnij posty według tego ID", "display_name_too_long": "nazwa wyświetlana jest zbyt długa", "title_too_long": "tytuł jest zbyt długi", "1_post_by_this_id": "1 post z tym identyfikatorem", diff --git a/public/translations/pt/default.json b/public/translations/pt/default.json index 276a3b67..c0f070ff 100644 --- a/public/translations/pt/default.json +++ b/public/translations/pt/default.json @@ -204,7 +204,7 @@ "by": "por", "last_reply_by": "Última resposta por", "showing_all_replies": "Mostrando todas as respostas.", - "highlight_posts": "Destacar postagens deste endereço de usuário", + "highlight_posts": "Destaque posts por este ID", "display_name_too_long": "nome de exibição muito longo", "title_too_long": "título muito longo", "1_post_by_this_id": "1 post com este ID", diff --git a/public/translations/ro/default.json b/public/translations/ro/default.json index 540fa429..ea0e0406 100644 --- a/public/translations/ro/default.json +++ b/public/translations/ro/default.json @@ -204,7 +204,7 @@ "by": "de către", "last_reply_by": "Ultima răspuns de la", "showing_all_replies": "Afișare toate răspunsurile.", - "highlight_posts": "Evidențiați mesajele de la această adresă de utilizator", + "highlight_posts": "Subliniați postările după acest ID", "display_name_too_long": "numele afișat este prea lung", "title_too_long": "titlul este prea lung", "1_post_by_this_id": "1 post cu acest ID", diff --git a/public/translations/ru/default.json b/public/translations/ru/default.json index 53f19296..46831cc2 100644 --- a/public/translations/ru/default.json +++ b/public/translations/ru/default.json @@ -204,7 +204,7 @@ "by": "от", "last_reply_by": "Последний ответ от", "showing_all_replies": "Показываются все ответы.", - "highlight_posts": "Выделить сообщения с этого адреса пользователя", + "highlight_posts": "Выделить посты по этому ID", "display_name_too_long": "отображаемое имя слишком длинное", "title_too_long": "заголовок слишком длинный", "1_post_by_this_id": "1 сообщение с этим идентификатором", diff --git a/public/translations/sq/default.json b/public/translations/sq/default.json index 0328b275..d34c9df6 100644 --- a/public/translations/sq/default.json +++ b/public/translations/sq/default.json @@ -204,7 +204,7 @@ "by": "nga", "last_reply_by": "Përgjigje e fundit nga", "showing_all_replies": "Duke treguar të gjitha përgjigjet.", - "highlight_posts": "Shëno postime nga ky adresa e përdoruesit", + "highlight_posts": "Dallo postimet sipas këtij ID", "display_name_too_long": "emri i shfaqur është shumë i gjatë", "title_too_long": "titulli shumë i gjatë", "1_post_by_this_id": "1 postim me këtë ID", diff --git a/public/translations/sv/default.json b/public/translations/sv/default.json index f1348820..8bb8271b 100644 --- a/public/translations/sv/default.json +++ b/public/translations/sv/default.json @@ -204,7 +204,7 @@ "by": "av", "last_reply_by": "Senaste svar av", "showing_all_replies": "Visar alla svar.", - "highlight_posts": "Markera inlägg från denna användaradress", + "highlight_posts": "Markera inlägg med detta ID", "display_name_too_long": "visningsnamn för långt", "title_too_long": "titel för långt", "1_post_by_this_id": "1 inlägg med detta ID", diff --git a/public/translations/te/default.json b/public/translations/te/default.json index f0b895a7..8c9a12e6 100644 --- a/public/translations/te/default.json +++ b/public/translations/te/default.json @@ -204,7 +204,7 @@ "by": "ద్వారా", "last_reply_by": "చివరి సమాధానం ఇచ్చింది", "showing_all_replies": "అన్ని సమాధానాలను చూపుతుంది.", - "highlight_posts": "ఈ వాడుకరి చిరునామ నుండి పోస్టులను హైలైట్ చేయండి", + "highlight_posts": "ఈ ID ద్వారా పోస్ట్‌లను హైలైట్ చేయండి", "display_name_too_long": "ప్రదర్శన పేరు చాలా నీటిగా ఉంది", "title_too_long": "శీర్షిక చాలా పొడవుగా ఉంది", "1_post_by_this_id": "ఈ ID ద్వారా 1 పోస్టు", diff --git a/public/translations/th/default.json b/public/translations/th/default.json index 38d35bd0..7089156d 100644 --- a/public/translations/th/default.json +++ b/public/translations/th/default.json @@ -204,7 +204,7 @@ "by": "โดย", "last_reply_by": "การตอบคำถามล่าสุดโดย", "showing_all_replies": "กำลังแสดงคำตอบทั้งหมด", - "highlight_posts": "เน้นโพสต์โดยที่อยู่ผู้ใช้นี้", + "highlight_posts": "เน้นโพสต์โดย ID นี้", "display_name_too_long": "ชื่อที่แสดงนามสกุลยาวเกินไป", "title_too_long": "ชื่อเรื่องยาวเกินไป", "1_post_by_this_id": "1 โพสต์โดย ID นี้", diff --git a/public/translations/tr/default.json b/public/translations/tr/default.json index a3b59b75..6e215a76 100644 --- a/public/translations/tr/default.json +++ b/public/translations/tr/default.json @@ -204,7 +204,7 @@ "by": "tarafından", "last_reply_by": "Son cevap", "showing_all_replies": "Tüm yanıtlar gösteriliyor.", - "highlight_posts": "Bu kullanıcı adresinden gelen gönderileri vurgula", + "highlight_posts": "Bu ID ile gönderileri vurgula", "display_name_too_long": "görünen adı çok uzun", "title_too_long": "başlık çok uzun", "1_post_by_this_id": "Bu ID ile 1 gönderi", diff --git a/public/translations/uk/default.json b/public/translations/uk/default.json index 22fbb8fa..8b32f9af 100644 --- a/public/translations/uk/default.json +++ b/public/translations/uk/default.json @@ -204,7 +204,7 @@ "by": "від", "last_reply_by": "Остання відповідь від", "showing_all_replies": "Показуються всі відповіді.", - "highlight_posts": "Виділити повідомлення з цієї адреси користувача", + "highlight_posts": "Виділити повідомлення за цим ID", "display_name_too_long": "ім'я відображається занадто довге", "title_too_long": "заголовок відображається занадто довгий", "1_post_by_this_id": "1 пост з цим ідентифікатором", diff --git a/public/translations/ur/default.json b/public/translations/ur/default.json index 714dcce0..7415250f 100644 --- a/public/translations/ur/default.json +++ b/public/translations/ur/default.json @@ -204,7 +204,7 @@ "by": "کے ذریعے", "last_reply_by": "آخری جواب دیا گیا", "showing_all_replies": "تمام جوابات دکھا رہا ہے۔", - "highlight_posts": "اس صارف ایڈریس کے ذریعے پوسٹس کو ہائی لائٹ کریں", + "highlight_posts": "اس ID کے ذریعہ پوسٹس کو نمایاں کریں", "display_name_too_long": "ڈسپلے نام بہت لمبا ہے", "title_too_long": "عنوان بہت لمبا ہے", "1_post_by_this_id": "اس آئی ڈی پر 1 پوسٹ", diff --git a/public/translations/vi/default.json b/public/translations/vi/default.json index 52620130..f7ae9b73 100644 --- a/public/translations/vi/default.json +++ b/public/translations/vi/default.json @@ -204,7 +204,7 @@ "by": "bởi", "last_reply_by": "Trả lời cuối cùng bởi", "showing_all_replies": "Đang hiển thị tất cả các phản hồi.", - "highlight_posts": "Đánh dấu bài đăng từ địa chỉ người dùng này", + "highlight_posts": "Nổi bật các bài viết bằng ID này", "display_name_too_long": "tên hiển thị quá dài", "title_too_long": "tiêu đề quá dài", "1_post_by_this_id": "1 bài đăng bởi ID này", diff --git a/public/translations/zh/default.json b/public/translations/zh/default.json index b8a0df0c..50991f4c 100644 --- a/public/translations/zh/default.json +++ b/public/translations/zh/default.json @@ -204,7 +204,7 @@ "by": "由...发布", "last_reply_by": "最后回复者", "showing_all_replies": "显示所有回复。", - "highlight_posts": "突出显示此用户地址的帖子", + "highlight_posts": "高亮显示此 ID 的帖子", "display_name_too_long": "显示名称太长", "title_too_long": "标题太长", "1_post_by_this_id": "此ID的1篇帖子", diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index 11ac1e86..8050c11d 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -71,14 +71,14 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }: const { anonMode } = useAnonMode(); const { currentAnonSignerAddress } = useAnonModeStore(); const account = useAccount(); - const accountShortAddress = anonMode ? currentAnonSignerAddress && Plebbit.getShortAddress(currentAnonSignerAddress) : account?.author?.shortAddress; + const pendingShortAddress = anonMode ? currentAnonSignerAddress && Plebbit.getShortAddress(currentAnonSignerAddress) : account?.author?.shortAddress; const { isCommentAuthorMod, isAccountMod, isAccountCommentAuthor } = useEditCommentPrivileges({ commentAuthorAddress: address, subplebbitAddress }); const handleUserAddressClick = useAuthorAddressClick(); const numberOfPostsByAuthor = document.querySelectorAll(`[data-author-address="${shortAddress}"][data-post-cid="${postCid}"]`).length; - const userID = shortAddress || accountShortAddress; + const userID = shortAddress || pendingShortAddress; const userIDBackgroundColor = hashStringToColor(userID); const userIDTextColor = getTextColorForBackground(userIDBackgroundColor); diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index 430dbe00..d89ebc68 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -51,14 +51,14 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P const { anonMode } = useAnonMode(); const { currentAnonSignerAddress } = useAnonModeStore(); const account = useAccount(); - const accountShortAddress = anonMode ? currentAnonSignerAddress && Plebbit.getShortAddress(currentAnonSignerAddress) : account?.author?.shortAddress; + const pendingShortAddress = anonMode ? currentAnonSignerAddress && Plebbit.getShortAddress(currentAnonSignerAddress) : account?.author?.shortAddress; const stateString = useStateString(post); const handleUserAddressClick = useAuthorAddressClick(); const numberOfPostsByAuthor = document.querySelectorAll(`[data-author-address="${shortAddress}"][data-post-cid="${postCid}"]`).length; - const userIDBackgroundColor = hashStringToColor(shortAddress || accountShortAddress); + const userIDBackgroundColor = hashStringToColor(shortAddress || pendingShortAddress); const userIDTextColor = getTextColorForBackground(userIDBackgroundColor); return ( @@ -105,10 +105,10 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P handleUserAddressClick(shortAddress || accountShortAddress, postCid)} + onClick={() => handleUserAddressClick(shortAddress || pendingShortAddress, postCid)} style={{ backgroundColor: userIDBackgroundColor, color: userIDTextColor }} > - {shortAddress || accountShortAddress} + {shortAddress || pendingShortAddress} } content={`${numberOfPostsByAuthor === 1 ? t('1_post_by_this_id') : t('x_posts_by_this_id', { number: numberOfPostsByAuthor })}`} diff --git a/src/components/settings-modal/crypto-address-setting/crypto-address-setting.tsx b/src/components/settings-modal/crypto-address-setting/crypto-address-setting.tsx index c50019f2..a41e6e5c 100644 --- a/src/components/settings-modal/crypto-address-setting/crypto-address-setting.tsx +++ b/src/components/settings-modal/crypto-address-setting/crypto-address-setting.tsx @@ -117,7 +117,7 @@ const CryptoAddressSetting = () => { {showCryptoAddressInfo && (
- steps to set a .eth user address: + steps to set a .eth address as your ID:
  1. @@ -130,7 +130,7 @@ const CryptoAddressSetting = () => {
  2. once you own the address, go to its page, click on "records", then "edit records"
  3. add a new text record with name "plebbit-author-address" and value: {account?.signer?.address}
- steps to set a .sol user address: + steps to set a .sol address as your ID:
  1. From defd56f5f8379a100e475faa9b7b6a06ce535303 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Fri, 30 Aug 2024 22:44:49 +0200 Subject: [PATCH 04/20] hide create and vote buttons, they are low priority --- src/components/topbar/topbar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/topbar/topbar.tsx b/src/components/topbar/topbar.tsx index f13a99f5..27942ec6 100644 --- a/src/components/topbar/topbar.tsx +++ b/src/components/topbar/topbar.tsx @@ -85,7 +85,8 @@ const TopBarDesktop = () => { {renderSubplebbits(projectsSubs)} {renderSubplebbits(interestsSubs)} {renderSubplebbits(randomSubs)} - {renderSubplebbits(internationalSubs)}[ + {renderSubplebbits(internationalSubs)} + {/* [ { @@ -105,7 +106,7 @@ const TopBarDesktop = () => { > Vote - ] + ] */} [{t('settings')}] [ From 2ccec85e5618922adbf752463571106e605d0f2e Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Fri, 30 Aug 2024 22:48:17 +0200 Subject: [PATCH 05/20] enable reply link and post menu for description and rules posts --- src/components/post-desktop/post-desktop.tsx | 2 +- .../post-desktop/post-menu-desktop/post-menu-desktop.tsx | 4 ++-- .../post-mobile/post-menu-mobile/post-menu-mobile.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index 8050c11d..395dfc81 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -190,7 +190,7 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }: [ !cid && e.preventDefault()} + onClick={(e) => !cid && !isDescription && !isRules && e.preventDefault()} > {_.capitalize(t('reply'))} diff --git a/src/components/post-desktop/post-menu-desktop/post-menu-desktop.tsx b/src/components/post-desktop/post-menu-desktop/post-menu-desktop.tsx index 6e53427f..aef8c46d 100644 --- a/src/components/post-desktop/post-menu-desktop/post-menu-desktop.tsx +++ b/src/components/post-desktop/post-menu-desktop/post-menu-desktop.tsx @@ -180,13 +180,13 @@ const PostMenuDesktop = ({ post }: { post: Comment }) => { className={isInCatalogView ? styles.postMenuBtnCatalog : styles.postMenuBtn} title='Post menu' onClick={handleMenuClick} - style={{ transform: menuBtnRotated && cid ? 'rotate(90deg)' : 'rotate(0deg)' }} + style={{ transform: menuBtnRotated && (cid || isDescription || isRules) ? 'rotate(90deg)' : 'rotate(0deg)' }} > ▶ {menuBtnRotated && - cid && + (cid || isDescription || isRules) && createPortal(
    diff --git a/src/components/post-mobile/post-menu-mobile/post-menu-mobile.tsx b/src/components/post-mobile/post-menu-mobile/post-menu-mobile.tsx index 9764cbb8..6d7a5193 100644 --- a/src/components/post-mobile/post-menu-mobile/post-menu-mobile.tsx +++ b/src/components/post-mobile/post-menu-mobile/post-menu-mobile.tsx @@ -164,7 +164,7 @@ const PostMenuMobile = ({ post }: { post: Comment }) => { ... {isMenuOpen && - cid && + (cid || isDescription || isRules) && createPortal(
    From 09a14416c8bcbd722ebeb3bbc0b158bf12c1190b Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sat, 31 Aug 2024 14:22:02 +0200 Subject: [PATCH 06/20] feat(post): show embed of link in post content even if it doesn't have a thumbnail --- src/components/markdown/markdown.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/markdown/markdown.tsx b/src/components/markdown/markdown.tsx index d355a130..8ba27587 100644 --- a/src/components/markdown/markdown.tsx +++ b/src/components/markdown/markdown.tsx @@ -11,6 +11,7 @@ import useIsMobile from '../../hooks/use-is-mobile'; import CommentMedia from '../comment-media'; import styles from './markdown.module.css'; import { useLocation, useParams } from 'react-router-dom'; +import { canEmbed } from '../embed'; interface ContentLinkEmbedProps { children: any; @@ -86,13 +87,15 @@ const ContentLinkEmbed = ({ children, href, linkMediaInfo }: ContentLinkEmbedPro )} - - {isOpen && !isMobile && ( -
    - -
    - )} -
    + {getHasThumbnail(linkMediaInfo, href) && ( + + {isOpen && !isMobile && ( +
    + +
    + )} +
    + )} ); }; @@ -172,7 +175,8 @@ const Markdown = ({ content, title }: MarkdownProps) => { a: ({ href, children }) => { if (href && !isInCatalogView) { const linkMediaInfo = getLinkMediaInfo(href); - if (getHasThumbnail(linkMediaInfo, href)) { + const embedUrl = new URL(href); + if (canEmbed(embedUrl) || getHasThumbnail(linkMediaInfo, href)) { return ; } else { return ( From 0f6b9225165983986771a712787c30f5a5215c8d Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sat, 31 Aug 2024 14:57:11 +0200 Subject: [PATCH 07/20] fix(post): reply backlink didn't appear in post info immediately after replying to it --- src/components/post-desktop/post-desktop.tsx | 6 +++-- src/components/post-mobile/post-mobile.tsx | 8 +++--- .../reply-quote-preview.tsx | 25 +++++++++++-------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index 395dfc81..2b77a3f6 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -199,10 +199,12 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }: )} - {replyCount > 0 && + {cid && parentCid && replies && - replies.map((reply: Comment, index: number) => reply?.parentCid === cid && )} + replies.map( + (reply: Comment, index: number) => reply?.parentCid === cid && reply?.cid && , + )}
    ); }; diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index d89ebc68..b5280bba 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -172,15 +172,17 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P }; const ReplyBacklinks = ({ post }: PostProps) => { - const { cid, parentCid, replyCount } = post || {}; + const { cid, parentCid } = post || {}; const replies = useReplies(post); return ( - replyCount > 0 && + cid && parentCid && replies && (
    - {replies.map((reply: Comment, index: number) => reply?.parentCid === cid && )} + {replies.map( + (reply: Comment, index: number) => reply?.parentCid === cid && reply?.cid && , + )}
    ) ); diff --git a/src/components/reply-quote-preview/reply-quote-preview.tsx b/src/components/reply-quote-preview/reply-quote-preview.tsx index 6df42524..5e5d5b39 100644 --- a/src/components/reply-quote-preview/reply-quote-preview.tsx +++ b/src/components/reply-quote-preview/reply-quote-preview.tsx @@ -139,7 +139,7 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i onMouseOver={() => handleMouseOver(quotelinkReply?.cid)} onMouseLeave={() => handleMouseLeave(quotelinkReply?.cid)} > - {`c/${quotelinkReply?.shortCid}`} + {quotelinkReply?.shortCid && `c/${quotelinkReply?.shortCid}`} {quotelinkReply?.author?.address === account?.author?.address && ' (You)'}
    @@ -200,11 +200,13 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is onMouseOver={() => handleMouseOver(backlinkReply?.cid)} onMouseLeave={() => handleMouseLeave(backlinkReply?.cid)} > - c/{backlinkReply?.shortCid}{' '} + {backlinkReply?.shortCid && `c/${backlinkReply?.shortCid}`} - - # - + {backlinkReply?.shortCid && ( + + # + + )} {hoveredCid === backlinkReply?.cid && outOfViewCid === backlinkReply?.cid && createPortal( @@ -226,14 +228,15 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is onMouseOver={() => handleMouseOver(quotelinkReply?.cid)} onMouseLeave={() => handleMouseLeave(quotelinkReply?.cid)} > - c/{quotelinkReply?.shortCid} + {quotelinkReply?.shortCid && `c/${quotelinkReply?.shortCid}`} {quotelinkReply?.author?.address === account?.author?.address && ' (You)'} - - {' '} - # - -
    + {quotelinkReply?.shortCid && ( + + {' '} + # + + )} {hoveredCid === quotelinkReply?.cid && outOfViewCid === quotelinkReply?.cid && createPortal( From e1422d005419f21ddf039c76021156679146dc91 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sat, 31 Aug 2024 15:19:43 +0200 Subject: [PATCH 08/20] fix(post): clicking the quotelink or backlink to a reply wouldn't scroll to the reply more than once in a row --- src/components/post-desktop/post-desktop.tsx | 11 +---- src/components/post-mobile/post-mobile.tsx | 11 +---- .../reply-quote-preview.tsx | 43 +++++++++++++++++-- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index 2b77a3f6..eec98e5b 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -424,15 +424,6 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies, showReplies const linksCount = pinned ? totalLinksCount : totalLinksCount - visiblelinksCount; const { showOmittedReplies, setShowOmittedReplies } = useShowOmittedReplies(); - // scroll to reply if pathname is reply permalink (backlink) - const replyRefs = useRef<(HTMLDivElement | null)[]>([]); - useEffect(() => { - const replyIndex = replies.findIndex((reply) => location.pathname === `/p/${subplebbitAddress}/c/${reply?.cid}`); - if (replyIndex !== -1 && replyRefs.current[replyIndex]) { - replyRefs.current[replyIndex]?.scrollIntoView(); - } - }, [location.pathname, replies, subplebbitAddress]); - const stateString = useStateString(post); return ( @@ -484,7 +475,7 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies, showReplies replies && showReplies && (showAllReplies || showOmittedReplies[cid] ? replies : replies.slice(-5)).map((reply, index) => ( -
    (replyRefs.current[index] = el)}> +
    ))} diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index b5280bba..a2fec7ee 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -341,15 +341,6 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies, showReplies = const isInPostPageView = isPostPageView(location.pathname, params); const { hidden, unhide } = useHide({ cid }); - // scroll to reply if pathname is reply permalink (backlink) - const replyRefs = useRef<(HTMLDivElement | null)[]>([]); - useEffect(() => { - const replyIndex = replies.findIndex((reply) => location.pathname === `/p/${subplebbitAddress}/c/${reply?.cid}`); - if (replyIndex !== -1 && replyRefs.current[replyIndex]) { - replyRefs.current[replyIndex]?.scrollIntoView(); - } - }, [location.pathname, replies, subplebbitAddress]); - const stateString = useStateString(post); return ( @@ -398,7 +389,7 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies, showReplies = replies && showReplies && (showAllReplies ? replies : replies.slice(-5)).map((reply, index) => ( -
    (replyRefs.current[index] = el)}> +
    ))} diff --git a/src/components/reply-quote-preview/reply-quote-preview.tsx b/src/components/reply-quote-preview/reply-quote-preview.tsx index 5e5d5b39..407aae8c 100644 --- a/src/components/reply-quote-preview/reply-quote-preview.tsx +++ b/src/components/reply-quote-preview/reply-quote-preview.tsx @@ -1,6 +1,6 @@ import { useEffect, useRef, useState } from 'react'; import { createPortal } from 'react-dom'; -import { Link } from 'react-router-dom'; +import { Link, useNavigate } from 'react-router-dom'; import { Comment, useAccount } from '@plebbit/plebbit-react-hooks'; import { useFloating, offset, shift, size, autoUpdate, Placement } from '@floating-ui/react'; import useIsMobile from '../../hooks/use-is-mobile'; @@ -88,6 +88,19 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i }; }, [update]); + const navigate = useNavigate(); + + const handleClick = (e: React.MouseEvent, cid: string | undefined, subplebbitAddress: string | undefined) => { + e.preventDefault(); + if (cid && subplebbitAddress) { + navigate(`/p/${subplebbitAddress}/c/${cid}`); + setTimeout(() => { + const element = document.querySelector(`[data-cid="${cid}"]`); + element?.scrollIntoView(); + }, 100); + } + }; + const handleMouseOver = (cid: string | undefined) => { if (!cid) return; @@ -114,6 +127,7 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i ref={refs.setReference} onMouseOver={() => handleMouseOver(backlinkReply?.cid)} onMouseLeave={() => handleMouseLeave(backlinkReply?.cid)} + onClick={(e) => handleClick(e, backlinkReply?.cid, backlinkReply?.subplebbitAddress)} > c/{backlinkReply?.shortCid} @@ -138,6 +152,7 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i className={styles.quoteLink} onMouseOver={() => handleMouseOver(quotelinkReply?.cid)} onMouseLeave={() => handleMouseLeave(quotelinkReply?.cid)} + onClick={(e) => handleClick(e, quotelinkReply?.cid, quotelinkReply?.subplebbitAddress)} > {quotelinkReply?.shortCid && `c/${quotelinkReply?.shortCid}`} {quotelinkReply?.author?.address === account?.author?.address && ' (You)'} @@ -174,6 +189,19 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is }; }, [update]); + const navigate = useNavigate(); + + const handleClick = (e: React.MouseEvent, cid: string | undefined, subplebbitAddress: string | undefined) => { + e.preventDefault(); + if (cid && subplebbitAddress) { + navigate(`/p/${subplebbitAddress}/c/${cid}`); + setTimeout(() => { + const element = document.querySelector(`[data-cid="${cid}"]`); + element?.scrollIntoView(); + }, 100); + } + }; + const handleMouseOver = (cid: string | undefined) => { if (!cid) return; @@ -203,7 +231,12 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is {backlinkReply?.shortCid && `c/${backlinkReply?.shortCid}`} {backlinkReply?.shortCid && ( - + handleClick(e, backlinkReply?.cid, backlinkReply?.subplebbitAddress)} + > + {' '} # )} @@ -232,7 +265,11 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is {quotelinkReply?.author?.address === account?.author?.address && ' (You)'} {quotelinkReply?.shortCid && ( - + handleClick(e, quotelinkReply?.cid, quotelinkReply?.subplebbitAddress)} + > {' '} # From 46898c15dc4a9a728b5deda5d9c5d1d365c27457 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sat, 31 Aug 2024 15:38:36 +0200 Subject: [PATCH 09/20] fix eslint --- src/components/post-desktop/post-desktop.tsx | 4 ++-- src/components/post-mobile/post-mobile.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index eec98e5b..728dec87 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from 'react'; +import { useState } from 'react'; import { Trans, useTranslation } from 'react-i18next'; import { Link, useLocation, useParams } from 'react-router-dom'; import { Comment, useAccount, useAuthorAvatar, useComment, useEditedComment } from '@plebbit/plebbit-react-hooks'; @@ -48,7 +48,7 @@ const useShowOmittedReplies = create((set) => ({ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }: PostProps) => { const { t } = useTranslation(); - const { author, cid, deleted, locked, pinned, parentCid, postCid, removed, replyCount, shortCid, state, subplebbitAddress, timestamp } = post || {}; + const { author, cid, deleted, locked, pinned, parentCid, postCid, removed, shortCid, state, subplebbitAddress, timestamp } = post || {}; const title = post?.title?.trim(); const replies = useReplies(post); const { address, shortAddress } = author || {}; diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index a2fec7ee..b1ed07fd 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from 'react'; +import { useState } from 'react'; import { Trans, useTranslation } from 'react-i18next'; import { Link, useLocation, useParams } from 'react-router-dom'; import { Comment, useAccount, useAuthorAvatar, useComment, useEditedComment } from '@plebbit/plebbit-react-hooks'; From d32cebb69511d87cbabed21881b1100963fe99dd Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sun, 1 Sep 2024 17:10:14 +0200 Subject: [PATCH 10/20] Update use-replies.ts --- src/hooks/use-replies.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/hooks/use-replies.ts b/src/hooks/use-replies.ts index 0426f009..7fc709fc 100644 --- a/src/hooks/use-replies.ts +++ b/src/hooks/use-replies.ts @@ -1,4 +1,4 @@ -import { useMemo, useCallback, useState, useEffect } from 'react'; +import { useMemo, useCallback } from 'react'; import { Comment, useAccountComments } from '@plebbit/plebbit-react-hooks'; import { flattenCommentsPages } from '@plebbit/plebbit-react-hooks/dist/lib/utils'; @@ -9,7 +9,7 @@ const useReplies = (comment: Comment) => { // generate a Set of CIDs from flattened replies for quick lookup const replyCids = useMemo(() => new Set(flattenedReplies.map((reply) => reply?.cid)), [flattenedReplies]); - const [filteredAccountComments, setFilteredAccountComments] = useState([]); + const { accountComments } = useAccountComments(); const getPostCid = useCallback( (accountComment: Comment, allComments: Comment[]): string | null => { @@ -25,9 +25,7 @@ const useReplies = (comment: Comment) => { [comment?.cid], ); - const { accountComments } = useAccountComments(); - - useEffect(() => { + const filteredAccountComments = useMemo(() => { const filterComments = (comments: Comment[]) => { return comments.filter((accountComment) => { const parentCid = accountComment.parentCid; @@ -38,7 +36,7 @@ const useReplies = (comment: Comment) => { }); }; - setFilteredAccountComments(filterComments(accountComments)); + return filterComments(accountComments); }, [accountComments, comment?.cid, replyCids, getPostCid]); // the account's replies have a delay before getting published, so get them locally from accountComments instead From 0babf71f8c622febb085dd11ee797ae9cf7d5c20 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sun, 1 Sep 2024 19:57:26 +0200 Subject: [PATCH 11/20] remove dot after reason https://github.com/plebbit/plebchan/issues/487#issuecomment-2323114180 --- src/components/post-desktop/post-desktop.tsx | 4 ++-- src/components/post-mobile/post-mobile.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index 728dec87..9d41506f 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -298,7 +298,7 @@ const PostMessage = ({ post }: PostProps) => { ({t('this_post_was_removed')})

    - {`${_.capitalize(t('reason'))}: "${reason}"`}. + {`${_.capitalize(t('reason'))}: "${reason}"`} ) : ( {_.capitalize(t('this_post_was_removed'))}. @@ -307,7 +307,7 @@ const PostMessage = ({ post }: PostProps) => { reason ? ( <> {t('user_deleted_this_post')}{' '} - {`${_.capitalize(t('reason'))}: "${reason}"`}. + {`${_.capitalize(t('reason'))}: "${reason}"`} ) : ( {t('user_deleted_this_post')} diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index b1ed07fd..78a5ad24 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -221,7 +221,7 @@ const PostMessageMobile = ({ post }: PostProps) => { ({t('this_post_was_removed')})

    - {`${_.capitalize(t('reason'))}: "${reason}"`}. + {`${_.capitalize(t('reason'))}: "${reason}"`} ) : ( {_.capitalize(t('this_post_was_removed'))}. @@ -230,7 +230,7 @@ const PostMessageMobile = ({ post }: PostProps) => { reason ? ( <> {t('user_deleted_this_post')}{' '} - {`${_.capitalize(t('reason'))}: "${reason}"`}. + {`${_.capitalize(t('reason'))}: "${reason}"`} ) : ( {t('user_deleted_this_post')} From 2590a9c096657ce53d016f3570189a2bc7085930 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 2 Sep 2024 17:15:41 +0200 Subject: [PATCH 12/20] fix(post): "c/Pending" could appear on first render --- src/components/post-desktop/post-desktop.tsx | 2 +- src/components/post-mobile/post-mobile.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index 9d41506f..9f6149b6 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -172,7 +172,7 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }: ) : ( <> c/ - {state === 'failed' || stateString === 'Failed' ? 'Failed' : 'Pending'} + {state === 'failed' || stateString === 'Failed' ? 'Failed' : state === 'pending' ? 'Pending' : ''} ))} {pinned && ( diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index 78a5ad24..24b09b3a 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -159,7 +159,7 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P ) : ( <> c/ - {state === 'failed' || stateString === 'Failed' ? 'Failed' : 'Pending'} + {state === 'failed' || stateString === 'Failed' ? 'Failed' : state === 'pending' ? 'Pending' : ''} ))} From 30b91521b9a3e4daef86f696b18addb7149bcff8 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 2 Sep 2024 17:29:12 +0200 Subject: [PATCH 13/20] fix(home): options modal flickered when clicked twice --- src/views/home/box-modal/box-modal.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/views/home/box-modal/box-modal.tsx b/src/views/home/box-modal/box-modal.tsx index 1f7827d6..3a76b146 100644 --- a/src/views/home/box-modal/box-modal.tsx +++ b/src/views/home/box-modal/box-modal.tsx @@ -7,6 +7,7 @@ const BoxModal = ({ isBoardsBoxModal }: { isBoardsBoxModal: boolean }) => { const { t } = useTranslation(); const [showFilterModal, setShowFilterModal] = useState(false); const modalRef = useRef(null); + const buttonRef = useRef(null); const { showNsfwBoardsOnly, @@ -23,11 +24,11 @@ const BoxModal = ({ isBoardsBoxModal }: { isBoardsBoxModal: boolean }) => { const handleClickOutside = useCallback( (event: MouseEvent) => { - if (modalRef.current && !modalRef.current.contains(event.target as Node)) { + if (modalRef.current && !modalRef.current.contains(event.target as Node) && buttonRef.current && !buttonRef.current.contains(event.target as Node)) { setShowFilterModal(false); } }, - [modalRef, setShowFilterModal], + [modalRef, buttonRef, setShowFilterModal], ); useEffect(() => { @@ -39,7 +40,7 @@ const BoxModal = ({ isBoardsBoxModal }: { isBoardsBoxModal: boolean }) => { return ( <> - setShowFilterModal(true)}> + !showFilterModal && setShowFilterModal(true)}> {isBoardsBoxModal ? t('filter') : t('options')} ▼ {showFilterModal && ( From 8487217a515cd536485d2de430d5d488f3d48315 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 2 Sep 2024 20:49:06 +0200 Subject: [PATCH 14/20] Update use-replies.ts --- src/hooks/use-replies.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hooks/use-replies.ts b/src/hooks/use-replies.ts index 7fc709fc..598b3775 100644 --- a/src/hooks/use-replies.ts +++ b/src/hooks/use-replies.ts @@ -32,12 +32,13 @@ const useReplies = (comment: Comment) => { if (parentCid === (comment?.cid || 'n/a') || replyCids.has(parentCid)) { return true; } - return getPostCid(accountComment, comments) === comment?.cid; + // Changed this line to compare with comment?.parentCid instead of comment?.cid + return getPostCid(accountComment, comments) === comment?.parentCid; }); }; return filterComments(accountComments); - }, [accountComments, comment?.cid, replyCids, getPostCid]); + }, [accountComments, comment?.cid, comment?.parentCid, replyCids, getPostCid]); // the account's replies have a delay before getting published, so get them locally from accountComments instead const accountRepliesNotYetPublished = useMemo(() => { From 5b7acbc5689d9cebee10d0ba8661227c9996b3cf Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Tue, 3 Sep 2024 10:14:15 +0200 Subject: [PATCH 15/20] feat(settings): add option to hide avatars --- src/components/post-desktop/post-desktop.tsx | 6 ++++-- src/components/post-mobile/post-mobile.tsx | 4 +++- .../interface-settings.module.css | 4 ++++ .../interface-settings/interface-settings.tsx | 11 ++++++++++ src/stores/use-avatar-visibility-store.ts | 21 +++++++++++++++++++ 5 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 src/stores/use-avatar-visibility-store.ts diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index 9f6149b6..899d5471 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -10,10 +10,12 @@ import { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-util import { isValidURL } from '../../lib/utils/url-utils'; import { isAllView, isPendingPostView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils'; import useAnonModeStore from '../../stores/use-anon-mode-store'; +import useAvatarVisibilityStore from '../../stores/use-avatar-visibility-store'; import useAnonMode from '../../hooks/use-anon-mode'; import useAuthorAddressClick from '../../hooks/use-author-address-click'; import useEditCommentPrivileges from '../../hooks/use-author-privileges'; import useCountLinksInReplies from '../../hooks/use-count-links-in-replies'; +import useFetchGifFirstFrame from '../../hooks/use-fetch-gif-first-frame'; import useHide from '../../hooks/use-hide'; import useReplies from '../../hooks/use-replies'; import useStateString from '../../hooks/use-state-string'; @@ -28,7 +30,6 @@ import Tooltip from '../tooltip'; import { PostProps } from '../../views/post/post'; import { create } from 'zustand'; import _ from 'lodash'; -import useFetchGifFirstFrame from '../../hooks/use-fetch-gif-first-frame'; interface ShowOmittedRepliesState { showOmittedReplies: Record; @@ -59,6 +60,7 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }: const isReply = parentCid; const { showOmittedReplies } = useShowOmittedReplies(); const { imageUrl: avatarImageUrl } = useAuthorAvatar({ author }); + const { hideAvatars } = useAvatarVisibilityStore(); const params = useParams(); const location = useLocation(); @@ -116,7 +118,7 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }: {!(isDescription || isRules) && ( <> - {author?.avatar && !(deleted || removed) ? ( + {author?.avatar && !(deleted || removed) && !hideAvatars ? ( diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index 24b09b3a..677241c7 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -9,6 +9,7 @@ import { getTextColorForBackground, hashStringToColor } from '../../lib/utils/po import { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-utils'; import { isAllView, isPendingPostView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils'; import useAnonModeStore from '../../stores/use-anon-mode-store'; +import useAvatarVisibilityStore from '../../stores/use-avatar-visibility-store'; import useAnonMode from '../../hooks/use-anon-mode'; import useAuthorAddressClick from '../../hooks/use-author-address-click'; import useCountLinksInReplies from '../../hooks/use-count-links-in-replies'; @@ -33,6 +34,7 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P const displayName = author?.displayName?.trim(); const authorRole = roles?.[address]?.role; const { imageUrl: avatarImageUrl } = useAuthorAvatar({ author }); + const { hideAvatars } = useAvatarVisibilityStore(); const params = useParams(); const location = useLocation(); @@ -87,7 +89,7 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P {!(isDescription || isRules) && ( <> - {author?.avatar && !(deleted || removed) ? ( + {author?.avatar && !(deleted || removed) && !hideAvatars ? ( diff --git a/src/components/settings-modal/interface-settings/interface-settings.module.css b/src/components/settings-modal/interface-settings/interface-settings.module.css index 650868a8..f5aa0bcf 100644 --- a/src/components/settings-modal/interface-settings/interface-settings.module.css +++ b/src/components/settings-modal/interface-settings/interface-settings.module.css @@ -24,4 +24,8 @@ .interfaceSettings { margin-bottom: 10px; +} + +.setting input[type="checkbox"] { + margin-right: 2px; } \ No newline at end of file diff --git a/src/components/settings-modal/interface-settings/interface-settings.tsx b/src/components/settings-modal/interface-settings/interface-settings.tsx index cf9494eb..288cda52 100644 --- a/src/components/settings-modal/interface-settings/interface-settings.tsx +++ b/src/components/settings-modal/interface-settings/interface-settings.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'; import useTheme from '../../../hooks/use-theme'; import styles from './interface-settings.module.css'; import packageJson from '../../../../package.json'; +import useAvatarVisibilityStore from '../../../stores/use-avatar-visibility-store'; const commitRef = process.env.REACT_APP_COMMIT_REF; const isElectron = window.isElectron === true; @@ -107,6 +108,11 @@ const InterfaceLanguage = () => { const InterfaceSettings = () => { const { t } = useTranslation(); + const { hideAvatars, setHideAvatars } = useAvatarVisibilityStore(); + + const handleHideAvatarsChange = (e: React.ChangeEvent) => { + setHideAvatars(e.target.checked); + }; return (
    @@ -130,6 +136,11 @@ const InterfaceSettings = () => {
    {t('interface_language')}:
    +
    + +
    ); }; diff --git a/src/stores/use-avatar-visibility-store.ts b/src/stores/use-avatar-visibility-store.ts new file mode 100644 index 00000000..aa2c3f7e --- /dev/null +++ b/src/stores/use-avatar-visibility-store.ts @@ -0,0 +1,21 @@ +import { create } from 'zustand'; +import { persist } from 'zustand/middleware'; + +interface AvatarVisibilityState { + hideAvatars: boolean; + setHideAvatars: (hide: boolean) => void; +} + +const useAvatarVisibilityStore = create()( + persist( + (set) => ({ + hideAvatars: false, + setHideAvatars: (hide) => set({ hideAvatars: hide }), + }), + { + name: 'avatar-visibility-storage', + }, + ), +); + +export default useAvatarVisibilityStore; From 2b9e3c1f9ca41348acadc2877746cdce3cf5152d Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Tue, 3 Sep 2024 10:21:53 +0200 Subject: [PATCH 16/20] add translations --- public/translations/ar/default.json | 5 ++++- public/translations/bn/default.json | 5 ++++- public/translations/cs/default.json | 5 ++++- public/translations/da/default.json | 5 ++++- public/translations/de/default.json | 5 ++++- public/translations/el/default.json | 5 ++++- public/translations/en/default.json | 5 ++++- public/translations/es/default.json | 5 ++++- public/translations/fa/default.json | 5 ++++- public/translations/fi/default.json | 5 ++++- public/translations/fil/default.json | 5 ++++- public/translations/fr/default.json | 5 ++++- public/translations/he/default.json | 5 ++++- public/translations/hi/default.json | 5 ++++- public/translations/hu/default.json | 5 ++++- public/translations/id/default.json | 5 ++++- public/translations/it/default.json | 5 ++++- public/translations/ja/default.json | 5 ++++- public/translations/ko/default.json | 5 ++++- public/translations/mr/default.json | 5 ++++- public/translations/nl/default.json | 5 ++++- public/translations/no/default.json | 5 ++++- public/translations/pl/default.json | 5 ++++- public/translations/pt/default.json | 5 ++++- public/translations/ro/default.json | 5 ++++- public/translations/ru/default.json | 5 ++++- public/translations/sq/default.json | 5 ++++- public/translations/sv/default.json | 5 ++++- public/translations/te/default.json | 5 ++++- public/translations/th/default.json | 5 ++++- public/translations/tr/default.json | 5 ++++- public/translations/uk/default.json | 5 ++++- public/translations/ur/default.json | 5 ++++- public/translations/vi/default.json | 5 ++++- public/translations/zh/default.json | 5 ++++- .../account-settings/account-settings.tsx | 5 +++-- .../interface-settings.module.css | 1 - .../interface-settings/interface-settings.tsx | 17 +++++++++-------- .../plebbit-options/plebbit-options.tsx | 2 +- 39 files changed, 153 insertions(+), 47 deletions(-) diff --git a/public/translations/ar/default.json b/public/translations/ar/default.json index 5e596692..9086593d 100644 --- a/public/translations/ar/default.json +++ b/public/translations/ar/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "إخفاء لوحات الجور", "hide_adult_boards": "إخفاء لوحات الكبار", "static_gif": "GIF ثابت", - "animated_gif": "GIF متحرك" + "animated_gif": "GIF متحرك", + "hide_avatars": "إخفاء الصور الرمزية", + "anon_mode": "وضع مجهول", + "anon_mode_description": "يتم استخدام معرف مستخدم مختلف تلقائيًا في كل موضوع" } \ No newline at end of file diff --git a/public/translations/bn/default.json b/public/translations/bn/default.json index 6b4dd35b..e4a50970 100644 --- a/public/translations/bn/default.json +++ b/public/translations/bn/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "গর বোর্ডস লুকান", "hide_adult_boards": "পুরুষ বোর্ডস লুকান", "static_gif": "স্ট্যাটিক GIF", - "animated_gif": "অ্যানিমেটেড GIF" + "animated_gif": "অ্যানিমেটেড GIF", + "hide_avatars": "অ্যাভাটার লুকান", + "anon_mode": "অজ্ঞাত মোড", + "anon_mode_description": "প্রতিটি থ্রেডে স্বয়ংক্রিয়ভাবে একটি ভিন্ন ব্যবহারকারীর আইডি ব্যবহার করুন" } \ No newline at end of file diff --git a/public/translations/cs/default.json b/public/translations/cs/default.json index b1188596..c805b4d1 100644 --- a/public/translations/cs/default.json +++ b/public/translations/cs/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Skrýt gore desky", "hide_adult_boards": "Skrýt dospělé desky", "static_gif": "Statický GIF", - "animated_gif": "Animovaný GIF" + "animated_gif": "Animovaný GIF", + "hide_avatars": "Skrýt avatary", + "anon_mode": "Anonymní režim", + "anon_mode_description": "Automaticky používejte jiný uživatelský ID v každém vlákně" } \ No newline at end of file diff --git a/public/translations/da/default.json b/public/translations/da/default.json index 3cacc31f..65c36d39 100644 --- a/public/translations/da/default.json +++ b/public/translations/da/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Skjul Gore Boards", "hide_adult_boards": "Skjul Voksne Boards", "static_gif": "Statisk GIF", - "animated_gif": "Animeret GIF" + "animated_gif": "Animeret GIF", + "hide_avatars": "Skjul avatarer", + "anon_mode": "Anonim tilstand", + "anon_mode_description": "Brug automatisk en anden bruger-ID i hver tråd" } \ No newline at end of file diff --git a/public/translations/de/default.json b/public/translations/de/default.json index 8b4478e9..b7f5a072 100644 --- a/public/translations/de/default.json +++ b/public/translations/de/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Gore-Boards ausblenden", "hide_adult_boards": "Erwachsenen-Boards ausblenden", "static_gif": "Statisches GIF", - "animated_gif": "Animiertes GIF" + "animated_gif": "Animiertes GIF", + "hide_avatars": "Avatare ausblenden", + "anon_mode": "Anonymer Modus", + "anon_mode_description": "Verwenden Sie automatisch eine andere Benutzer-ID in jedem Thread" } \ No newline at end of file diff --git a/public/translations/el/default.json b/public/translations/el/default.json index 021f085a..e9d15b8c 100644 --- a/public/translations/el/default.json +++ b/public/translations/el/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Απόκρυψη των Gore Boards", "hide_adult_boards": "Απόκρυψη των Adult Boards", "static_gif": "Στατικό GIF", - "animated_gif": "Κινούμενο GIF" + "animated_gif": "Κινούμενο GIF", + "hide_avatars": "Απόκρυψη avatars", + "anon_mode": "Λειτουργία ανωνυμίας", + "anon_mode_description": "Χρησιμοποιήστε αυτόματα διαφορετικό αναγνωριστικό χρήστη σε κάθε νήμα" } \ No newline at end of file diff --git a/public/translations/en/default.json b/public/translations/en/default.json index e60cecc7..28d65698 100644 --- a/public/translations/en/default.json +++ b/public/translations/en/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Hide Gore Boards", "hide_adult_boards": "Hide Adult Boards", "static_gif": "Static GIF", - "animated_gif": "Animated GIF" + "animated_gif": "Animated GIF", + "hide_avatars": "Hide avatars", + "anon_mode": "Anon mode", + "anon_mode_description": "Automatically use a different user ID in each thread" } \ No newline at end of file diff --git a/public/translations/es/default.json b/public/translations/es/default.json index 5c4191ad..651d35c2 100644 --- a/public/translations/es/default.json +++ b/public/translations/es/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Ocultar tableros de gore", "hide_adult_boards": "Ocultar tableros para adultos", "static_gif": "GIF Estático", - "animated_gif": "GIF Animado" + "animated_gif": "GIF Animado", + "hide_avatars": "Ocultar avatares", + "anon_mode": "Modo anónimo", + "anon_mode_description": "Utiliza automáticamente un ID de usuario diferente en cada hilo" } \ No newline at end of file diff --git a/public/translations/fa/default.json b/public/translations/fa/default.json index 2c9e09a3..d617d11e 100644 --- a/public/translations/fa/default.json +++ b/public/translations/fa/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "پنهان کردن تخته های گور", "hide_adult_boards": "پنهان کردن تخته های بزرگسالان", "static_gif": "GIF ثابت", - "animated_gif": "GIF متحرک" + "animated_gif": "GIF متحرک", + "hide_avatars": "پنهان کردن آواتارها", + "anon_mode": "حالت ناشناس", + "anon_mode_description": "به طور خودکار از یک شناسه کاربری متفاوت در هر موضوع استفاده کنید" } \ No newline at end of file diff --git a/public/translations/fi/default.json b/public/translations/fi/default.json index 47b2be89..35059116 100644 --- a/public/translations/fi/default.json +++ b/public/translations/fi/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Piilota Gore-laudat", "hide_adult_boards": "Piilota Aikuisten lautat", "static_gif": "Staattinen GIF", - "animated_gif": "Animoitu GIF" + "animated_gif": "Animoitu GIF", + "hide_avatars": "Piilota avatarit", + "anon_mode": "Anonyymi tila", + "anon_mode_description": "Käytä automaattisesti eri käyttäjä-ID:tä jokaisessa keskustelussa" } \ No newline at end of file diff --git a/public/translations/fil/default.json b/public/translations/fil/default.json index 55fc9cb4..b52f4692 100644 --- a/public/translations/fil/default.json +++ b/public/translations/fil/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Itago ang mga Gore Boards", "hide_adult_boards": "Itago ang mga Adult Boards", "static_gif": "Static GIF", - "animated_gif": "Animated GIF" + "animated_gif": "Animated GIF", + "hide_avatars": "Itago ang mga avatar", + "anon_mode": "Anong mode", + "anon_mode_description": "Awtomatikong gamitin ang ibang user ID sa bawat thread" } \ No newline at end of file diff --git a/public/translations/fr/default.json b/public/translations/fr/default.json index b8d46d09..cba401e1 100644 --- a/public/translations/fr/default.json +++ b/public/translations/fr/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Masquer les tableaux Gore", "hide_adult_boards": "Masquer les tableaux pour adultes", "static_gif": "GIF Statique", - "animated_gif": "GIF Animé" + "animated_gif": "GIF Animé", + "hide_avatars": "Masquer les avatars", + "anon_mode": "Mode anonyme", + "anon_mode_description": "Utilisez automatiquement un identifiant utilisateur différent dans chaque fil" } \ No newline at end of file diff --git a/public/translations/he/default.json b/public/translations/he/default.json index 31e7b6d6..4dd10446 100644 --- a/public/translations/he/default.json +++ b/public/translations/he/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "הסתר לוחות Gore", "hide_adult_boards": "הסתר לוחות המבוגרים", "static_gif": "GIF סטטי", - "animated_gif": "GIF מונפש" + "animated_gif": "GIF מונפש", + "hide_avatars": "הסתר את התמונות האישיות", + "anon_mode": "מצב אנונימי", + "anon_mode_description": "השתמש אוטומטית במזהה משתמש שונה בכל שרשור" } \ No newline at end of file diff --git a/public/translations/hi/default.json b/public/translations/hi/default.json index 064e5628..848ced25 100644 --- a/public/translations/hi/default.json +++ b/public/translations/hi/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "गोर बोर्ड्स छिपाएं", "hide_adult_boards": "वयस्क बोर्ड्स छिपाएं", "static_gif": "स्थिर GIF", - "animated_gif": "एनिमेटेड GIF" + "animated_gif": "एनिमेटेड GIF", + "hide_avatars": "अवतार छिपाएँ", + "anon_mode": "अनाम मोड", + "anon_mode_description": "प्रत्येक थ्रेड में स्वचालित रूप से एक अलग उपयोगकर्ता आईडी का उपयोग करें" } \ No newline at end of file diff --git a/public/translations/hu/default.json b/public/translations/hu/default.json index 5cb4ee4f..6a32f9e4 100644 --- a/public/translations/hu/default.json +++ b/public/translations/hu/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Gore táblák elrejtése", "hide_adult_boards": "Felnőtt táblák elrejtése", "static_gif": "Statikus GIF", - "animated_gif": "Animált GIF" + "animated_gif": "Animált GIF", + "hide_avatars": "Avatarok elrejtése", + "anon_mode": "Anonim mód", + "anon_mode_description": "Automatikusan használjon más felhasználói azonosítót minden szálban" } \ No newline at end of file diff --git a/public/translations/id/default.json b/public/translations/id/default.json index 0a377ea3..9444d1df 100644 --- a/public/translations/id/default.json +++ b/public/translations/id/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Sembunyikan Papan Gore", "hide_adult_boards": "Sembunyikan Papan Dewasa", "static_gif": "GIF Statis", - "animated_gif": "GIF Animasi" + "animated_gif": "GIF Animasi", + "hide_avatars": "Sembunyikan avatar", + "anon_mode": "Mode anonim", + "anon_mode_description": "Secara otomatis gunakan ID pengguna yang berbeda di setiap utas" } \ No newline at end of file diff --git a/public/translations/it/default.json b/public/translations/it/default.json index d37aef4c..1b2e2070 100644 --- a/public/translations/it/default.json +++ b/public/translations/it/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Nascondi tavole Gore", "hide_adult_boards": "Nascondi tavole per adulti", "static_gif": "GIF Statica", - "animated_gif": "GIF Animata" + "animated_gif": "GIF Animata", + "hide_avatars": "Nascondi avatar", + "anon_mode": "Modalità anonima", + "anon_mode_description": "Usa automaticamente un ID utente diverso in ogni thread" } \ No newline at end of file diff --git a/public/translations/ja/default.json b/public/translations/ja/default.json index 0c2d765f..c8087ff2 100644 --- a/public/translations/ja/default.json +++ b/public/translations/ja/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "ゴアボードを非表示にする", "hide_adult_boards": "アダルトボードを非表示にする", "static_gif": "静的GIF", - "animated_gif": "アニメーションGIF" + "animated_gif": "アニメーションGIF", + "hide_avatars": "アバターを隠す", + "anon_mode": "匿名モード", + "anon_mode_description": "各スレッドで自動的に異なるユーザーIDを使用します" } \ No newline at end of file diff --git a/public/translations/ko/default.json b/public/translations/ko/default.json index 458625c0..db1e86a4 100644 --- a/public/translations/ko/default.json +++ b/public/translations/ko/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "고어 게시판 숨기기", "hide_adult_boards": "성인 게시판 숨기기", "static_gif": "정적 GIF", - "animated_gif": "애니메이션 GIF" + "animated_gif": "애니메이션 GIF", + "hide_avatars": "아바타 숨기기", + "anon_mode": "익명 모드", + "anon_mode_description": "각 스레드에서 자동으로 다른 사용자 ID를 사용합니다" } \ No newline at end of file diff --git a/public/translations/mr/default.json b/public/translations/mr/default.json index 6a72b834..02b6d7cb 100644 --- a/public/translations/mr/default.json +++ b/public/translations/mr/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "गोर बोर्ड्स लपवा", "hide_adult_boards": "वयस्क बोर्ड्स लपवा", "static_gif": "स्थिर GIF", - "animated_gif": "एनिमेटेड GIF" + "animated_gif": "एनिमेटेड GIF", + "hide_avatars": "अवतार लपवा", + "anon_mode": "अनाम मोड", + "anon_mode_description": "प्रत्येक थ्रेडमध्ये स्वयंचलितपणे वेगळा वापरकर्ता ID वापरा" } \ No newline at end of file diff --git a/public/translations/nl/default.json b/public/translations/nl/default.json index a26c02cf..562fe24c 100644 --- a/public/translations/nl/default.json +++ b/public/translations/nl/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Gore Boards verbergen", "hide_adult_boards": "Volwassenen Boards verbergen", "static_gif": "Statische GIF", - "animated_gif": "Geanimeerde GIF" + "animated_gif": "Geanimeerde GIF", + "hide_avatars": "Avatars verbergen", + "anon_mode": "Anoniem modus", + "anon_mode_description": "Gebruik automatisch een ander gebruikers-ID in elk thread" } \ No newline at end of file diff --git a/public/translations/no/default.json b/public/translations/no/default.json index 84aa557f..9a32c597 100644 --- a/public/translations/no/default.json +++ b/public/translations/no/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Skjul Gore Boards", "hide_adult_boards": "Skjul voksne Boards", "static_gif": "Statisk GIF", - "animated_gif": "Animasjons GIF" + "animated_gif": "Animasjons GIF", + "hide_avatars": "Skjul avatarer", + "anon_mode": "Anonim modus", + "anon_mode_description": "Bruk automatisk en annen bruker-ID i hver tråd" } \ No newline at end of file diff --git a/public/translations/pl/default.json b/public/translations/pl/default.json index fe0e8b02..22422f65 100644 --- a/public/translations/pl/default.json +++ b/public/translations/pl/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Ukryj Gore Boards", "hide_adult_boards": "Ukryj Adult Boards", "static_gif": "Statyczny GIF", - "animated_gif": "Animowany GIF" + "animated_gif": "Animowany GIF", + "hide_avatars": "Ukryj awatary", + "anon_mode": "Tryb anonimowy", + "anon_mode_description": "Automatycznie używaj innego identyfikatora użytkownika w każdym wątku" } \ No newline at end of file diff --git a/public/translations/pt/default.json b/public/translations/pt/default.json index c0f070ff..72f365fe 100644 --- a/public/translations/pt/default.json +++ b/public/translations/pt/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Ocultar Quadros Gore", "hide_adult_boards": "Ocultar Quadros para Adultos", "static_gif": "GIF Estático", - "animated_gif": "GIF Animado" + "animated_gif": "GIF Animado", + "hide_avatars": "Ocultar avatares", + "anon_mode": "Modo anônimo", + "anon_mode_description": "Use automaticamente um ID de usuário diferente em cada thread" } \ No newline at end of file diff --git a/public/translations/ro/default.json b/public/translations/ro/default.json index ea0e0406..1a22202c 100644 --- a/public/translations/ro/default.json +++ b/public/translations/ro/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Ascundeți tablourile Gore", "hide_adult_boards": "Ascundeți tablourile pentru adulți", "static_gif": "GIF Static", - "animated_gif": "GIF Animat" + "animated_gif": "GIF Animat", + "hide_avatars": "Ascunde avatarele", + "anon_mode": "Mod anonim", + "anon_mode_description": "Utilizați automat un ID de utilizator diferit în fiecare fir" } \ No newline at end of file diff --git a/public/translations/ru/default.json b/public/translations/ru/default.json index 46831cc2..451de514 100644 --- a/public/translations/ru/default.json +++ b/public/translations/ru/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Скрыть доски Gore", "hide_adult_boards": "Скрыть доски для взрослых", "static_gif": "Статичный GIF", - "animated_gif": "Анимированный GIF" + "animated_gif": "Анимированный GIF", + "hide_avatars": "Скрыть аватары", + "anon_mode": "Анонимный режим", + "anon_mode_description": "Автоматически используйте другой идентификатор пользователя в каждом потоке" } \ No newline at end of file diff --git a/public/translations/sq/default.json b/public/translations/sq/default.json index d34c9df6..5bb7d97b 100644 --- a/public/translations/sq/default.json +++ b/public/translations/sq/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Fshihet Gore Boards", "hide_adult_boards": "Fshihet Adult Boards", "static_gif": "GIF Statik", - "animated_gif": "GIF i Animuar" + "animated_gif": "GIF i Animuar", + "hide_avatars": "Fsheh avatarët", + "anon_mode": "Mënyra anonime", + "anon_mode_description": "Përdorni automatikisht një ID përdoruesi të ndryshëm në çdo temë" } \ No newline at end of file diff --git a/public/translations/sv/default.json b/public/translations/sv/default.json index 8bb8271b..be707f0d 100644 --- a/public/translations/sv/default.json +++ b/public/translations/sv/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Dölj Gore Boards", "hide_adult_boards": "Dölj vuxna Boards", "static_gif": "Statisk GIF", - "animated_gif": "Animerad GIF" + "animated_gif": "Animerad GIF", + "hide_avatars": "Dölj avatarer", + "anon_mode": "Anonymt läge", + "anon_mode_description": "Använd automatiskt ett annat användar-ID i varje tråd" } \ No newline at end of file diff --git a/public/translations/te/default.json b/public/translations/te/default.json index 8c9a12e6..969c599b 100644 --- a/public/translations/te/default.json +++ b/public/translations/te/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "గోర్ బోర్డ్స్ దాచు", "hide_adult_boards": "పురుషులు బోర్డ్లు దాచు", "static_gif": "స్టాటిక్ GIF", - "animated_gif": "అనిమేటెడ్ GIF" + "animated_gif": "అనిమేటెడ్ GIF", + "hide_avatars": "అవతార్లను దాచు", + "anon_mode": "అనానిమస్ మోడ్", + "anon_mode_description": "ప్రతి థ్రెడ్లో ఆటోమేటిక్‌గా ఒక వేరు వినియోగదారుడి ID ఉపయోగించండి" } \ No newline at end of file diff --git a/public/translations/th/default.json b/public/translations/th/default.json index 7089156d..f9fe9c12 100644 --- a/public/translations/th/default.json +++ b/public/translations/th/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "ซ่อนกระดาน Gore", "hide_adult_boards": "ซ่อนกระดานสำหรับผู้ใหญ่", "static_gif": "GIF แบบคงที่", - "animated_gif": "GIF ที่เคลื่อนไหว" + "animated_gif": "GIF ที่เคลื่อนไหว", + "hide_avatars": "ซ่อนอวาตาร์", + "anon_mode": "โหมดนิรนาม", + "anon_mode_description": "ใช้ ID ผู้ใช้ที่แตกต่างกันโดยอัตโนมัติในแต่ละเธรด" } \ No newline at end of file diff --git a/public/translations/tr/default.json b/public/translations/tr/default.json index 6e215a76..7519089e 100644 --- a/public/translations/tr/default.json +++ b/public/translations/tr/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Gore Panolarını Gizle", "hide_adult_boards": "Yetişkin Panolarını Gizle", "static_gif": "Statik GIF", - "animated_gif": "Animasyonlu GIF" + "animated_gif": "Animasyonlu GIF", + "hide_avatars": "Avatarları gizle", + "anon_mode": "Gizli mod", + "anon_mode_description": "Her iplikte otomatik olarak farklı bir kullanıcı ID'si kullanın" } \ No newline at end of file diff --git a/public/translations/uk/default.json b/public/translations/uk/default.json index 8b32f9af..558fafe2 100644 --- a/public/translations/uk/default.json +++ b/public/translations/uk/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Сховати дошки Gore", "hide_adult_boards": "Сховати дошки для дорослих", "static_gif": "Статичний GIF", - "animated_gif": "Анімований GIF" + "animated_gif": "Анімований GIF", + "hide_avatars": "Сховати аватари", + "anon_mode": "Режим анонімності", + "anon_mode_description": "Автоматично використовуйте інший ідентифікатор користувача в кожній гілці" } \ No newline at end of file diff --git a/public/translations/ur/default.json b/public/translations/ur/default.json index 7415250f..a97b2d8f 100644 --- a/public/translations/ur/default.json +++ b/public/translations/ur/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "گور بورڈز چھپائیں", "hide_adult_boards": "بالغ بورڈز چھپائیں", "static_gif": "اسٹیٹک GIF", - "animated_gif": "اینیمیٹڈ GIF" + "animated_gif": "اینیمیٹڈ GIF", + "hide_avatars": "اوٹار چھپائیں", + "anon_mode": "خفیہ موڈ", + "anon_mode_description": "ہر تھریڈ میں خود بخود مختلف صارف آئی ڈی کا استعمال کریں" } \ No newline at end of file diff --git a/public/translations/vi/default.json b/public/translations/vi/default.json index f7ae9b73..6fa02dac 100644 --- a/public/translations/vi/default.json +++ b/public/translations/vi/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "Ẩn Gore Boards", "hide_adult_boards": "Ẩn Adult Boards", "static_gif": "GIF Tĩnh", - "animated_gif": "GIF Hoạt Hình" + "animated_gif": "GIF Hoạt Hình", + "hide_avatars": "Ẩn avatar", + "anon_mode": "Chế độ ẩn danh", + "anon_mode_description": "Tự động sử dụng ID người dùng khác nhau trong mỗi chủ đề" } \ No newline at end of file diff --git a/public/translations/zh/default.json b/public/translations/zh/default.json index 50991f4c..0760ab0d 100644 --- a/public/translations/zh/default.json +++ b/public/translations/zh/default.json @@ -221,5 +221,8 @@ "hide_gore_boards": "隐藏Gore板块", "hide_adult_boards": "隐藏成人板块", "static_gif": "静态GIF", - "animated_gif": "动画GIF" + "animated_gif": "动画GIF", + "hide_avatars": "隐藏头像", + "anon_mode": "匿名模式", + "anon_mode_description": "在每个线程中自动使用不同的用户 ID" } \ No newline at end of file diff --git a/src/components/settings-modal/account-settings/account-settings.tsx b/src/components/settings-modal/account-settings/account-settings.tsx index c8a48dc8..12a4af17 100644 --- a/src/components/settings-modal/account-settings/account-settings.tsx +++ b/src/components/settings-modal/account-settings/account-settings.tsx @@ -6,15 +6,16 @@ import styles from './account-settings.module.css'; import useAnonModeStore from '../../../stores/use-anon-mode-store'; const AnonMode = () => { + const { t } = useTranslation(); const anonMode = useAnonModeStore((state) => state.anonMode); const setAnonMode = useAnonModeStore((state) => state.setAnonMode); return (
    - Automatically use a different user ID in each thread + {t('anon_mode_description')}
    ); }; diff --git a/src/components/settings-modal/interface-settings/interface-settings.module.css b/src/components/settings-modal/interface-settings/interface-settings.module.css index f5aa0bcf..17c135bf 100644 --- a/src/components/settings-modal/interface-settings/interface-settings.module.css +++ b/src/components/settings-modal/interface-settings/interface-settings.module.css @@ -3,7 +3,6 @@ } .setting { - text-transform: capitalize; margin-left: 10px; margin-top: 10px; } diff --git a/src/components/settings-modal/interface-settings/interface-settings.tsx b/src/components/settings-modal/interface-settings/interface-settings.tsx index 288cda52..9fccc550 100644 --- a/src/components/settings-modal/interface-settings/interface-settings.tsx +++ b/src/components/settings-modal/interface-settings/interface-settings.tsx @@ -1,9 +1,10 @@ import { useState } from 'react'; import { useTranslation } from 'react-i18next'; -import useTheme from '../../../hooks/use-theme'; -import styles from './interface-settings.module.css'; -import packageJson from '../../../../package.json'; import useAvatarVisibilityStore from '../../../stores/use-avatar-visibility-store'; +import useTheme from '../../../hooks/use-theme'; +import packageJson from '../../../../package.json'; +import styles from './interface-settings.module.css'; +import _ from 'lodash'; const commitRef = process.env.REACT_APP_COMMIT_REF; const isElectron = window.isElectron === true; @@ -117,7 +118,7 @@ const InterfaceSettings = () => { return (
    - {t('version')}:{' '} + {_.capitalize(t('version'))}:{' '} {packageJson.version} @@ -128,17 +129,17 @@ const InterfaceSettings = () => { )}
    - {t('update')}: + {_.capitalize(t('update'))}:
    - {t('style')}: