diff --git a/public/translations/ar/default.json b/public/translations/ar/default.json index e657ac86..225b392c 100644 --- a/public/translations/ar/default.json +++ b/public/translations/ar/default.json @@ -41,5 +41,7 @@ "view_thread": "عرض الموضوع", "return": "العودة", "bottom": "القاع", - "top": "أعلى" + "top": "أعلى", + "thread_closed": "تم إغلاق الموضوع.", + "may_not_reply": "قد لا تتم الرد في هذا الوقت." } \ No newline at end of file diff --git a/public/translations/bn/default.json b/public/translations/bn/default.json index 6049073d..2c536702 100644 --- a/public/translations/bn/default.json +++ b/public/translations/bn/default.json @@ -41,5 +41,7 @@ "view_thread": "থ্রেড দেখুন", "return": "ফিরে যাও", "bottom": "নীচে", - "top": "শীর্ষ" + "top": "শীর্ষ", + "thread_closed": "থ্রেড বন্ধ হয়েছে।", + "may_not_reply": "এই সময়ে আপনি প্রতিক্রিয়া দিতে পারবেন না।" } \ No newline at end of file diff --git a/public/translations/cs/default.json b/public/translations/cs/default.json index bff7b61e..aa4aba26 100644 --- a/public/translations/cs/default.json +++ b/public/translations/cs/default.json @@ -41,5 +41,7 @@ "view_thread": "Zobrazit Vlákno", "return": "Návrat", "bottom": "Dno", - "top": "Nahoře" + "top": "Nahoře", + "thread_closed": "Vlákno uzavřeno.", + "may_not_reply": "V tuto chvíli nemůžete odpovědět." } \ No newline at end of file diff --git a/public/translations/da/default.json b/public/translations/da/default.json index e7bed500..d938740e 100644 --- a/public/translations/da/default.json +++ b/public/translations/da/default.json @@ -41,5 +41,7 @@ "view_thread": "Vis Tråd", "return": "Vende tilbage", "bottom": "Bund", - "top": "Top" + "top": "Top", + "thread_closed": "Tråd lukket.", + "may_not_reply": "Du kan muligvis ikke svare på dette tidspunkt." } \ No newline at end of file diff --git a/public/translations/de/default.json b/public/translations/de/default.json index bc4d8b25..758da2a8 100644 --- a/public/translations/de/default.json +++ b/public/translations/de/default.json @@ -41,5 +41,7 @@ "view_thread": "Thread Anzeigen", "return": "Zurück", "bottom": "Unten", - "top": "Oben" + "top": "Oben", + "thread_closed": "Thread geschlossen.", + "may_not_reply": "Sie können möglicherweise zu diesem Zeitpunkt nicht antworten." } \ No newline at end of file diff --git a/public/translations/el/default.json b/public/translations/el/default.json index 29f4b050..c12d8315 100644 --- a/public/translations/el/default.json +++ b/public/translations/el/default.json @@ -41,5 +41,7 @@ "view_thread": "Προβολή Νήματος", "return": "Επιστροφή", "bottom": "Κάτω", - "top": "Κορυφή" + "top": "Κορυφή", + "thread_closed": "Το νήμα έκλεισε.", + "may_not_reply": "Μπορεί να μην μπορείτε να απαντήσετε αυτή τη στιγμή." } \ No newline at end of file diff --git a/public/translations/en/default.json b/public/translations/en/default.json index fa77a86f..aa86c8e3 100644 --- a/public/translations/en/default.json +++ b/public/translations/en/default.json @@ -41,5 +41,7 @@ "view_thread": "View Thread", "return": "Return", "bottom": "Bottom", - "top": "Top" + "top": "Top", + "thread_closed": "Thread closed.", + "may_not_reply": "You may not reply at this time." } \ No newline at end of file diff --git a/public/translations/es/default.json b/public/translations/es/default.json index c61c2e18..f7194152 100644 --- a/public/translations/es/default.json +++ b/public/translations/es/default.json @@ -41,5 +41,7 @@ "view_thread": "Ver Hilo", "return": "Regresar", "bottom": "Fondo", - "top": "Arriba" + "top": "Arriba", + "thread_closed": "Hilo cerrado.", + "may_not_reply": "Es posible que no puedas responder en este momento." } \ No newline at end of file diff --git a/public/translations/fa/default.json b/public/translations/fa/default.json index 5a3b2a27..bee44ae5 100644 --- a/public/translations/fa/default.json +++ b/public/translations/fa/default.json @@ -41,5 +41,7 @@ "view_thread": "مشاهده نخ", "return": "برگشت", "bottom": "پایین", - "top": "بالا" + "top": "بالا", + "thread_closed": "موضوع بسته شده است.", + "may_not_reply": "شما ممکن است در این زمان پاسخ ندهید." } \ No newline at end of file diff --git a/public/translations/fi/default.json b/public/translations/fi/default.json index 6bb570f7..325d2bcf 100644 --- a/public/translations/fi/default.json +++ b/public/translations/fi/default.json @@ -41,5 +41,7 @@ "view_thread": "Näytä Ketju", "return": "Palata", "bottom": "Pohja", - "top": "Ylös" + "top": "Ylös", + "thread_closed": "Keskustelu suljettu.", + "may_not_reply": "Et ehkä voi vastata tällä hetkellä." } \ No newline at end of file diff --git a/public/translations/fil/default.json b/public/translations/fil/default.json index cf601990..c66a66ab 100644 --- a/public/translations/fil/default.json +++ b/public/translations/fil/default.json @@ -41,5 +41,7 @@ "view_thread": "Tingnan ang Thread", "return": "Bumalik", "bottom": "Ilalim", - "top": "Itaas" + "top": "Itaas", + "thread_closed": "Thread na isara.", + "may_not_reply": "Hindi ka maaaring mag-reply sa oras na ito." } \ No newline at end of file diff --git a/public/translations/fr/default.json b/public/translations/fr/default.json index 623d33ab..3fe4af87 100644 --- a/public/translations/fr/default.json +++ b/public/translations/fr/default.json @@ -41,5 +41,7 @@ "view_thread": "Voir le Fil", "return": "Retour", "bottom": "Bas", - "top": "Haut" + "top": "Haut", + "thread_closed": "Fil fermé.", + "may_not_reply": "Vous ne pouvez peut-être pas répondre en ce moment." } \ No newline at end of file diff --git a/public/translations/he/default.json b/public/translations/he/default.json index 1e332521..3a47a2bb 100644 --- a/public/translations/he/default.json +++ b/public/translations/he/default.json @@ -41,5 +41,7 @@ "view_thread": "הצג אשכול", "return": "חזור", "bottom": "תחתית", - "top": "עליון" + "top": "עליון", + "thread_closed": "השרשור נסגר.", + "may_not_reply": "אולי אינך יכול להגיב כרגע." } \ No newline at end of file diff --git a/public/translations/hi/default.json b/public/translations/hi/default.json index fd03763d..6605f58a 100644 --- a/public/translations/hi/default.json +++ b/public/translations/hi/default.json @@ -41,5 +41,7 @@ "view_thread": "थ्रेड देखें", "return": "वापस", "bottom": "नीचे", - "top": "ऊपर" + "top": "ऊपर", + "thread_closed": "थ्रेड बंद हो गया।", + "may_not_reply": "इस समय आप जवाब नहीं दे सकते।" } \ No newline at end of file diff --git a/public/translations/hu/default.json b/public/translations/hu/default.json index f7c557eb..f7efcbf8 100644 --- a/public/translations/hu/default.json +++ b/public/translations/hu/default.json @@ -41,5 +41,7 @@ "view_thread": "Téma Megtekintése", "return": "Visszatérés", "bottom": "Alja", - "top": "Felső" + "top": "Felső", + "thread_closed": "A téma lezárult.", + "may_not_reply": "Jelenleg nem válaszolhatsz erre." } \ No newline at end of file diff --git a/public/translations/id/default.json b/public/translations/id/default.json index 3303e68e..bca2be74 100644 --- a/public/translations/id/default.json +++ b/public/translations/id/default.json @@ -41,5 +41,7 @@ "view_thread": "Lihat Thread", "return": "Kembali", "bottom": "Bawah", - "top": "Atas" + "top": "Atas", + "thread_closed": "Benang ditutup.", + "may_not_reply": "Anda mungkin tidak bisa membalas pada saat ini." } \ No newline at end of file diff --git a/public/translations/it/default.json b/public/translations/it/default.json index d0ac4034..25ce98a1 100644 --- a/public/translations/it/default.json +++ b/public/translations/it/default.json @@ -41,5 +41,7 @@ "view_thread": "Visualizza Thread", "return": "Indietro", "bottom": "Vai sotto", - "top": "Vai sopra" + "top": "Vai sopra", + "thread_closed": "Thread chiuso.", + "may_not_reply": "Non puoi rispondere in questo momento." } \ No newline at end of file diff --git a/public/translations/ja/default.json b/public/translations/ja/default.json index 4b57976e..7ebf272c 100644 --- a/public/translations/ja/default.json +++ b/public/translations/ja/default.json @@ -41,5 +41,7 @@ "view_thread": "スレッドを見る", "return": "戻る", "bottom": "下へ", - "top": "上へ" + "top": "上へ", + "thread_closed": "スレッドが閉じられました。", + "may_not_reply": "現在、返信することはできません。" } \ No newline at end of file diff --git a/public/translations/ko/default.json b/public/translations/ko/default.json index c949a246..98f8d959 100644 --- a/public/translations/ko/default.json +++ b/public/translations/ko/default.json @@ -41,5 +41,7 @@ "view_thread": "스레드 보기", "return": "돌아 가기", "bottom": "하단", - "top": "맨 위로" + "top": "맨 위로", + "thread_closed": "스레드가 닫혔습니다.", + "may_not_reply": "현재 시간에는 답글을 달 수 없습니다." } \ No newline at end of file diff --git a/public/translations/mr/default.json b/public/translations/mr/default.json index 0fdd4dfb..ae2f7099 100644 --- a/public/translations/mr/default.json +++ b/public/translations/mr/default.json @@ -41,5 +41,7 @@ "view_thread": "थ्रेड पहा", "return": "परत जा", "bottom": "खाली", - "top": "वर" + "top": "वर", + "thread_closed": "सूत्र बंद झाला.", + "may_not_reply": "हा वेळ उत्तर देण्यास शक्य नाही." } \ No newline at end of file diff --git a/public/translations/nl/default.json b/public/translations/nl/default.json index fac554be..964b59a0 100644 --- a/public/translations/nl/default.json +++ b/public/translations/nl/default.json @@ -41,5 +41,7 @@ "view_thread": "Bekijk Thread", "return": "Terugkeer", "bottom": "Onderkant", - "top": "Boven" + "top": "Boven", + "thread_closed": "Thread gesloten.", + "may_not_reply": "U kunt op dit moment mogelijk niet antwoorden." } \ No newline at end of file diff --git a/public/translations/no/default.json b/public/translations/no/default.json index f2e8eb45..7caec07a 100644 --- a/public/translations/no/default.json +++ b/public/translations/no/default.json @@ -41,5 +41,7 @@ "view_thread": "Vis Tråd", "return": "Retur", "bottom": "Bunnen", - "top": "Topp" + "top": "Topp", + "thread_closed": "Tråd stengt.", + "may_not_reply": "Du kan kanskje ikke svare på dette tidspunktet." } \ No newline at end of file diff --git a/public/translations/pl/default.json b/public/translations/pl/default.json index 426226ba..98331749 100644 --- a/public/translations/pl/default.json +++ b/public/translations/pl/default.json @@ -41,5 +41,7 @@ "view_thread": "Zobacz Wątek", "return": "Powrót", "bottom": "Dół", - "top": "Góra" + "top": "Góra", + "thread_closed": "Wątek zamknięty.", + "may_not_reply": "Może nie możesz teraz odpowiedzieć." } \ No newline at end of file diff --git a/public/translations/pt/default.json b/public/translations/pt/default.json index 21440f40..59ad1933 100644 --- a/public/translations/pt/default.json +++ b/public/translations/pt/default.json @@ -41,5 +41,7 @@ "view_thread": "Ver Tópico", "return": "Retorno", "bottom": "Fundo", - "top": "Topo" + "top": "Topo", + "thread_closed": "Tópico fechado.", + "may_not_reply": "Você pode não conseguir responder neste momento." } \ No newline at end of file diff --git a/public/translations/ro/default.json b/public/translations/ro/default.json index 7ab0c092..794ac3b4 100644 --- a/public/translations/ro/default.json +++ b/public/translations/ro/default.json @@ -41,5 +41,7 @@ "view_thread": "Vizualizați Firul", "return": "Întoarcere", "bottom": "Partea de jos", - "top": "Sus" + "top": "Sus", + "thread_closed": "Thread închis.", + "may_not_reply": "Poate că nu puteți răspunde în acest moment." } \ No newline at end of file diff --git a/public/translations/ru/default.json b/public/translations/ru/default.json index c9895b2b..8d08b070 100644 --- a/public/translations/ru/default.json +++ b/public/translations/ru/default.json @@ -41,5 +41,7 @@ "view_thread": "Посмотреть Тему", "return": "Возвращение", "bottom": "Низ", - "top": "Верх" + "top": "Верх", + "thread_closed": "Тема закрыта.", + "may_not_reply": "Вы можете не ответить в это время." } \ No newline at end of file diff --git a/public/translations/sq/default.json b/public/translations/sq/default.json index a77aa0e2..e4040e8f 100644 --- a/public/translations/sq/default.json +++ b/public/translations/sq/default.json @@ -41,5 +41,7 @@ "view_thread": "Shiko Thread", "return": "Kthimi", "bottom": "Fund", - "top": "Sipër" + "top": "Sipër", + "thread_closed": "Fjala është e mbyllur.", + "may_not_reply": "Nuk mund të përgjigjeni në këtë kohë." } \ No newline at end of file diff --git a/public/translations/sv/default.json b/public/translations/sv/default.json index 8448bffb..cfb8bea0 100644 --- a/public/translations/sv/default.json +++ b/public/translations/sv/default.json @@ -41,5 +41,7 @@ "view_thread": "Visa Tråd", "return": "Återgång", "bottom": "Botten", - "top": "Topp" + "top": "Topp", + "thread_closed": "Tråd stängd.", + "may_not_reply": "Du kanske inte kan svara vid den här tiden." } \ No newline at end of file diff --git a/public/translations/te/default.json b/public/translations/te/default.json index 5b8478dd..de863122 100644 --- a/public/translations/te/default.json +++ b/public/translations/te/default.json @@ -41,5 +41,7 @@ "view_thread": "థ్రెడ్‌ను చూడండి", "return": "రిటర్న్", "bottom": "కిందకు", - "top": "మేలే" + "top": "మేలే", + "thread_closed": "థ్రెడ్ మూసివేయబడింది.", + "may_not_reply": "ఈ సమయంలో మీరు ప్రతిసారం ఇవ్వలేరు." } \ No newline at end of file diff --git a/public/translations/th/default.json b/public/translations/th/default.json index 0ea95319..a90cb086 100644 --- a/public/translations/th/default.json +++ b/public/translations/th/default.json @@ -41,5 +41,7 @@ "view_thread": "ดูกระทู้", "return": "กลับ", "bottom": "ด้านล่าง", - "top": "ด้านบน" + "top": "ด้านบน", + "thread_closed": "เธรดถูกปิด", + "may_not_reply": "คุณอาจไม่สามารถตอบกลับได้ในขณะนี้" } \ No newline at end of file diff --git a/public/translations/tr/default.json b/public/translations/tr/default.json index 08f99d53..660c1ac5 100644 --- a/public/translations/tr/default.json +++ b/public/translations/tr/default.json @@ -41,5 +41,7 @@ "view_thread": "Konuyu Görüntüle", "return": "Dönüş", "bottom": "Alt", - "top": "Üst" + "top": "Üst", + "thread_closed": "Konu kapatıldı.", + "may_not_reply": "Şu anda cevap veremeyebilirsiniz." } \ No newline at end of file diff --git a/public/translations/uk/default.json b/public/translations/uk/default.json index 554cb5bb..c296514f 100644 --- a/public/translations/uk/default.json +++ b/public/translations/uk/default.json @@ -41,5 +41,7 @@ "view_thread": "Переглянути Тему", "return": "Повернення", "bottom": "Низ", - "top": "Верхній" + "top": "Верхній", + "thread_closed": "Тема закрита.", + "may_not_reply": "Можливо, ви не зможете відповісти зараз." } \ No newline at end of file diff --git a/public/translations/ur/default.json b/public/translations/ur/default.json index c689bac9..59de43bc 100644 --- a/public/translations/ur/default.json +++ b/public/translations/ur/default.json @@ -41,5 +41,7 @@ "view_thread": "تھریڈ دیکھیں", "return": "واپس", "bottom": "نیچے", - "top": "اوپر" + "top": "اوپر", + "thread_closed": "موضوع بند کر دیا گیا ہے۔", + "may_not_reply": "آپ اس وقت جواب نہیں دے سکتے۔" } \ No newline at end of file diff --git a/public/translations/vi/default.json b/public/translations/vi/default.json index 663747fd..96a15bc4 100644 --- a/public/translations/vi/default.json +++ b/public/translations/vi/default.json @@ -41,5 +41,7 @@ "view_thread": "Xem Chủ Đề", "return": "Trở lại", "bottom": "Đáy", - "top": "Đầu" + "top": "Đầu", + "thread_closed": "Chủ đề đã đóng.", + "may_not_reply": "Bạn có thể không thể trả lời vào thời điểm này." } \ No newline at end of file diff --git a/public/translations/zh/default.json b/public/translations/zh/default.json index 940df1d9..0aa3a114 100644 --- a/public/translations/zh/default.json +++ b/public/translations/zh/default.json @@ -41,5 +41,7 @@ "view_thread": "查看线程", "return": "返回", "bottom": "底部", - "top": "顶部" + "top": "顶部", + "thread_closed": "主题已关闭。", + "may_not_reply": "您现在可能无法回复。" } \ No newline at end of file diff --git a/src/app.module.css b/src/app.module.css index 6c9bae3a..20cd05b9 100644 --- a/src/app.module.css +++ b/src/app.module.css @@ -14,4 +14,4 @@ .app { padding: 5px; } -} \ No newline at end of file +} diff --git a/src/app.tsx b/src/app.tsx index 292844ed..60456ca3 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,7 +1,7 @@ -import React, { useEffect } from 'react'; -import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom'; +import { useEffect } from 'react'; +import { Outlet, Route, Routes, useLocation } from 'react-router-dom'; import { isHomeView } from './lib/utils/view-utils'; -import { Subplebbit as SubplebbitType, useSubplebbit, useSubplebbits } from '@plebbit/plebbit-react-hooks'; +import { useSubplebbits } from '@plebbit/plebbit-react-hooks'; import { useDefaultSubplebbitAddresses } from './hooks/use-default-subplebbits'; import useTheme from './hooks/use-theme'; import styles from './app.module.css'; @@ -16,32 +16,6 @@ import { MobileBoardButtons } from './components/board-buttons'; import BoardStats from './components/board-stats'; import PostForm from './components/post-form'; -interface BoardLayoutProps { - subplebbits: (SubplebbitType | undefined)[]; -} - -const BoardLayout = React.memo(({ subplebbits }: BoardLayoutProps) => { - const { subplebbitAddress } = useParams<{ subplebbitAddress: string }>(); - const subplebbit = useSubplebbit({ subplebbitAddress }); - const { address, createdAt, title } = subplebbit || {}; - - return ( - <> - {address && ( - <> - - - - - - - - )} - - - ); -}); - const App = () => { const [theme] = useTheme(); const location = useLocation(); @@ -62,13 +36,27 @@ const App = () => { // // ); + const boardLayout = ( + <> + + + + + + + + + ); + return (
} /> - }> + } /> } /> + } /> + } /> } /> diff --git a/src/components/board-banner/board-banner.tsx b/src/components/board-banner/board-banner.tsx index 7887a67e..b7563e28 100644 --- a/src/components/board-banner/board-banner.tsx +++ b/src/components/board-banner/board-banner.tsx @@ -1,3 +1,5 @@ +import { useParams } from 'react-router-dom'; +import { useSubplebbit } from '@plebbit/plebbit-react-hooks'; import { useState } from 'react'; import styles from './board-banner.module.css'; @@ -12,13 +14,12 @@ const ImageBanner = () => { return banner; }; -interface BoardBannerProps { - title: string | undefined; - address: string | undefined; -} - -const BoardBanner = ({ address, title }: BoardBannerProps) => { +const BoardBanner = () => { + const { subplebbitAddress } = useParams<{ subplebbitAddress: string }>(); + const subplebbit = useSubplebbit({ subplebbitAddress }); + const { address, title } = subplebbit || {}; const displayAddress = address && address.length > 10 && !address.includes('.') ? address.slice(0, 13).concat('...') : address; + return (
diff --git a/src/components/board-buttons/board-buttons.tsx b/src/components/board-buttons/board-buttons.tsx index 6d5f1b0f..c9b188c6 100644 --- a/src/components/board-buttons/board-buttons.tsx +++ b/src/components/board-buttons/board-buttons.tsx @@ -5,7 +5,7 @@ import styles from './board-buttons.module.css'; import { isPostPageView } from '../../lib/utils/view-utils'; interface BoardButtonsProps { - address: string; + address: string | undefined; } const OptionsButton = () => { @@ -51,7 +51,8 @@ const BottomButton = () => { ); }; -export const MobileBoardButtons = ({ address }: BoardButtonsProps) => { +export const MobileBoardButtons = () => { + const { subplebbitAddress: address } = useParams<{ subplebbitAddress: string }>(); const isInPostPage = isPostPageView(useLocation().pathname, useParams()); return (
@@ -76,7 +77,8 @@ export const MobileBoardButtons = ({ address }: BoardButtonsProps) => { ); }; -export const DesktopBoardButtons = ({ address }: BoardButtonsProps) => { +export const DesktopBoardButtons = () => { + const { subplebbitAddress: address } = useParams<{ subplebbitAddress: string }>(); const isInPostPage = isPostPageView(useLocation().pathname, useParams()); return (
diff --git a/src/components/board-nav/board-nav.module.css b/src/components/board-nav/board-nav.module.css index a44ffacf..dfce3483 100644 --- a/src/components/board-nav/board-nav.module.css +++ b/src/components/board-nav/board-nav.module.css @@ -33,11 +33,6 @@ text-decoration: var(--button-text-decoration-mobile); } -.boardNavMobile .pageJump a:hover { - color: var(--button-text-color-hover-mobile); - text-decoration: var(--button-text-decoration-hover-mobile); -} - .boardNavMobile strong { text-transform: capitalize; padding-right: 5px; diff --git a/src/components/board-nav/board-nav.tsx b/src/components/board-nav/board-nav.tsx index 3c7dd92f..1add82aa 100644 --- a/src/components/board-nav/board-nav.tsx +++ b/src/components/board-nav/board-nav.tsx @@ -1,10 +1,9 @@ -import { Link, useNavigate } from 'react-router-dom'; +import { Link, useNavigate, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { Subplebbit } from '@plebbit/plebbit-react-hooks'; import styles from './board-nav.module.css'; interface BoardNavProps { - address?: string | undefined; subplebbits: (Subplebbit | undefined)[]; currentSubplebbit?: string | undefined; } @@ -77,7 +76,8 @@ const BoardNavMobile = ({ subplebbits, currentSubplebbit }: BoardNavProps) => { ); }; -const BoardNav = ({ address, subplebbits }: BoardNavProps) => { +const BoardNav = ({ subplebbits }: BoardNavProps) => { + const { subplebbitAddress: address } = useParams(); return ( <> diff --git a/src/components/board-stats/board-stats.module.css b/src/components/board-stats/board-stats.module.css index ed05ae50..3bbe422d 100644 --- a/src/components/board-stats/board-stats.module.css +++ b/src/components/board-stats/board-stats.module.css @@ -1,3 +1,11 @@ +.hide { + display: none; +} + +.show { + display: block; +} + .content hr { min-width: 468px; margin-left: -4px; @@ -12,7 +20,7 @@ } .blotter tr { - font-size: 11px; + font-size: var(--stats-font-size); } .blotter tfoot { diff --git a/src/components/board-stats/board-stats.tsx b/src/components/board-stats/board-stats.tsx index 61302d82..87b713c0 100644 --- a/src/components/board-stats/board-stats.tsx +++ b/src/components/board-stats/board-stats.tsx @@ -1,15 +1,26 @@ import { useState } from 'react'; -import { useSubplebbitStats } from '@plebbit/plebbit-react-hooks'; +import { useLocation, useParams } from 'react-router-dom'; +import { useComment, useSubplebbit, useSubplebbitStats } from '@plebbit/plebbit-react-hooks'; import styles from './board-stats.module.css'; import { Trans, useTranslation } from 'react-i18next'; +import { isDescriptionView, isRulesView } from '../../lib/utils/view-utils'; -export interface BoardStatsProps { - address: string | undefined; - createdAt: number | undefined; -} - -const BoardStats = ({ address, createdAt }: BoardStatsProps) => { +const BoardStats = () => { const { t } = useTranslation(); + const { commentCid, subplebbitAddress } = useParams<{ subplebbitAddress: string; commentCid: string }>(); + + const subplebbit = useSubplebbit({ subplebbitAddress }); + const { address, createdAt } = subplebbit || {}; + + const location = useLocation(); + const params = useParams(); + const isInDescriptionView = isDescriptionView(location.pathname, params); + const isInRulesView = isRulesView(location.pathname, params); + + const comment = useComment({ commentCid }); + const { deleted, locked, removed } = comment || {}; + const hideStats = deleted || locked || removed || isInDescriptionView || isInRulesView; + const stats = useSubplebbitStats({ subplebbitAddress: address }); const [showStats, setShowStats] = useState(true); @@ -22,7 +33,7 @@ const BoardStats = ({ address, createdAt }: BoardStatsProps) => { }; return ( -
+
diff --git a/src/components/media/media.tsx b/src/components/media/media.tsx index cdffeb1a..79fbb8fc 100644 --- a/src/components/media/media.tsx +++ b/src/components/media/media.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React from 'react'; import styles from './media.module.css'; import { CommentMediaInfo } from '../../lib/utils/media-utils'; import useFetchGifFirstFrame from '../../hooks/use-fetch-gif-first-frame'; @@ -34,7 +34,7 @@ const ThumbnailSmall = ({ style, children, thumbnailSmallPadding }: ThumbnailPro ); -const Thumbnail = ({ commentMediaInfo, isMobile, isReply, linkHeight, linkWidth }: MediaProps) => { +const Thumbnail = ({ commentMediaInfo, isMobile, isReply, linkHeight, linkWidth, setShowThumbnail }: MediaProps) => { let displayWidth, displayHeight; const maxThumbnailSize = isMobile || isReply ? 125 : 250; if (linkWidth && linkHeight) { @@ -46,19 +46,30 @@ const Thumbnail = ({ commentMediaInfo, isMobile, isReply, linkHeight, linkWidth displayHeight = `${maxThumbnailSize}px`; } + if (commentMediaInfo?.type === 'audio') { + displayWidth = '250px'; + displayHeight = '75px'; + } + let mediaComponent: React.ReactNode = null; const iframeThumbnail = commentMediaInfo?.patternThumbnailUrl || commentMediaInfo?.thumbnail; const gifFrameUrl = useFetchGifFirstFrame(commentMediaInfo?.type === 'gif' ? commentMediaInfo.url : undefined); if (commentMediaInfo?.type === 'image') { - mediaComponent = ; + mediaComponent = setShowThumbnail(false)} />; } else if (commentMediaInfo?.type === 'video') { - mediaComponent = commentMediaInfo.thumbnail ? :