fix(mod multisub): mod page was missing post form

This commit is contained in:
Tom (plebeius.eth)
2025-06-04 16:37:17 +02:00
parent 6075b2ebf7
commit 339a9bc18a
39 changed files with 114 additions and 50 deletions
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "نتائج البحث عن", "search_results_for": "نتائج البحث عن",
"help": "مساعدة", "help": "مساعدة",
"filter_and_highlights_help": "مساعدة الفلاتر والإبرازات", "filter_and_highlights_help": "مساعدة الفلاتر والإبرازات",
"filter_and_highlights": "التصفية والتسليط الضوء" "filter_and_highlights": "التصفية والتسليط الضوء",
"boards_you_moderate": "المنتديات التي تقوم بالإشراف عليها"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "অনুসন্ধান ফলাফল", "search_results_for": "অনুসন্ধান ফলাফল",
"help": "সাহায্য", "help": "সাহায্য",
"filter_and_highlights_help": "ফিল্টার এবং হাইলাইট সাহায্য", "filter_and_highlights_help": "ফিল্টার এবং হাইলাইট সাহায্য",
"filter_and_highlights": "ফিল্টার এবং হাইলাইট" "filter_and_highlights": "ফিল্টার এবং হাইলাইট",
"boards_you_moderate": "আপনি যে বোর্ডগুলি পরিচালনা করেন"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Výsledky hledání pro", "search_results_for": "Výsledky hledání pro",
"help": "Pomoc", "help": "Pomoc",
"filter_and_highlights_help": "Pomoc s filtry a zvýrazněním", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Søgeresultater for", "search_results_for": "Søgeresultater for",
"help": "Hjælp", "help": "Hjælp",
"filter_and_highlights_help": "Filtre og fremhævelser 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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Suchergebnisse für", "search_results_for": "Suchergebnisse für",
"help": "Hilfe", "help": "Hilfe",
"filter_and_highlights_help": "Filter- und Markierungs-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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Αποτελέσματα αναζήτησης για", "search_results_for": "Αποτελέσματα αναζήτησης για",
"help": "Βοήθεια", "help": "Βοήθεια",
"filter_and_highlights_help": "Βοήθεια φίλτρων και επισήμανσης", "filter_and_highlights_help": "Βοήθεια φίλτρων και επισήμανσης",
"filter_and_highlights": "Φίλτρα και Επισημάνσεις" "filter_and_highlights": "Φίλτρα και Επισημάνσεις",
"boards_you_moderate": "Boards που διαχειρίζεστε"
} }
+3 -1
View File
@@ -141,6 +141,7 @@
"user_deleted_this_post": "User deleted this post.", "user_deleted_this_post": "User deleted this post.",
"reason": "reason", "reason": "reason",
"search": "search", "search": "search",
"search_ops_placeholder": "Search OPs...",
"ban_user_for": "Ban user for <1></1> days", "ban_user_for": "Ban user for <1></1> days",
"optional": "optional", "optional": "optional",
"close_thread": "close thread", "close_thread": "close thread",
@@ -294,5 +295,6 @@
"search_results_for": "Search results for", "search_results_for": "Search results for",
"help": "Help", "help": "Help",
"filter_and_highlights_help": "Filters & Highlights Help", "filter_and_highlights_help": "Filters & Highlights Help",
"filter_and_highlights": "Filters & Highlights" "filter_and_highlights": "Filters & Highlights",
"boards_you_moderate": "boards you moderate"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Resultados de búsqueda para", "search_results_for": "Resultados de búsqueda para",
"help": "Ayuda", "help": "Ayuda",
"filter_and_highlights_help": "Ayuda de filtros y resaltes", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "نتایج جستجو برای", "search_results_for": "نتایج جستجو برای",
"help": "کمک", "help": "کمک",
"filter_and_highlights_help": "کمک فیلترها و برجسته‌ها", "filter_and_highlights_help": "کمک فیلترها و برجسته‌ها",
"filter_and_highlights": "فیلترها و برجسته‌ها" "filter_and_highlights": "فیلترها و برجسته‌ها",
"boards_you_moderate": "تابلوهایی که مدیریت می‌کنید"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Hakutulokset hakusanalle", "search_results_for": "Hakutulokset hakusanalle",
"help": "Apua", "help": "Apua",
"filter_and_highlights_help": "Suodattimet ja korostukset -apu", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Mga resulta ng paghahanap para sa", "search_results_for": "Mga resulta ng paghahanap para sa",
"help": "Tulong", "help": "Tulong",
"filter_and_highlights_help": "Tulong sa mga filter at highlight", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Résultats de recherche pour", "search_results_for": "Résultats de recherche pour",
"help": "Aide", "help": "Aide",
"filter_and_highlights_help": "Aide sur les filtres et surlignages", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "תוצאות חיפוש עבור", "search_results_for": "תוצאות חיפוש עבור",
"help": "עזרה", "help": "עזרה",
"filter_and_highlights_help": "עזרה במסננים והדגשות", "filter_and_highlights_help": "עזרה במסננים והדגשות",
"filter_and_highlights": "מסננים והדגשות" "filter_and_highlights": "מסננים והדגשות",
"boards_you_moderate": "לוחות שאתה מפקח עליהם"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "के लिए खोज परिणाम", "search_results_for": "के लिए खोज परिणाम",
"help": "मदद", "help": "मदद",
"filter_and_highlights_help": "फ़िल्टर और हाइलाइट्स सहायता", "filter_and_highlights_help": "फ़िल्टर और हाइलाइट्स सहायता",
"filter_and_highlights": "फ़िल्टर और हाइलाइट्स" "filter_and_highlights": "फ़िल्टर और हाइलाइट्स",
"boards_you_moderate": "बोर्ड जो आप मॉडरेट करते हैं"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Keresési eredmények", "search_results_for": "Keresési eredmények",
"help": "Segítség", "help": "Segítség",
"filter_and_highlights_help": "Szűrők és kiemelések sú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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Hasil pencarian untuk", "search_results_for": "Hasil pencarian untuk",
"help": "Bantuan", "help": "Bantuan",
"filter_and_highlights_help": "Bantuan Filter dan Sorotan", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Risultati di ricerca per", "search_results_for": "Risultati di ricerca per",
"help": "Aiuto", "help": "Aiuto",
"filter_and_highlights_help": "Aiuto su Filtri e Evidenziazioni", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "検索結果", "search_results_for": "検索結果",
"help": "ヘルプ", "help": "ヘルプ",
"filter_and_highlights_help": "フィルターとハイライトのヘルプ", "filter_and_highlights_help": "フィルターとハイライトのヘルプ",
"filter_and_highlights": "フィルターとハイライト" "filter_and_highlights": "フィルターとハイライト",
"boards_you_moderate": "あなたが管理するボード"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "검색 결과", "search_results_for": "검색 결과",
"help": "도움말", "help": "도움말",
"filter_and_highlights_help": "필터 및 하이라이트 도움말", "filter_and_highlights_help": "필터 및 하이라이트 도움말",
"filter_and_highlights": "필터 및 하이라이트" "filter_and_highlights": "필터 및 하이라이트",
"boards_you_moderate": "당신이 관리하는 게시판"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "सर्च परिणाम", "search_results_for": "सर्च परिणाम",
"help": "मदत", "help": "मदत",
"filter_and_highlights_help": "फिल्टर आणि हायलाइट्स सहाय्य", "filter_and_highlights_help": "फिल्टर आणि हायलाइट्स सहाय्य",
"filter_and_highlights": "फिल्टर आणि हायलाइट्स" "filter_and_highlights": "फिल्टर आणि हायलाइट्स",
"boards_you_moderate": "तुम्ही ज्यांचे नियंत्रण करता अशा बोर्ड्स"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Zoekresultaten voor", "search_results_for": "Zoekresultaten voor",
"help": "Help", "help": "Help",
"filter_and_highlights_help": "Filters en Markeringen 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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Søkeresultater for", "search_results_for": "Søkeresultater for",
"help": "Hjelp", "help": "Hjelp",
"filter_and_highlights_help": "Filtre og fremhevinger 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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Wyniki wyszukiwania dla", "search_results_for": "Wyniki wyszukiwania dla",
"help": "Pomoc", "help": "Pomoc",
"filter_and_highlights_help": "Pomoc dotycząca filtrów i wyróżnień", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Resultados de pesquisa para", "search_results_for": "Resultados de pesquisa para",
"help": "Ajuda", "help": "Ajuda",
"filter_and_highlights_help": "Ajuda de Filtros e Realces", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Rezultatele căutării pentru", "search_results_for": "Rezultatele căutării pentru",
"help": "Ajutor", "help": "Ajutor",
"filter_and_highlights_help": "Ajutor pentru filtre și evidențieri", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Результаты поиска для", "search_results_for": "Результаты поиска для",
"help": "Помощь", "help": "Помощь",
"filter_and_highlights_help": "Помощь с фильтрами и выделениями", "filter_and_highlights_help": "Помощь с фильтрами и выделениями",
"filter_and_highlights": "Фильтры и выделения" "filter_and_highlights": "Фильтры и выделения",
"boards_you_moderate": "boards, которые вы модерируете"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Rezultatet e kërkimit për", "search_results_for": "Rezultatet e kërkimit për",
"help": "Ndihmë", "help": "Ndihmë",
"filter_and_highlights_help": "Ndihma për Filtro & Thekso", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Sökresultat för", "search_results_for": "Sökresultat för",
"help": "Hjälp", "help": "Hjälp",
"filter_and_highlights_help": "Filter och markeringar 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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "శోధన ఫలితాలు", "search_results_for": "శోధన ఫలితాలు",
"help": "సహాయం", "help": "సహాయం",
"filter_and_highlights_help": "ఫిల్టర్లు మరియు హైలైట్ సహాయం", "filter_and_highlights_help": "ఫిల్టర్లు మరియు హైలైట్ సహాయం",
"filter_and_highlights": "ఫిల్టర్లు మరియు హైలైట్స్" "filter_and_highlights": "ఫిల్టర్లు మరియు హైలైట్స్",
"boards_you_moderate": "మీరు మోడరేట్ చేసే బోర్డులు"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "ผลการค้นหาสำหรับ", "search_results_for": "ผลการค้นหาสำหรับ",
"help": "ช่วยเหลือ", "help": "ช่วยเหลือ",
"filter_and_highlights_help": "ตัวกรองและการเน้นความช่วยเหลือ", "filter_and_highlights_help": "ตัวกรองและการเน้นความช่วยเหลือ",
"filter_and_highlights": "ตัวกรองและไฮไลท์" "filter_and_highlights": "ตัวกรองและไฮไลท์",
"boards_you_moderate": "บอร์ดที่คุณดูแล"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Arama sonuçları için", "search_results_for": "Arama sonuçları için",
"help": "Yardım", "help": "Yardım",
"filter_and_highlights_help": "Filtreler ve Vurgular 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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Результати пошуку для", "search_results_for": "Результати пошуку для",
"help": "Допомога", "help": "Допомога",
"filter_and_highlights_help": "Допомога з фільтрами та підсвічуваннями", "filter_and_highlights_help": "Допомога з фільтрами та підсвічуваннями",
"filter_and_highlights": "Фільтри та виділення" "filter_and_highlights": "Фільтри та виділення",
"boards_you_moderate": "boards, які ви модеруватимете"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "تلاش کے نتائج", "search_results_for": "تلاش کے نتائج",
"help": "مدد", "help": "مدد",
"filter_and_highlights_help": "فلٹرز اور ہائی لائٹس کی مدد", "filter_and_highlights_help": "فلٹرز اور ہائی لائٹس کی مدد",
"filter_and_highlights": "فلٹرز اور ہائلाइटس" "filter_and_highlights": "فلٹرز اور ہائلाइटس",
"boards_you_moderate": "وہ بورڈز جن کی آپ نگرانی کرتے ہیں"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "Kết quả tìm kiếm cho", "search_results_for": "Kết quả tìm kiếm cho",
"help": "Trợ giúp", "help": "Trợ giúp",
"filter_and_highlights_help": "Trợ giúp bộ lọc và đánh dấu", "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"
} }
+2 -1
View File
@@ -294,5 +294,6 @@
"search_results_for": "搜索结果", "search_results_for": "搜索结果",
"help": "帮助", "help": "帮助",
"filter_and_highlights_help": "过滤器和高亮帮助", "filter_and_highlights_help": "过滤器和高亮帮助",
"filter_and_highlights": "筛选器与高亮" "filter_and_highlights": "筛选器与高亮",
"boards_you_moderate": "您管理的板块"
} }
+5 -4
View File
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom'; import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { useAccountComment } from '@plebbit/plebbit-react-hooks'; import { useAccountComment } from '@plebbit/plebbit-react-hooks';
import { initSnow, removeSnow } from './lib/snow'; 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 useReplyModalStore from './stores/use-reply-modal-store';
import useSpecialThemeStore from './stores/use-special-theme-store'; import useSpecialThemeStore from './stores/use-special-theme-store';
import useIsMobile from './hooks/use-is-mobile'; import useIsMobile from './hooks/use-is-mobile';
@@ -30,6 +30,7 @@ const BoardLayout = () => {
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const isInAllView = isAllView(location.pathname); const isInAllView = isAllView(location.pathname);
const isInSubscriptionsView = isSubscriptionsView(location.pathname, useParams()); const isInSubscriptionsView = isSubscriptionsView(location.pathname, useParams());
const isInModView = isModView(location.pathname);
const pendingPost = useAccountComment({ commentIndex: accountCommentIndex ? parseInt(accountCommentIndex) : undefined }); const pendingPost = useAccountComment({ commentIndex: accountCommentIndex ? parseInt(accountCommentIndex) : undefined });
// Christmas theme // Christmas theme
@@ -53,17 +54,17 @@ const BoardLayout = () => {
<TopBar /> <TopBar />
<BoardHeader /> <BoardHeader />
{isMobile {isMobile
? (subplebbitAddress || isInAllView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && ( ? (subplebbitAddress || isInAllView || isInModView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && (
<> <>
<PostForm key={key} /> <PostForm key={key} />
<hr /> <hr />
<MobileBoardButtons /> <MobileBoardButtons />
</> </>
) )
: (subplebbitAddress || isInAllView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && ( : (subplebbitAddress || isInAllView || isInModView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && (
<> <>
<PostForm key={key} /> <PostForm key={key} />
{!(isInAllView || isInSubscriptionsView) && <SubplebbitStats />} {!(isInAllView || isInSubscriptionsView || isInModView) && <SubplebbitStats />}
<DesktopBoardButtons /> <DesktopBoardButtons />
</> </>
)} )}
+10 -1
View File
@@ -1,4 +1,5 @@
import { useState } from 'react'; import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useLocation, useParams } from 'react-router-dom'; import { useLocation, useParams } from 'react-router-dom';
import { useAccountComment } from '@plebbit/plebbit-react-hooks'; import { useAccountComment } from '@plebbit/plebbit-react-hooks';
import Plebbit from '@plebbit/plebbit-js'; 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 useIsSubplebbitOffline from '../../hooks/use-is-subplebbit-offline';
import { shouldShowSnow } from '../../lib/snow'; import { shouldShowSnow } from '../../lib/snow';
import Tooltip from '../tooltip'; import Tooltip from '../tooltip';
import _ from 'lodash';
const totalBanners = 63; const totalBanners = 63;
@@ -23,6 +25,7 @@ const ImageBanner = () => {
}; };
const BoardHeader = () => { const BoardHeader = () => {
const { t } = useTranslation();
const location = useLocation(); const location = useLocation();
const params = useParams(); const params = useParams();
const isInAllView = isAllView(location.pathname); const isInAllView = isAllView(location.pathname);
@@ -36,7 +39,13 @@ const BoardHeader = () => {
const { address, shortAddress } = subplebbit || {}; const { address, shortAddress } = subplebbit || {};
const multisubMetadata = useMultisubMetadata(); 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 subtitle = isInAllView ? 'p/all' : isInSubscriptionsView ? 'p/subscriptions' : isInModView ? 'p/mod' : `p/${address}`;
const { isOffline, isOnlineStatusLoading, offlineIconClass, offlineTitle } = useIsSubplebbitOffline(subplebbit); const { isOffline, isOnlineStatusLoading, offlineIconClass, offlineTitle } = useIsSubplebbitOffline(subplebbit);
+23 -7
View File
@@ -1,13 +1,14 @@
import { useCallback, useEffect, useRef, useState } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate, useParams } from 'react-router-dom'; 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 useSubplebbitsStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits';
import useSubplebbitsPagesStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits-pages'; import useSubplebbitsPagesStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits-pages';
import { getHasThumbnail, getLinkMediaInfo } from '../../lib/utils/media-utils'; import { getHasThumbnail, getLinkMediaInfo } from '../../lib/utils/media-utils';
import { formatMarkdown } from '../../lib/utils/post-utils'; import { formatMarkdown } from '../../lib/utils/post-utils';
import { isValidURL } from '../../lib/utils/url-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 useAnonMode from '../../hooks/use-anon-mode';
import { useDefaultSubplebbitAddresses } from '../../hooks/use-default-subplebbits'; import { useDefaultSubplebbitAddresses } from '../../hooks/use-default-subplebbits';
import useFetchGifFirstFrame from '../../hooks/use-fetch-gif-first-frame'; import useFetchGifFirstFrame from '../../hooks/use-fetch-gif-first-frame';
@@ -53,10 +54,14 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
const location = useLocation(); const location = useLocation();
const isInAllView = isAllView(location.pathname); const isInAllView = isAllView(location.pathname);
const isInModView = isModView(location.pathname);
const isInSubscriptionsView = isSubscriptionsView(location.pathname, useParams()); const isInSubscriptionsView = isSubscriptionsView(location.pathname, useParams());
const subscriptions = account?.subscriptions || []; const subscriptions = account?.subscriptions || [];
const defaultSubplebbitAddresses = useDefaultSubplebbitAddresses(); const defaultSubplebbitAddresses = useDefaultSubplebbitAddresses();
const { accountSubplebbits } = useAccountSubplebbits();
const accountSubplebbitAddresses = Object.keys(accountSubplebbits);
const { anonMode, getNewSigner, getExistingSigner } = useAnonMode(postCid); const { anonMode, getNewSigner, getExistingSigner } = useAnonMode(postCid);
const comment = useSubplebbitsPagesStore((state) => state.comments[postCid]); const comment = useSubplebbitsPagesStore((state) => state.comments[postCid]);
const address = comment?.author?.address; const address = comment?.author?.address;
@@ -129,7 +134,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
return; return;
} }
if ((isInAllView || isInSubscriptionsView) && !publishPostOptions.subplebbitAddress) { if ((isInAllView || isInSubscriptionsView || isInModView) && !publishPostOptions.subplebbitAddress) {
alert(t('no_board_selected_warning')); alert(t('no_board_selected_warning'));
return; return;
} }
@@ -394,7 +399,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
] ]
</td> </td>
</tr> </tr>
{(isInAllView || isInSubscriptionsView) && ( {(isInAllView || isInSubscriptionsView || isInModView) && (
<tr> <tr>
<td>{t('board')}</td> <td>{t('board')}</td>
<td> <td>
@@ -403,7 +408,13 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
{isInAllView && {isInAllView &&
defaultSubplebbitAddresses.map((address: string) => ( defaultSubplebbitAddresses.map((address: string) => (
<option key={address} value={address}> <option key={address} value={address}>
{address} {address && Plebbit.getShortAddress(address)}
</option>
))}
{isInModView &&
accountSubplebbitAddresses.map((address: string) => (
<option key={address} value={address}>
{address && Plebbit.getShortAddress(address)}
</option> </option>
))} ))}
{isInSubscriptionsView && {isInSubscriptionsView &&
@@ -429,6 +440,7 @@ const PostForm = () => {
const isInPostView = isPostPageView(location.pathname, params); const isInPostView = isPostPageView(location.pathname, params);
const isInRulesView = isRulesView(location.pathname, params); const isInRulesView = isRulesView(location.pathname, params);
const isInAllView = isAllView(location.pathname); const isInAllView = isAllView(location.pathname);
const isInModView = isModView(location.pathname);
const isInSubscriptionsView = isSubscriptionsView(location.pathname, params); const isInSubscriptionsView = isSubscriptionsView(location.pathname, params);
const commentCid = params?.commentCid; const commentCid = params?.commentCid;
@@ -453,7 +465,9 @@ const PostForm = () => {
return ( return (
<> <>
<div className={styles.postFormDesktop}> <div className={styles.postFormDesktop}>
{!(isInAllView || isInSubscriptionsView) && showForm && (isOffline || isOnlineStatusLoading) && <div className={styles.offlineBoard}>{offlineTitle}</div>} {!(isInAllView || isInSubscriptionsView || isInModView) && showForm && (isOffline || isOnlineStatusLoading) && (
<div className={styles.offlineBoard}>{offlineTitle}</div>
)}
{isThreadClosed ? ( {isThreadClosed ? (
<div className={styles.closed}> <div className={styles.closed}>
{t('thread_closed')} {t('thread_closed')}
@@ -473,7 +487,9 @@ const PostForm = () => {
)} )}
</div> </div>
<div className={styles.postFormMobile}> <div className={styles.postFormMobile}>
{!(isInAllView || isInSubscriptionsView) && showForm && (isOffline || isOnlineStatusLoading) && <div className={styles.offlineBoard}>{offlineTitle}</div>} {!(isInAllView || isInSubscriptionsView || isInModView) && showForm && (isOffline || isOnlineStatusLoading) && (
<div className={styles.offlineBoard}>{offlineTitle}</div>
)}
{isThreadClosed ? ( {isThreadClosed ? (
<div className={styles.closed}> <div className={styles.closed}>
{t('thread_closed')} {t('thread_closed')}
+5 -3
View File
@@ -148,15 +148,17 @@ const Catalog = () => {
} }
return true; return true;
}) })
.map((subplebbit) => subplebbit.address); .map((subplebbit) => subplebbit.address)
.filter(Boolean); // Filter out any undefined/null values
if (isInAllView) { if (isInAllView) {
return filteredDefaultSubplebbits; return filteredDefaultSubplebbits;
} }
if (isInSubscriptionsView) { 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]); }, [isInAllView, isInSubscriptionsView, subplebbitAddress, defaultSubplebbits, subscriptions, hideAdultBoards, hideGoreBoards]);
const { imageSize } = useCatalogStyleStore(); const { imageSize } = useCatalogStyleStore();