diff --git a/public/translations/ar/default.json b/public/translations/ar/default.json index 3afae8d0..497b4e74 100644 --- a/public/translations/ar/default.json +++ b/public/translations/ar/default.json @@ -294,5 +294,6 @@ "search_results_for": "نتائج البحث عن", "help": "مساعدة", "filter_and_highlights_help": "مساعدة الفلاتر والإبرازات", - "filter_and_highlights": "التصفية والتسليط الضوء" + "filter_and_highlights": "التصفية والتسليط الضوء", + "boards_you_moderate": "المنتديات التي تقوم بالإشراف عليها" } \ No newline at end of file diff --git a/public/translations/bn/default.json b/public/translations/bn/default.json index 9e550c59..309fa637 100644 --- a/public/translations/bn/default.json +++ b/public/translations/bn/default.json @@ -294,5 +294,6 @@ "search_results_for": "অনুসন্ধান ফলাফল", "help": "সাহায্য", "filter_and_highlights_help": "ফিল্টার এবং হাইলাইট সাহায্য", - "filter_and_highlights": "ফিল্টার এবং হাইলাইট" + "filter_and_highlights": "ফিল্টার এবং হাইলাইট", + "boards_you_moderate": "আপনি যে বোর্ডগুলি পরিচালনা করেন" } \ No newline at end of file diff --git a/public/translations/cs/default.json b/public/translations/cs/default.json index f804abbf..93873900 100644 --- a/public/translations/cs/default.json +++ b/public/translations/cs/default.json @@ -294,5 +294,6 @@ "search_results_for": "Výsledky hledání pro", "help": "Pomoc", "filter_and_highlights_help": "Pomoc s filtry a zvýrazněním", - "filter_and_highlights": "Filtry a zvýraznění" + "filter_and_highlights": "Filtry a zvýraznění", + "boards_you_moderate": "Fóra, která moderujete" } \ No newline at end of file diff --git a/public/translations/da/default.json b/public/translations/da/default.json index c0a7dbbe..e70236d7 100644 --- a/public/translations/da/default.json +++ b/public/translations/da/default.json @@ -294,5 +294,6 @@ "search_results_for": "Søgeresultater for", "help": "Hjælp", "filter_and_highlights_help": "Filtre og fremhævelser Hjælp", - "filter_and_highlights": "Filtre og fremhævninger" + "filter_and_highlights": "Filtre og fremhævninger", + "boards_you_moderate": "Boards du modererer" } \ No newline at end of file diff --git a/public/translations/de/default.json b/public/translations/de/default.json index ad6bc063..f660f65c 100644 --- a/public/translations/de/default.json +++ b/public/translations/de/default.json @@ -294,5 +294,6 @@ "search_results_for": "Suchergebnisse für", "help": "Hilfe", "filter_and_highlights_help": "Filter- und Markierungs-Hilfe", - "filter_and_highlights": "Filter und Hervorhebungen" + "filter_and_highlights": "Filter und Hervorhebungen", + "boards_you_moderate": "Boards, die Sie moderieren" } \ No newline at end of file diff --git a/public/translations/el/default.json b/public/translations/el/default.json index 40113a00..f3a5c50c 100644 --- a/public/translations/el/default.json +++ b/public/translations/el/default.json @@ -294,5 +294,6 @@ "search_results_for": "Αποτελέσματα αναζήτησης για", "help": "Βοήθεια", "filter_and_highlights_help": "Βοήθεια φίλτρων και επισήμανσης", - "filter_and_highlights": "Φίλτρα και Επισημάνσεις" + "filter_and_highlights": "Φίλτρα και Επισημάνσεις", + "boards_you_moderate": "Boards που διαχειρίζεστε" } \ No newline at end of file diff --git a/public/translations/en/default.json b/public/translations/en/default.json index 914a4943..9febc6f1 100644 --- a/public/translations/en/default.json +++ b/public/translations/en/default.json @@ -141,6 +141,7 @@ "user_deleted_this_post": "User deleted this post.", "reason": "reason", "search": "search", + "search_ops_placeholder": "Search OPs...", "ban_user_for": "Ban user for <1> days", "optional": "optional", "close_thread": "close thread", @@ -294,5 +295,6 @@ "search_results_for": "Search results for", "help": "Help", "filter_and_highlights_help": "Filters & Highlights Help", - "filter_and_highlights": "Filters & Highlights" + "filter_and_highlights": "Filters & Highlights", + "boards_you_moderate": "boards you moderate" } \ No newline at end of file diff --git a/public/translations/es/default.json b/public/translations/es/default.json index fd006523..ab25f0fc 100644 --- a/public/translations/es/default.json +++ b/public/translations/es/default.json @@ -294,5 +294,6 @@ "search_results_for": "Resultados de búsqueda para", "help": "Ayuda", "filter_and_highlights_help": "Ayuda de filtros y resaltes", - "filter_and_highlights": "Filtros y resaltados" + "filter_and_highlights": "Filtros y resaltados", + "boards_you_moderate": "tableros que moderas" } \ No newline at end of file diff --git a/public/translations/fa/default.json b/public/translations/fa/default.json index 108ada90..dd2e4efa 100644 --- a/public/translations/fa/default.json +++ b/public/translations/fa/default.json @@ -294,5 +294,6 @@ "search_results_for": "نتایج جستجو برای", "help": "کمک", "filter_and_highlights_help": "کمک فیلترها و برجسته‌ها", - "filter_and_highlights": "فیلترها و برجسته‌ها" + "filter_and_highlights": "فیلترها و برجسته‌ها", + "boards_you_moderate": "تابلوهایی که مدیریت می‌کنید" } \ No newline at end of file diff --git a/public/translations/fi/default.json b/public/translations/fi/default.json index febffbfb..ec8f215c 100644 --- a/public/translations/fi/default.json +++ b/public/translations/fi/default.json @@ -294,5 +294,6 @@ "search_results_for": "Hakutulokset hakusanalle", "help": "Apua", "filter_and_highlights_help": "Suodattimet ja korostukset -apu", - "filter_and_highlights": "Suodattimet ja korostukset" + "filter_and_highlights": "Suodattimet ja korostukset", + "boards_you_moderate": "lautakunnat, joita valvot" } \ No newline at end of file diff --git a/public/translations/fil/default.json b/public/translations/fil/default.json index 83f0572c..a8fafc11 100644 --- a/public/translations/fil/default.json +++ b/public/translations/fil/default.json @@ -294,5 +294,6 @@ "search_results_for": "Mga resulta ng paghahanap para sa", "help": "Tulong", "filter_and_highlights_help": "Tulong sa mga filter at highlight", - "filter_and_highlights": "Mga filter at highlight" + "filter_and_highlights": "Mga filter at highlight", + "boards_you_moderate": "mga board na iyong minomoderate" } \ No newline at end of file diff --git a/public/translations/fr/default.json b/public/translations/fr/default.json index 3de24e5d..eed42fe2 100644 --- a/public/translations/fr/default.json +++ b/public/translations/fr/default.json @@ -294,5 +294,6 @@ "search_results_for": "Résultats de recherche pour", "help": "Aide", "filter_and_highlights_help": "Aide sur les filtres et surlignages", - "filter_and_highlights": "Filtres et surlignages" + "filter_and_highlights": "Filtres et surlignages", + "boards_you_moderate": "boards que vous modérez" } \ No newline at end of file diff --git a/public/translations/he/default.json b/public/translations/he/default.json index 100cad37..b9bb6c3d 100644 --- a/public/translations/he/default.json +++ b/public/translations/he/default.json @@ -294,5 +294,6 @@ "search_results_for": "תוצאות חיפוש עבור", "help": "עזרה", "filter_and_highlights_help": "עזרה במסננים והדגשות", - "filter_and_highlights": "מסננים והדגשות" + "filter_and_highlights": "מסננים והדגשות", + "boards_you_moderate": "לוחות שאתה מפקח עליהם" } \ No newline at end of file diff --git a/public/translations/hi/default.json b/public/translations/hi/default.json index b89d3be3..a1c42d3f 100644 --- a/public/translations/hi/default.json +++ b/public/translations/hi/default.json @@ -294,5 +294,6 @@ "search_results_for": "के लिए खोज परिणाम", "help": "मदद", "filter_and_highlights_help": "फ़िल्टर और हाइलाइट्स सहायता", - "filter_and_highlights": "फ़िल्टर और हाइलाइट्स" + "filter_and_highlights": "फ़िल्टर और हाइलाइट्स", + "boards_you_moderate": "बोर्ड जो आप मॉडरेट करते हैं" } \ No newline at end of file diff --git a/public/translations/hu/default.json b/public/translations/hu/default.json index 1200f8ba..666daaa6 100644 --- a/public/translations/hu/default.json +++ b/public/translations/hu/default.json @@ -294,5 +294,6 @@ "search_results_for": "Keresési eredmények", "help": "Segítség", "filter_and_highlights_help": "Szűrők és kiemelések súgó", - "filter_and_highlights": "Szűrők és kiemelések" + "filter_and_highlights": "Szűrők és kiemelések", + "boards_you_moderate": "boardok, amelyeket moderálsz" } \ No newline at end of file diff --git a/public/translations/id/default.json b/public/translations/id/default.json index 0104b274..5eef3d29 100644 --- a/public/translations/id/default.json +++ b/public/translations/id/default.json @@ -294,5 +294,6 @@ "search_results_for": "Hasil pencarian untuk", "help": "Bantuan", "filter_and_highlights_help": "Bantuan Filter dan Sorotan", - "filter_and_highlights": "Filter dan Sorotan" + "filter_and_highlights": "Filter dan Sorotan", + "boards_you_moderate": "board yang Anda moderasi" } \ No newline at end of file diff --git a/public/translations/it/default.json b/public/translations/it/default.json index adccb163..8b2baf25 100644 --- a/public/translations/it/default.json +++ b/public/translations/it/default.json @@ -294,5 +294,6 @@ "search_results_for": "Risultati di ricerca per", "help": "Aiuto", "filter_and_highlights_help": "Aiuto su Filtri e Evidenziazioni", - "filter_and_highlights": "Filtri e Evidenziazioni" + "filter_and_highlights": "Filtri e Evidenziazioni", + "boards_you_moderate": "board che moderi" } \ No newline at end of file diff --git a/public/translations/ja/default.json b/public/translations/ja/default.json index cde06d87..e6fb2884 100644 --- a/public/translations/ja/default.json +++ b/public/translations/ja/default.json @@ -294,5 +294,6 @@ "search_results_for": "検索結果", "help": "ヘルプ", "filter_and_highlights_help": "フィルターとハイライトのヘルプ", - "filter_and_highlights": "フィルターとハイライト" + "filter_and_highlights": "フィルターとハイライト", + "boards_you_moderate": "あなたが管理するボード" } \ No newline at end of file diff --git a/public/translations/ko/default.json b/public/translations/ko/default.json index ed9f4f09..0fbb21f6 100644 --- a/public/translations/ko/default.json +++ b/public/translations/ko/default.json @@ -294,5 +294,6 @@ "search_results_for": "검색 결과", "help": "도움말", "filter_and_highlights_help": "필터 및 하이라이트 도움말", - "filter_and_highlights": "필터 및 하이라이트" + "filter_and_highlights": "필터 및 하이라이트", + "boards_you_moderate": "당신이 관리하는 게시판" } \ No newline at end of file diff --git a/public/translations/mr/default.json b/public/translations/mr/default.json index 73094525..b42e1862 100644 --- a/public/translations/mr/default.json +++ b/public/translations/mr/default.json @@ -294,5 +294,6 @@ "search_results_for": "सर्च परिणाम", "help": "मदत", "filter_and_highlights_help": "फिल्टर आणि हायलाइट्स सहाय्य", - "filter_and_highlights": "फिल्टर आणि हायलाइट्स" + "filter_and_highlights": "फिल्टर आणि हायलाइट्स", + "boards_you_moderate": "तुम्ही ज्यांचे नियंत्रण करता अशा बोर्ड्स" } \ No newline at end of file diff --git a/public/translations/nl/default.json b/public/translations/nl/default.json index 26ada5c2..d0d0f3cb 100644 --- a/public/translations/nl/default.json +++ b/public/translations/nl/default.json @@ -294,5 +294,6 @@ "search_results_for": "Zoekresultaten voor", "help": "Help", "filter_and_highlights_help": "Filters en Markeringen Help", - "filter_and_highlights": "Filters en markeringen" + "filter_and_highlights": "Filters en markeringen", + "boards_you_moderate": "boards die je beheert" } \ No newline at end of file diff --git a/public/translations/no/default.json b/public/translations/no/default.json index 49731889..2fbc0794 100644 --- a/public/translations/no/default.json +++ b/public/translations/no/default.json @@ -294,5 +294,6 @@ "search_results_for": "Søkeresultater for", "help": "Hjelp", "filter_and_highlights_help": "Filtre og fremhevinger Hjelp", - "filter_and_highlights": "Filtre og uthevinger" + "filter_and_highlights": "Filtre og uthevinger", + "boards_you_moderate": "boards du modererer" } \ No newline at end of file diff --git a/public/translations/pl/default.json b/public/translations/pl/default.json index d36af04c..ec963255 100644 --- a/public/translations/pl/default.json +++ b/public/translations/pl/default.json @@ -294,5 +294,6 @@ "search_results_for": "Wyniki wyszukiwania dla", "help": "Pomoc", "filter_and_highlights_help": "Pomoc dotycząca filtrów i wyróżnień", - "filter_and_highlights": "Filtry i wyróżnienia" + "filter_and_highlights": "Filtry i wyróżnienia", + "boards_you_moderate": "boards, które moderujesz" } \ No newline at end of file diff --git a/public/translations/pt/default.json b/public/translations/pt/default.json index 1c654fb6..230583d8 100644 --- a/public/translations/pt/default.json +++ b/public/translations/pt/default.json @@ -294,5 +294,6 @@ "search_results_for": "Resultados de pesquisa para", "help": "Ajuda", "filter_and_highlights_help": "Ajuda de Filtros e Realces", - "filter_and_highlights": "Filtros e Destaques" + "filter_and_highlights": "Filtros e Destaques", + "boards_you_moderate": "boards que você modera" } \ No newline at end of file diff --git a/public/translations/ro/default.json b/public/translations/ro/default.json index e1b0574b..d4add305 100644 --- a/public/translations/ro/default.json +++ b/public/translations/ro/default.json @@ -294,5 +294,6 @@ "search_results_for": "Rezultatele căutării pentru", "help": "Ajutor", "filter_and_highlights_help": "Ajutor pentru filtre și evidențieri", - "filter_and_highlights": "Filtre și evidențieri" + "filter_and_highlights": "Filtre și evidențieri", + "boards_you_moderate": "boards pe care le moderezi" } \ No newline at end of file diff --git a/public/translations/ru/default.json b/public/translations/ru/default.json index ea059ba3..b70e9a17 100644 --- a/public/translations/ru/default.json +++ b/public/translations/ru/default.json @@ -294,5 +294,6 @@ "search_results_for": "Результаты поиска для", "help": "Помощь", "filter_and_highlights_help": "Помощь с фильтрами и выделениями", - "filter_and_highlights": "Фильтры и выделения" + "filter_and_highlights": "Фильтры и выделения", + "boards_you_moderate": "boards, которые вы модерируете" } \ No newline at end of file diff --git a/public/translations/sq/default.json b/public/translations/sq/default.json index 8c02007b..b33080ab 100644 --- a/public/translations/sq/default.json +++ b/public/translations/sq/default.json @@ -294,5 +294,6 @@ "search_results_for": "Rezultatet e kërkimit për", "help": "Ndihmë", "filter_and_highlights_help": "Ndihma për Filtro & Thekso", - "filter_and_highlights": "Filtra dhe thekson" + "filter_and_highlights": "Filtra dhe thekson", + "boards_you_moderate": "boards që i moderoni" } \ No newline at end of file diff --git a/public/translations/sv/default.json b/public/translations/sv/default.json index bb113cf7..5a69c3d3 100644 --- a/public/translations/sv/default.json +++ b/public/translations/sv/default.json @@ -294,5 +294,6 @@ "search_results_for": "Sökresultat för", "help": "Hjälp", "filter_and_highlights_help": "Filter och markeringar Hjälp", - "filter_and_highlights": "Filter och markeringar" + "filter_and_highlights": "Filter och markeringar", + "boards_you_moderate": "boards du modererar" } \ No newline at end of file diff --git a/public/translations/te/default.json b/public/translations/te/default.json index 668cba68..11f9e583 100644 --- a/public/translations/te/default.json +++ b/public/translations/te/default.json @@ -294,5 +294,6 @@ "search_results_for": "శోధన ఫలితాలు", "help": "సహాయం", "filter_and_highlights_help": "ఫిల్టర్లు మరియు హైలైట్ సహాయం", - "filter_and_highlights": "ఫిల్టర్లు మరియు హైలైట్స్" + "filter_and_highlights": "ఫిల్టర్లు మరియు హైలైట్స్", + "boards_you_moderate": "మీరు మోడరేట్ చేసే బోర్డులు" } \ No newline at end of file diff --git a/public/translations/th/default.json b/public/translations/th/default.json index c448d395..803be4e7 100644 --- a/public/translations/th/default.json +++ b/public/translations/th/default.json @@ -294,5 +294,6 @@ "search_results_for": "ผลการค้นหาสำหรับ", "help": "ช่วยเหลือ", "filter_and_highlights_help": "ตัวกรองและการเน้นความช่วยเหลือ", - "filter_and_highlights": "ตัวกรองและไฮไลท์" + "filter_and_highlights": "ตัวกรองและไฮไลท์", + "boards_you_moderate": "บอร์ดที่คุณดูแล" } \ No newline at end of file diff --git a/public/translations/tr/default.json b/public/translations/tr/default.json index 3bee0dc2..b197ac77 100644 --- a/public/translations/tr/default.json +++ b/public/translations/tr/default.json @@ -294,5 +294,6 @@ "search_results_for": "Arama sonuçları için", "help": "Yardım", "filter_and_highlights_help": "Filtreler ve Vurgular Yardımı", - "filter_and_highlights": "Filtreler ve Vurgular" + "filter_and_highlights": "Filtreler ve Vurgular", + "boards_you_moderate": "modere ettiğiniz panolar" } \ No newline at end of file diff --git a/public/translations/uk/default.json b/public/translations/uk/default.json index 5399a654..7da2f5c7 100644 --- a/public/translations/uk/default.json +++ b/public/translations/uk/default.json @@ -294,5 +294,6 @@ "search_results_for": "Результати пошуку для", "help": "Допомога", "filter_and_highlights_help": "Допомога з фільтрами та підсвічуваннями", - "filter_and_highlights": "Фільтри та виділення" + "filter_and_highlights": "Фільтри та виділення", + "boards_you_moderate": "boards, які ви модеруватимете" } \ No newline at end of file diff --git a/public/translations/ur/default.json b/public/translations/ur/default.json index 1475621b..54f20b41 100644 --- a/public/translations/ur/default.json +++ b/public/translations/ur/default.json @@ -294,5 +294,6 @@ "search_results_for": "تلاش کے نتائج", "help": "مدد", "filter_and_highlights_help": "فلٹرز اور ہائی لائٹس کی مدد", - "filter_and_highlights": "فلٹرز اور ہائلाइटس" + "filter_and_highlights": "فلٹرز اور ہائلाइटس", + "boards_you_moderate": "وہ بورڈز جن کی آپ نگرانی کرتے ہیں" } \ No newline at end of file diff --git a/public/translations/vi/default.json b/public/translations/vi/default.json index 492d50fa..52b4e0a1 100644 --- a/public/translations/vi/default.json +++ b/public/translations/vi/default.json @@ -294,5 +294,6 @@ "search_results_for": "Kết quả tìm kiếm cho", "help": "Trợ giúp", "filter_and_highlights_help": "Trợ giúp bộ lọc và đánh dấu", - "filter_and_highlights": "Bộ lọc và Nổi bật" + "filter_and_highlights": "Bộ lọc và Nổi bật", + "boards_you_moderate": "boards bạn điều hành" } \ No newline at end of file diff --git a/public/translations/zh/default.json b/public/translations/zh/default.json index 9b8591d3..d776cf13 100644 --- a/public/translations/zh/default.json +++ b/public/translations/zh/default.json @@ -294,5 +294,6 @@ "search_results_for": "搜索结果", "help": "帮助", "filter_and_highlights_help": "过滤器和高亮帮助", - "filter_and_highlights": "筛选器与高亮" + "filter_and_highlights": "筛选器与高亮", + "boards_you_moderate": "您管理的板块" } \ No newline at end of file diff --git a/src/app.tsx b/src/app.tsx index b3810f16..f79c018a 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'; import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom'; import { useAccountComment } from '@plebbit/plebbit-react-hooks'; import { initSnow, removeSnow } from './lib/snow'; -import { isAllView, isSubscriptionsView } from './lib/utils/view-utils'; +import { isAllView, isModView, isSubscriptionsView } from './lib/utils/view-utils'; import useReplyModalStore from './stores/use-reply-modal-store'; import useSpecialThemeStore from './stores/use-special-theme-store'; import useIsMobile from './hooks/use-is-mobile'; @@ -30,6 +30,7 @@ const BoardLayout = () => { const isMobile = useIsMobile(); const isInAllView = isAllView(location.pathname); const isInSubscriptionsView = isSubscriptionsView(location.pathname, useParams()); + const isInModView = isModView(location.pathname); const pendingPost = useAccountComment({ commentIndex: accountCommentIndex ? parseInt(accountCommentIndex) : undefined }); // Christmas theme @@ -53,17 +54,17 @@ const BoardLayout = () => { {isMobile - ? (subplebbitAddress || isInAllView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && ( + ? (subplebbitAddress || isInAllView || isInModView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && ( <>
) - : (subplebbitAddress || isInAllView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && ( + : (subplebbitAddress || isInAllView || isInModView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && ( <> - {!(isInAllView || isInSubscriptionsView) && } + {!(isInAllView || isInSubscriptionsView || isInModView) && } )} diff --git a/src/components/board-header/board-header.tsx b/src/components/board-header/board-header.tsx index c9372328..d2abb9e6 100644 --- a/src/components/board-header/board-header.tsx +++ b/src/components/board-header/board-header.tsx @@ -1,4 +1,5 @@ import { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { useLocation, useParams } from 'react-router-dom'; import { useAccountComment } from '@plebbit/plebbit-react-hooks'; import Plebbit from '@plebbit/plebbit-js'; @@ -10,6 +11,7 @@ import useIsMobile from '../../hooks/use-is-mobile'; import useIsSubplebbitOffline from '../../hooks/use-is-subplebbit-offline'; import { shouldShowSnow } from '../../lib/snow'; import Tooltip from '../tooltip'; +import _ from 'lodash'; const totalBanners = 63; @@ -23,6 +25,7 @@ const ImageBanner = () => { }; const BoardHeader = () => { + const { t } = useTranslation(); const location = useLocation(); const params = useParams(); const isInAllView = isAllView(location.pathname); @@ -36,7 +39,13 @@ const BoardHeader = () => { const { address, shortAddress } = subplebbit || {}; const multisubMetadata = useMultisubMetadata(); - const title = isInAllView ? multisubMetadata?.title || 'all' : isInSubscriptionsView ? 'Subscriptions' : isInModView ? 'Mod' : subplebbit?.title; + const title = isInAllView + ? multisubMetadata?.title || 'all' + : isInSubscriptionsView + ? 'Subscriptions' + : isInModView + ? _.startCase(t('boards_you_moderate')) + : subplebbit?.title; const subtitle = isInAllView ? 'p/all' : isInSubscriptionsView ? 'p/subscriptions' : isInModView ? 'p/mod' : `p/${address}`; const { isOffline, isOnlineStatusLoading, offlineIconClass, offlineTitle } = useIsSubplebbitOffline(subplebbit); diff --git a/src/components/post-form/post-form.tsx b/src/components/post-form/post-form.tsx index 1d107805..f66352a8 100644 --- a/src/components/post-form/post-form.tsx +++ b/src/components/post-form/post-form.tsx @@ -1,13 +1,14 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useLocation, useNavigate, useParams } from 'react-router-dom'; -import { Comment, setAccount, useAccount, useAccountComment, useEditedComment } from '@plebbit/plebbit-react-hooks'; +import { Comment, setAccount, useAccount, useAccountComment, useAccountSubplebbits, useEditedComment } from '@plebbit/plebbit-react-hooks'; +import Plebbit from '@plebbit/plebbit-js'; import useSubplebbitsStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits'; import useSubplebbitsPagesStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits-pages'; import { getHasThumbnail, getLinkMediaInfo } from '../../lib/utils/media-utils'; import { formatMarkdown } from '../../lib/utils/post-utils'; import { isValidURL } from '../../lib/utils/url-utils'; -import { isAllView, isDescriptionView, isPostPageView, isRulesView, isSubscriptionsView } from '../../lib/utils/view-utils'; +import { isAllView, isDescriptionView, isModView, isPostPageView, isRulesView, isSubscriptionsView } from '../../lib/utils/view-utils'; import useAnonMode from '../../hooks/use-anon-mode'; import { useDefaultSubplebbitAddresses } from '../../hooks/use-default-subplebbits'; import useFetchGifFirstFrame from '../../hooks/use-fetch-gif-first-frame'; @@ -53,10 +54,14 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid: const location = useLocation(); const isInAllView = isAllView(location.pathname); + const isInModView = isModView(location.pathname); const isInSubscriptionsView = isSubscriptionsView(location.pathname, useParams()); const subscriptions = account?.subscriptions || []; const defaultSubplebbitAddresses = useDefaultSubplebbitAddresses(); + const { accountSubplebbits } = useAccountSubplebbits(); + const accountSubplebbitAddresses = Object.keys(accountSubplebbits); + const { anonMode, getNewSigner, getExistingSigner } = useAnonMode(postCid); const comment = useSubplebbitsPagesStore((state) => state.comments[postCid]); const address = comment?.author?.address; @@ -129,7 +134,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid: return; } - if ((isInAllView || isInSubscriptionsView) && !publishPostOptions.subplebbitAddress) { + if ((isInAllView || isInSubscriptionsView || isInModView) && !publishPostOptions.subplebbitAddress) { alert(t('no_board_selected_warning')); return; } @@ -394,7 +399,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid: ] - {(isInAllView || isInSubscriptionsView) && ( + {(isInAllView || isInSubscriptionsView || isInModView) && ( {t('board')} @@ -403,7 +408,13 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid: {isInAllView && defaultSubplebbitAddresses.map((address: string) => ( + ))} + {isInModView && + accountSubplebbitAddresses.map((address: string) => ( + ))} {isInSubscriptionsView && @@ -429,6 +440,7 @@ const PostForm = () => { const isInPostView = isPostPageView(location.pathname, params); const isInRulesView = isRulesView(location.pathname, params); const isInAllView = isAllView(location.pathname); + const isInModView = isModView(location.pathname); const isInSubscriptionsView = isSubscriptionsView(location.pathname, params); const commentCid = params?.commentCid; @@ -453,7 +465,9 @@ const PostForm = () => { return ( <>
- {!(isInAllView || isInSubscriptionsView) && showForm && (isOffline || isOnlineStatusLoading) &&
{offlineTitle}
} + {!(isInAllView || isInSubscriptionsView || isInModView) && showForm && (isOffline || isOnlineStatusLoading) && ( +
{offlineTitle}
+ )} {isThreadClosed ? (
{t('thread_closed')} @@ -473,7 +487,9 @@ const PostForm = () => { )}
- {!(isInAllView || isInSubscriptionsView) && showForm && (isOffline || isOnlineStatusLoading) &&
{offlineTitle}
} + {!(isInAllView || isInSubscriptionsView || isInModView) && showForm && (isOffline || isOnlineStatusLoading) && ( +
{offlineTitle}
+ )} {isThreadClosed ? (
{t('thread_closed')} diff --git a/src/views/catalog/catalog.tsx b/src/views/catalog/catalog.tsx index b86487d8..d3b710a3 100644 --- a/src/views/catalog/catalog.tsx +++ b/src/views/catalog/catalog.tsx @@ -148,15 +148,17 @@ const Catalog = () => { } return true; }) - .map((subplebbit) => subplebbit.address); + .map((subplebbit) => subplebbit.address) + .filter(Boolean); // Filter out any undefined/null values if (isInAllView) { return filteredDefaultSubplebbits; } if (isInSubscriptionsView) { - return subscriptions || []; + return (subscriptions || []).filter(Boolean); // Filter out any undefined/null values } - return [subplebbitAddress]; + // Only include subplebbitAddress if it's defined + return subplebbitAddress ? [subplebbitAddress] : []; }, [isInAllView, isInSubscriptionsView, subplebbitAddress, defaultSubplebbits, subscriptions, hideAdultBoards, hideGoreBoards]); const { imageSize } = useCatalogStyleStore();