mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(feeds): force infinite scroll on multiboards and canonicalize page URLs
This commit is contained in:
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "تفعيل التمرير اللانهائي",
|
"enable_infinite_scroll": "تفعيل التمرير اللانهائي",
|
||||||
"prev": "السابق",
|
"prev": "السابق",
|
||||||
"next": "التالي",
|
"next": "التالي",
|
||||||
"bottom": "أسفل"
|
"bottom": "أسفل",
|
||||||
|
"enable_infinite_scroll_tip": "لا ينطبق على اللوحات المتعددة، التي تستخدم التمرير اللانهائي دائماً."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "অসীম স্ক্রল সক্ষম করুন",
|
"enable_infinite_scroll": "অসীম স্ক্রল সক্ষম করুন",
|
||||||
"prev": "পূর্ববর্তী",
|
"prev": "পূর্ববর্তী",
|
||||||
"next": "পরবর্তী",
|
"next": "পরবর্তী",
|
||||||
"bottom": "নিচ"
|
"bottom": "নিচ",
|
||||||
|
"enable_infinite_scroll_tip": "মাল্টিবোর্ডে প্রযোজ্য নয়, যা সবসময় অসীম স্ক্রল ব্যবহার করে।"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Povolit nekonečné posouvání",
|
"enable_infinite_scroll": "Povolit nekonečné posouvání",
|
||||||
"prev": "Předchozí",
|
"prev": "Předchozí",
|
||||||
"next": "Další",
|
"next": "Další",
|
||||||
"bottom": "Dole"
|
"bottom": "Dole",
|
||||||
|
"enable_infinite_scroll_tip": "Netýká se multidesek, které vždy používají nekonečné posouvání."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Aktiver uendelig rulning",
|
"enable_infinite_scroll": "Aktiver uendelig rulning",
|
||||||
"prev": "Forrige",
|
"prev": "Forrige",
|
||||||
"next": "Næste",
|
"next": "Næste",
|
||||||
"bottom": "Bund"
|
"bottom": "Bund",
|
||||||
|
"enable_infinite_scroll_tip": "Gælder ikke for multiboard, som altid bruger uendelig scroll."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Unendliches Scrollen aktivieren",
|
"enable_infinite_scroll": "Unendliches Scrollen aktivieren",
|
||||||
"prev": "Zurück",
|
"prev": "Zurück",
|
||||||
"next": "Weiter",
|
"next": "Weiter",
|
||||||
"bottom": "Unten"
|
"bottom": "Unten",
|
||||||
|
"enable_infinite_scroll_tip": "Gilt nicht für Multiboards, die immer Endlos-Scrolling verwenden."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Ενεργοποίηση άπειρου κύλισης",
|
"enable_infinite_scroll": "Ενεργοποίηση άπειρου κύλισης",
|
||||||
"prev": "Προηγ",
|
"prev": "Προηγ",
|
||||||
"next": "Επόμενο",
|
"next": "Επόμενο",
|
||||||
"bottom": "Κάτω"
|
"bottom": "Κάτω",
|
||||||
|
"enable_infinite_scroll_tip": "Δεν ισχύει για τα πολυπίνακες, που χρησιμοποιούν πάντα την ατελείωτη κύλιση."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"media_hosting_all_providers_failed_guidance": "All upload providers failed. Try again or paste a link manually.",
|
"media_hosting_all_providers_failed_guidance": "All upload providers failed. Try again or paste a link manually.",
|
||||||
"enable_infinite_scroll": "Enable infinite scroll",
|
"enable_infinite_scroll": "Enable infinite scroll",
|
||||||
"prev": "Prev",
|
"prev": "Prev",
|
||||||
"next": "Next"
|
"next": "Next",
|
||||||
|
"enable_infinite_scroll_tip": "Does not apply to multiboards, which always use infinite scroll."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Activar desplazamiento infinito",
|
"enable_infinite_scroll": "Activar desplazamiento infinito",
|
||||||
"prev": "Anterior",
|
"prev": "Anterior",
|
||||||
"next": "Siguiente",
|
"next": "Siguiente",
|
||||||
"bottom": "Abajo"
|
"bottom": "Abajo",
|
||||||
|
"enable_infinite_scroll_tip": "No aplica a los multiboard, que siempre usan scroll infinito."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "فعال کردن اسکرول بینهایت",
|
"enable_infinite_scroll": "فعال کردن اسکرول بینهایت",
|
||||||
"prev": "قبلی",
|
"prev": "قبلی",
|
||||||
"next": "بعدی",
|
"next": "بعدی",
|
||||||
"bottom": "پایین"
|
"bottom": "پایین",
|
||||||
|
"enable_infinite_scroll_tip": "برای تابلوهای چندگانه اعمال نمیشود، که همیشه از اسکرول بینهایت استفاده میکنند."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Ota ääretön vieritys käyttöön",
|
"enable_infinite_scroll": "Ota ääretön vieritys käyttöön",
|
||||||
"prev": "Edell.",
|
"prev": "Edell.",
|
||||||
"next": "Seuraava",
|
"next": "Seuraava",
|
||||||
"bottom": "Pohja"
|
"bottom": "Pohja",
|
||||||
|
"enable_infinite_scroll_tip": "Ei koske monilautalistauksia, jotka aina käyttävät ääretöntä vieritystä."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Paganahin ang walang hanggang scroll",
|
"enable_infinite_scroll": "Paganahin ang walang hanggang scroll",
|
||||||
"prev": "Nakaraan",
|
"prev": "Nakaraan",
|
||||||
"next": "Susunod",
|
"next": "Susunod",
|
||||||
"bottom": "Ibaba"
|
"bottom": "Ibaba",
|
||||||
|
"enable_infinite_scroll_tip": "Hindi naaangkop sa mga multiboard, na palaging gumagamit ng walang hanggang scroll."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Activer le défilement infini",
|
"enable_infinite_scroll": "Activer le défilement infini",
|
||||||
"prev": "Précédent",
|
"prev": "Précédent",
|
||||||
"next": "Suivant",
|
"next": "Suivant",
|
||||||
"bottom": "Bas"
|
"bottom": "Bas",
|
||||||
|
"enable_infinite_scroll_tip": "Ne s'applique pas aux multiboards, qui utilisent toujours le défilement infini."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "הפעל גלילה אינסופית",
|
"enable_infinite_scroll": "הפעל גלילה אינסופית",
|
||||||
"prev": "הקודם",
|
"prev": "הקודם",
|
||||||
"next": "הבא",
|
"next": "הבא",
|
||||||
"bottom": "תחתית"
|
"bottom": "תחתית",
|
||||||
|
"enable_infinite_scroll_tip": "לא חל על לוחות מרובים, שתמיד משתמשים בגלילה אינסופית."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "अनंत स्क्रॉल सक्षम करें",
|
"enable_infinite_scroll": "अनंत स्क्रॉल सक्षम करें",
|
||||||
"prev": "पिछला",
|
"prev": "पिछला",
|
||||||
"next": "अगला",
|
"next": "अगला",
|
||||||
"bottom": "नीचे"
|
"bottom": "नीचे",
|
||||||
|
"enable_infinite_scroll_tip": "मल्टीबोर्ड पर लागू नहीं होता, जो हमेशा अनंत स्क्रॉल का उपयोग करते हैं।"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Végtelen görgetés engedélyezése",
|
"enable_infinite_scroll": "Végtelen görgetés engedélyezése",
|
||||||
"prev": "Előző",
|
"prev": "Előző",
|
||||||
"next": "Következő",
|
"next": "Következő",
|
||||||
"bottom": "Alul"
|
"bottom": "Alul",
|
||||||
|
"enable_infinite_scroll_tip": "A többtáblás nézetekre nem vonatkozik, amelyek mindig végtelen görgetést használnak."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Aktifkan scroll tak terbatas",
|
"enable_infinite_scroll": "Aktifkan scroll tak terbatas",
|
||||||
"prev": "Sebelumnya",
|
"prev": "Sebelumnya",
|
||||||
"next": "Berikutnya",
|
"next": "Berikutnya",
|
||||||
"bottom": "Bawah"
|
"bottom": "Bawah",
|
||||||
|
"enable_infinite_scroll_tip": "Tidak berlaku untuk papan ganda, yang selalu menggunakan scroll tak terbatas."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Abilita scorrimento infinito",
|
"enable_infinite_scroll": "Abilita scorrimento infinito",
|
||||||
"prev": "Prec.",
|
"prev": "Prec.",
|
||||||
"next": "Avanti",
|
"next": "Avanti",
|
||||||
"bottom": "In basso"
|
"bottom": "In basso",
|
||||||
|
"enable_infinite_scroll_tip": "Non si applica ai multiboard, che usano sempre lo scroll infinito."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "無限スクロールを有効にする",
|
"enable_infinite_scroll": "無限スクロールを有効にする",
|
||||||
"prev": "前へ",
|
"prev": "前へ",
|
||||||
"next": "次へ",
|
"next": "次へ",
|
||||||
"bottom": "下"
|
"bottom": "下",
|
||||||
|
"enable_infinite_scroll_tip": "マルチボードには適用されません。マルチボードは常に無限スクロールを使用します。"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "무한 스크롤 활성화",
|
"enable_infinite_scroll": "무한 스크롤 활성화",
|
||||||
"prev": "이전",
|
"prev": "이전",
|
||||||
"next": "다음",
|
"next": "다음",
|
||||||
"bottom": "아래"
|
"bottom": "아래",
|
||||||
|
"enable_infinite_scroll_tip": "항상 무한 스크롤을 사용하는 멀티보드에는 적용되지 않습니다."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "अनंत स्क्रोल सक्षम करा",
|
"enable_infinite_scroll": "अनंत स्क्रोल सक्षम करा",
|
||||||
"prev": "मागील",
|
"prev": "मागील",
|
||||||
"next": "पुढे",
|
"next": "पुढे",
|
||||||
"bottom": "तळ"
|
"bottom": "तळ",
|
||||||
|
"enable_infinite_scroll_tip": "मल्टीबोर्डवर लागू होत नाही, जे नेहमी अंतहीन स्क्रॉल वापरतात."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Oneindig scrollen inschakelen",
|
"enable_infinite_scroll": "Oneindig scrollen inschakelen",
|
||||||
"prev": "Vorige",
|
"prev": "Vorige",
|
||||||
"next": "Volgende",
|
"next": "Volgende",
|
||||||
"bottom": "Onder"
|
"bottom": "Onder",
|
||||||
|
"enable_infinite_scroll_tip": "Geldt niet voor multiboards, die altijd oneindig scrollen gebruiken."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Aktiver uendelig rulling",
|
"enable_infinite_scroll": "Aktiver uendelig rulling",
|
||||||
"prev": "Forrige",
|
"prev": "Forrige",
|
||||||
"next": "Neste",
|
"next": "Neste",
|
||||||
"bottom": "Bunn"
|
"bottom": "Bunn",
|
||||||
|
"enable_infinite_scroll_tip": "Gjelder ikke for multiboard, som alltid bruker uendelig scroll."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Włącz nieskończone przewijanie",
|
"enable_infinite_scroll": "Włącz nieskończone przewijanie",
|
||||||
"prev": "Poprz.",
|
"prev": "Poprz.",
|
||||||
"next": "Dalej",
|
"next": "Dalej",
|
||||||
"bottom": "Dół"
|
"bottom": "Dół",
|
||||||
|
"enable_infinite_scroll_tip": "Nie dotyczy multiboardów, które zawsze używają nieskończonego przewijania."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Ativar rolagem infinita",
|
"enable_infinite_scroll": "Ativar rolagem infinita",
|
||||||
"prev": "Anterior",
|
"prev": "Anterior",
|
||||||
"next": "Próximo",
|
"next": "Próximo",
|
||||||
"bottom": "Inferior"
|
"bottom": "Inferior",
|
||||||
|
"enable_infinite_scroll_tip": "Não se aplica a multiboard, que sempre usam rolagem infinita."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Activează derularea infinită",
|
"enable_infinite_scroll": "Activează derularea infinită",
|
||||||
"prev": "Anterior",
|
"prev": "Anterior",
|
||||||
"next": "Următorul",
|
"next": "Următorul",
|
||||||
"bottom": "Jos"
|
"bottom": "Jos",
|
||||||
|
"enable_infinite_scroll_tip": "Nu se aplică la multiboard-urile, care folosesc întotdeauna defilarea infinită."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Включить бесконечную прокрутку",
|
"enable_infinite_scroll": "Включить бесконечную прокрутку",
|
||||||
"prev": "Пред.",
|
"prev": "Пред.",
|
||||||
"next": "Далее",
|
"next": "Далее",
|
||||||
"bottom": "Вниз"
|
"bottom": "Вниз",
|
||||||
|
"enable_infinite_scroll_tip": "Не применяется к мультибордам, которые всегда используют бесконечную прокрутку."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Aktivizo rrëshqitjen e pafundme",
|
"enable_infinite_scroll": "Aktivizo rrëshqitjen e pafundme",
|
||||||
"prev": "Paraprake",
|
"prev": "Paraprake",
|
||||||
"next": "Tjetra",
|
"next": "Tjetra",
|
||||||
"bottom": "Poshtë"
|
"bottom": "Poshtë",
|
||||||
|
"enable_infinite_scroll_tip": "Nuk aplikohet për multiboard-et, që gjithmonë përdorin rrëshqitje të pafundme."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Aktivera oändlig scrollning",
|
"enable_infinite_scroll": "Aktivera oändlig scrollning",
|
||||||
"prev": "Föreg.",
|
"prev": "Föreg.",
|
||||||
"next": "Nästa",
|
"next": "Nästa",
|
||||||
"bottom": "Botten"
|
"bottom": "Botten",
|
||||||
|
"enable_infinite_scroll_tip": "Gäller inte multiboard, som alltid använder oändlig scroll."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "అనంత స్క్రోల్ చేతనం చేయండి",
|
"enable_infinite_scroll": "అనంత స్క్రోల్ చేతనం చేయండి",
|
||||||
"prev": "మునుపటి",
|
"prev": "మునుపటి",
|
||||||
"next": "తదుపరి",
|
"next": "తదుపరి",
|
||||||
"bottom": "క్రింద"
|
"bottom": "క్రింద",
|
||||||
|
"enable_infinite_scroll_tip": "మల్టీబోర్డ్లకు వర్తించదు, అవి ఎల్లప్పుడూ అనంత స్క్రాల్ ఉపయోగిస్తాయి."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "เปิดใช้งานการเลื่อนแบบไม่จำกัด",
|
"enable_infinite_scroll": "เปิดใช้งานการเลื่อนแบบไม่จำกัด",
|
||||||
"prev": "ก่อนหน้า",
|
"prev": "ก่อนหน้า",
|
||||||
"next": "ถัดไป",
|
"next": "ถัดไป",
|
||||||
"bottom": "ล่าง"
|
"bottom": "ล่าง",
|
||||||
|
"enable_infinite_scroll_tip": "ไม่ใช้กับมัลติบอร์ด ซึ่งใช้การเลื่อนแบบไม่สิ้นสุดเสมอ"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Sonsuz kaydırmayı etkinleştir",
|
"enable_infinite_scroll": "Sonsuz kaydırmayı etkinleştir",
|
||||||
"prev": "Önceki",
|
"prev": "Önceki",
|
||||||
"next": "İleri",
|
"next": "İleri",
|
||||||
"bottom": "Alt"
|
"bottom": "Alt",
|
||||||
|
"enable_infinite_scroll_tip": "Her zaman sonsuz kaydırma kullanan çoklu panolar için geçerli değildir."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Увімкнути нескінченну прокрутку",
|
"enable_infinite_scroll": "Увімкнути нескінченну прокрутку",
|
||||||
"prev": "Попередн.",
|
"prev": "Попередн.",
|
||||||
"next": "Далі",
|
"next": "Далі",
|
||||||
"bottom": "Вниз"
|
"bottom": "Вниз",
|
||||||
|
"enable_infinite_scroll_tip": "Не застосовується до мультибордів, які завжди використовують нескінченне прокручування."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "لامحدود سکرول فعال کریں",
|
"enable_infinite_scroll": "لامحدود سکرول فعال کریں",
|
||||||
"prev": "پچھلا",
|
"prev": "پچھلا",
|
||||||
"next": "اگلا",
|
"next": "اگلا",
|
||||||
"bottom": "نیچے"
|
"bottom": "نیچے",
|
||||||
|
"enable_infinite_scroll_tip": "ملٹی بورڈز پر لاگو نہیں ہوتا، جو ہمیشہ لامحدود سکرول استعمال کرتے ہیں۔"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "Bật cuộn vô hạn",
|
"enable_infinite_scroll": "Bật cuộn vô hạn",
|
||||||
"prev": "Trước",
|
"prev": "Trước",
|
||||||
"next": "Tiếp theo",
|
"next": "Tiếp theo",
|
||||||
"bottom": "Dưới cùng"
|
"bottom": "Dưới cùng",
|
||||||
|
"enable_infinite_scroll_tip": "Không áp dụng cho đa bảng, luôn sử dụng cuộn vô hạn."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,5 +284,6 @@
|
|||||||
"enable_infinite_scroll": "启用无限滚动",
|
"enable_infinite_scroll": "启用无限滚动",
|
||||||
"prev": "上一页",
|
"prev": "上一页",
|
||||||
"next": "下一步",
|
"next": "下一步",
|
||||||
"bottom": "底部"
|
"bottom": "底部",
|
||||||
|
"enable_infinite_scroll_tip": "不适用于多板视图,后者始终使用无限滚动。"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,7 +416,9 @@ export const MobileBoardButtons = () => {
|
|||||||
|
|
||||||
const { filteredCount, searchText } = useCatalogFiltersStore();
|
const { filteredCount, searchText } = useCatalogFiltersStore();
|
||||||
const enableInfiniteScroll = useFeedViewSettingsStore((state) => state.enableInfiniteScroll);
|
const enableInfiniteScroll = useFeedViewSettingsStore((state) => state.enableInfiniteScroll);
|
||||||
const showBottomButton = (isInCatalogView || isInPostView || isInPendingPostPage) && !enableInfiniteScroll;
|
const isMultiboard = isInAllView || isInSubscriptionsView || isInModView;
|
||||||
|
const effectiveInfiniteScroll = isMultiboard || enableInfiniteScroll;
|
||||||
|
const showBottomButton = (isInCatalogView || isInPostView || isInPendingPostPage) && !effectiveInfiniteScroll;
|
||||||
|
|
||||||
// Check if we should show the vote button (only for directory boards)
|
// Check if we should show the vote button (only for directory boards)
|
||||||
const directories = useDirectories();
|
const directories = useDirectories();
|
||||||
@@ -539,7 +541,9 @@ export const DesktopBoardButtons = () => {
|
|||||||
|
|
||||||
const { filteredCount, searchText } = useCatalogFiltersStore();
|
const { filteredCount, searchText } = useCatalogFiltersStore();
|
||||||
const enableInfiniteScroll = useFeedViewSettingsStore((state) => state.enableInfiniteScroll);
|
const enableInfiniteScroll = useFeedViewSettingsStore((state) => state.enableInfiniteScroll);
|
||||||
const showBottomButton = (isInCatalogView || isInPostView || isInPendingPostPage) && !enableInfiniteScroll;
|
const isMultiboard = isInAllView || isInSubscriptionsView || isInModView;
|
||||||
|
const effectiveInfiniteScroll = isMultiboard || enableInfiniteScroll;
|
||||||
|
const showBottomButton = (isInCatalogView || isInPostView || isInPendingPostPage) && !effectiveInfiniteScroll;
|
||||||
|
|
||||||
// Check if we should show the vote button (only for directory boards)
|
// Check if we should show the vote button (only for directory boards)
|
||||||
const directories = useDirectories();
|
const directories = useDirectories();
|
||||||
|
|||||||
@@ -72,6 +72,11 @@ describe('InterfaceSettings', () => {
|
|||||||
setItemSpy.mockRestore();
|
setItemSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders enable_infinite_scroll_tip under the infinite scroll checkbox', () => {
|
||||||
|
render(createElement(InterfaceSettings));
|
||||||
|
expect(container.textContent).toMatch(/enable_infinite_scroll_tip/i);
|
||||||
|
});
|
||||||
|
|
||||||
it('renders enable_infinite_scroll checkbox unchecked by default', () => {
|
it('renders enable_infinite_scroll checkbox unchecked by default', () => {
|
||||||
render(createElement(InterfaceSettings));
|
render(createElement(InterfaceSettings));
|
||||||
const label = Array.from(container.querySelectorAll('label')).find((l) => l.textContent?.toLowerCase().includes('enable_infinite_scroll'));
|
const label = Array.from(container.querySelectorAll('label')).find((l) => l.textContent?.toLowerCase().includes('enable_infinite_scroll'));
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ const InterfaceSettings = () => {
|
|||||||
<input type='checkbox' checked={enableInfiniteScroll} onChange={(e) => setEnableInfiniteScroll(e.target.checked)} />
|
<input type='checkbox' checked={enableInfiniteScroll} onChange={(e) => setEnableInfiniteScroll(e.target.checked)} />
|
||||||
{capitalize(t('enable_infinite_scroll'))}
|
{capitalize(t('enable_infinite_scroll'))}
|
||||||
</label>
|
</label>
|
||||||
|
<div className={styles.settingTip}>{capitalize(t('enable_infinite_scroll_tip'))}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import { normalizeMultiboardFeedPath } from '../route-utils';
|
||||||
|
|
||||||
|
describe('normalizeMultiboardFeedPath', () => {
|
||||||
|
it('normalizes /all/3 -> /all', () => {
|
||||||
|
expect(normalizeMultiboardFeedPath('/all/3')).toBe('/all');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('normalizes /all/1w/3 -> /all/1w', () => {
|
||||||
|
expect(normalizeMultiboardFeedPath('/all/1w/3')).toBe('/all/1w');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('normalizes /subs/2/settings -> /subs/settings', () => {
|
||||||
|
expect(normalizeMultiboardFeedPath('/subs/2/settings')).toBe('/subs/settings');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('normalizes /mod/catalog/4 -> /mod/catalog', () => {
|
||||||
|
expect(normalizeMultiboardFeedPath('/mod/catalog/4')).toBe('/mod/catalog');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('leaves non-multiboard paths unchanged', () => {
|
||||||
|
expect(normalizeMultiboardFeedPath('/biz')).toBe('/biz');
|
||||||
|
expect(normalizeMultiboardFeedPath('/biz/3')).toBe('/biz/3');
|
||||||
|
expect(normalizeMultiboardFeedPath('/biz/1w/2')).toBe('/biz/1w/2');
|
||||||
|
expect(normalizeMultiboardFeedPath('/biz/catalog/4')).toBe('/biz/catalog/4');
|
||||||
|
expect(normalizeMultiboardFeedPath('/pending/0')).toBe('/pending/0');
|
||||||
|
expect(normalizeMultiboardFeedPath('/')).toBe('/');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -150,6 +150,43 @@ export const BOARD_PAGE_REGEX = /^([1-9]|10)$/;
|
|||||||
|
|
||||||
export const isBoardFeedPageNumber = (segment: string): boolean => BOARD_PAGE_REGEX.test(segment);
|
export const isBoardFeedPageNumber = (segment: string): boolean => BOARD_PAGE_REGEX.test(segment);
|
||||||
|
|
||||||
|
/** Internal: check if segment is a multiboard root (all, subs, mod) */
|
||||||
|
function isMultiboardRoot(segment: string): boolean {
|
||||||
|
return segment === 'all' || segment === 'subs' || segment === 'mod';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Internal: check if pathname is a multiboard feed path (starts with /all, /subs, or /mod) */
|
||||||
|
function isMultiboardFeedPath(pathname: string): boolean {
|
||||||
|
const trimmed = pathname.replace(/\/$/, '');
|
||||||
|
const segments = trimmed.split('/').filter(Boolean);
|
||||||
|
return segments.length > 0 && isMultiboardRoot(segments[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize multiboard feed paths by removing trailing page-number segments (1–10),
|
||||||
|
* while preserving /settings and valid time-filter segments.
|
||||||
|
* Non-multiboard paths are returned unchanged.
|
||||||
|
*/
|
||||||
|
export const normalizeMultiboardFeedPath = (pathname: string): string => {
|
||||||
|
let path = pathname.replace(/\/$/, '');
|
||||||
|
if (!isMultiboardFeedPath(path)) {
|
||||||
|
return pathname;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasSettings = path.endsWith('/settings');
|
||||||
|
if (hasSettings) {
|
||||||
|
path = path.replace(/\/settings$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
const segments = path.split('/').filter(Boolean);
|
||||||
|
if (segments.length > 1 && isBoardFeedPageNumber(segments[segments.length - 1])) {
|
||||||
|
const newPath = '/' + segments.slice(0, -1).join('/');
|
||||||
|
return hasSettings ? newPath + '/settings' : newPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasSettings ? path + '/settings' : path;
|
||||||
|
};
|
||||||
|
|
||||||
/** Strip trailing page number (1–10) from path for feed cache key */
|
/** Strip trailing page number (1–10) from path for feed cache key */
|
||||||
export const stripPageFromFeedPath = (path: string): string => {
|
export const stripPageFromFeedPath = (path: string): string => {
|
||||||
const segments = path.split('/').filter(Boolean);
|
const segments = path.split('/').filter(Boolean);
|
||||||
|
|||||||
+28
-16
@@ -16,7 +16,7 @@ import useSortingStore from '../../stores/use-sorting-store';
|
|||||||
import useFeedViewSettingsStore from '../../stores/use-feed-view-settings-store';
|
import useFeedViewSettingsStore from '../../stores/use-feed-view-settings-store';
|
||||||
import { useBoardFeedPageSize } from '../../hooks/use-board-feed-page-size';
|
import { useBoardFeedPageSize } from '../../hooks/use-board-feed-page-size';
|
||||||
import { getPageSlice } from '../../lib/utils/board-feed-pagination';
|
import { getPageSlice } from '../../lib/utils/board-feed-pagination';
|
||||||
import { getPageFromFeedPath, getSubplebbitAddress, isDirectoryBoard, stripPageFromFeedPath } from '../../lib/utils/route-utils';
|
import { getPageFromFeedPath, getSubplebbitAddress, isDirectoryBoard, normalizeMultiboardFeedPath, stripPageFromFeedPath } from '../../lib/utils/route-utils';
|
||||||
import ErrorDisplay from '../../components/error-display/error-display';
|
import ErrorDisplay from '../../components/error-display/error-display';
|
||||||
import LoadingEllipsis from '../../components/loading-ellipsis';
|
import LoadingEllipsis from '../../components/loading-ellipsis';
|
||||||
import BoardPagination from '../../components/board-pagination';
|
import BoardPagination from '../../components/board-pagination';
|
||||||
@@ -209,6 +209,8 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, t
|
|||||||
const timeFilterSeconds = timeFilterNameFromCache ? timeFilterNameToSeconds(timeFilterNameFromCache) : timeFilterSecondsFromHook;
|
const timeFilterSeconds = timeFilterNameFromCache ? timeFilterNameToSeconds(timeFilterNameFromCache) : timeFilterSecondsFromHook;
|
||||||
|
|
||||||
const enableInfiniteScroll = useFeedViewSettingsStore((state) => state.enableInfiniteScroll);
|
const enableInfiniteScroll = useFeedViewSettingsStore((state) => state.enableInfiniteScroll);
|
||||||
|
const isForcedInfiniteScroll = isInAllView || isInSubscriptionsView || isInModView;
|
||||||
|
const effectiveInfiniteScroll = enableInfiniteScroll || isForcedInfiniteScroll;
|
||||||
const community = useDirectoryByAddress(isInAllView || isInSubscriptionsView || isInModView ? undefined : subplebbitAddress);
|
const community = useDirectoryByAddress(isInAllView || isInSubscriptionsView || isInModView ? undefined : subplebbitAddress);
|
||||||
const { guiPostsPerPage, maxGuiPages, paginationFeedPostsPerPage, infiniteFeedPostsPerPage } = useBoardFeedPageSize(community);
|
const { guiPostsPerPage, maxGuiPages, paginationFeedPostsPerPage, infiniteFeedPostsPerPage } = useBoardFeedPageSize(community);
|
||||||
|
|
||||||
@@ -216,13 +218,13 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, t
|
|||||||
() => ({
|
() => ({
|
||||||
subplebbitAddresses,
|
subplebbitAddresses,
|
||||||
sortType,
|
sortType,
|
||||||
postsPerPage: enableInfiniteScroll ? infiniteFeedPostsPerPage : paginationFeedPostsPerPage,
|
postsPerPage: effectiveInfiniteScroll ? infiniteFeedPostsPerPage : paginationFeedPostsPerPage,
|
||||||
...(isInAllView || isInSubscriptionsView || isInModView ? { newerThan: timeFilterSeconds } : {}),
|
...(isInAllView || isInSubscriptionsView || isInModView ? { newerThan: timeFilterSeconds } : {}),
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
subplebbitAddresses,
|
subplebbitAddresses,
|
||||||
sortType,
|
sortType,
|
||||||
enableInfiniteScroll,
|
effectiveInfiniteScroll,
|
||||||
infiniteFeedPostsPerPage,
|
infiniteFeedPostsPerPage,
|
||||||
paginationFeedPostsPerPage,
|
paginationFeedPostsPerPage,
|
||||||
isInAllView,
|
isInAllView,
|
||||||
@@ -235,7 +237,7 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, t
|
|||||||
const { feed, hasMore, loadMore, reset, subplebbitAddressesWithNewerPosts } = useFeed(feedOptions);
|
const { feed, hasMore, loadMore, reset, subplebbitAddressesWithNewerPosts } = useFeed(feedOptions);
|
||||||
const { accountComments } = useAccountComments();
|
const { accountComments } = useAccountComments();
|
||||||
|
|
||||||
const feedContextKey = `${isInAllView ? 'all' : isInSubscriptionsView ? 'subs' : isInModView ? 'mod' : (subplebbitAddress ?? 'board')}-${sortType}-${timeFilterSeconds}-${viewType ?? 'board'}-${enableInfiniteScroll}`;
|
const feedContextKey = `${isInAllView ? 'all' : isInSubscriptionsView ? 'subs' : isInModView ? 'mod' : (subplebbitAddress ?? 'board')}-${sortType}-${timeFilterSeconds}-${viewType ?? 'board'}-${effectiveInfiniteScroll}`;
|
||||||
const pathWithoutSettings = location.pathname.replace(/\/settings$/, '');
|
const pathWithoutSettings = location.pathname.replace(/\/settings$/, '');
|
||||||
const currentPage = getPageFromFeedPath(pathWithoutSettings);
|
const currentPage = getPageFromFeedPath(pathWithoutSettings);
|
||||||
const paginationBasePath = stripPageFromFeedPath(pathWithoutSettings);
|
const paginationBasePath = stripPageFromFeedPath(pathWithoutSettings);
|
||||||
@@ -279,30 +281,40 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, t
|
|||||||
}, [feed, filteredComments]);
|
}, [feed, filteredComments]);
|
||||||
|
|
||||||
const cappedFeed = useMemo(
|
const cappedFeed = useMemo(
|
||||||
() => (enableInfiniteScroll ? combinedFeed : combinedFeed.slice(0, guiPostsPerPage * maxGuiPages)),
|
() => (effectiveInfiniteScroll ? combinedFeed : combinedFeed.slice(0, guiPostsPerPage * maxGuiPages)),
|
||||||
[enableInfiniteScroll, combinedFeed, guiPostsPerPage, maxGuiPages],
|
[effectiveInfiniteScroll, combinedFeed, guiPostsPerPage, maxGuiPages],
|
||||||
);
|
);
|
||||||
const totalPages = useMemo(() => Math.min(maxGuiPages, Math.ceil(cappedFeed.length / guiPostsPerPage) || 1), [cappedFeed.length, guiPostsPerPage, maxGuiPages]);
|
const totalPages = useMemo(() => Math.min(maxGuiPages, Math.ceil(cappedFeed.length / guiPostsPerPage) || 1), [cappedFeed.length, guiPostsPerPage, maxGuiPages]);
|
||||||
const currentPageFeed = useMemo(
|
const currentPageFeed = useMemo(
|
||||||
() => (enableInfiniteScroll ? [] : getPageSlice(cappedFeed, currentPage, guiPostsPerPage, maxGuiPages)),
|
() => (effectiveInfiniteScroll ? [] : getPageSlice(cappedFeed, currentPage, guiPostsPerPage, maxGuiPages)),
|
||||||
[enableInfiniteScroll, cappedFeed, currentPage, guiPostsPerPage, maxGuiPages],
|
[effectiveInfiniteScroll, cappedFeed, currentPage, guiPostsPerPage, maxGuiPages],
|
||||||
);
|
);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
// Redirect multiboard paths with page-number segments to normalized path (infinite-scroll only)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!enableInfiniteScroll && currentPage > totalPages && totalPages > 0) {
|
if (!isForcedInfiniteScroll) return;
|
||||||
|
const normalized = normalizeMultiboardFeedPath(location.pathname);
|
||||||
|
if (normalized !== location.pathname) {
|
||||||
|
navigate(normalized, { replace: true });
|
||||||
|
}
|
||||||
|
}, [isForcedInfiniteScroll, location.pathname, navigate]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!effectiveInfiniteScroll && currentPage > totalPages && totalPages > 0) {
|
||||||
const targetPage = totalPages;
|
const targetPage = totalPages;
|
||||||
const targetPath = targetPage === 1 ? paginationBasePath : `${paginationBasePath}/${targetPage}`;
|
const targetPath = targetPage === 1 ? paginationBasePath : `${paginationBasePath}/${targetPage}`;
|
||||||
navigate(targetPage === 1 ? paginationBasePath : `${paginationBasePath}/${targetPage}`, { replace: true });
|
navigate(targetPath, { replace: true });
|
||||||
}
|
}
|
||||||
}, [enableInfiniteScroll, currentPage, totalPages, paginationBasePath, navigate]);
|
}, [effectiveInfiniteScroll, currentPage, totalPages, paginationBasePath, navigate]);
|
||||||
|
|
||||||
// Scroll to top instantly when page changes in pagination mode
|
// Scroll to top instantly when page changes in pagination mode
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!enableInfiniteScroll) {
|
if (!effectiveInfiniteScroll) {
|
||||||
window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
||||||
}
|
}
|
||||||
}, [enableInfiniteScroll, currentPage]);
|
}, [effectiveInfiniteScroll, currentPage]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (filteredComments.length > 0 && !resetTriggeredRef.current) {
|
if (filteredComments.length > 0 && !resetTriggeredRef.current) {
|
||||||
@@ -383,7 +395,7 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, t
|
|||||||
subplebbitState={subplebbitState}
|
subplebbitState={subplebbitState}
|
||||||
subscriptionsLength={subscriptions?.length || 0}
|
subscriptionsLength={subscriptions?.length || 0}
|
||||||
accountSubplebbitAddressesLength={accountSubplebbitAddresses?.length || 0}
|
accountSubplebbitAddressesLength={accountSubplebbitAddresses?.length || 0}
|
||||||
showLoadingEllipsis={enableInfiniteScroll || combinedFeed.length === 0}
|
showLoadingEllipsis={effectiveInfiniteScroll || combinedFeed.length === 0}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
@@ -406,7 +418,7 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, t
|
|||||||
subplebbitState,
|
subplebbitState,
|
||||||
subscriptions?.length,
|
subscriptions?.length,
|
||||||
accountSubplebbitAddresses?.length,
|
accountSubplebbitAddresses?.length,
|
||||||
enableInfiniteScroll,
|
effectiveInfiniteScroll,
|
||||||
combinedFeed.length,
|
combinedFeed.length,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -474,7 +486,7 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, t
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{/* Infinite mode: Virtuoso when hasMore, else plain list */}
|
{/* Infinite mode: Virtuoso when hasMore, else plain list */}
|
||||||
{enableInfiniteScroll ? (
|
{effectiveInfiniteScroll ? (
|
||||||
hasMore ? (
|
hasMore ? (
|
||||||
<Virtuoso
|
<Virtuoso
|
||||||
increaseViewportBy={{ bottom: 1200, top: 1200 }}
|
increaseViewportBy={{ bottom: 1200, top: 1200 }}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
import { useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
||||||
import { Link, useLocation, useNavigationType, useParams } from 'react-router-dom';
|
import { Link, useLocation, useNavigate, useNavigationType, useParams } from 'react-router-dom';
|
||||||
import { Trans, useTranslation } from 'react-i18next';
|
import { Trans, useTranslation } from 'react-i18next';
|
||||||
import { Comment, useAccount, useFeed, useSubplebbit, useAccountComments } from '@plebbit/plebbit-react-hooks';
|
import { Comment, useAccount, useFeed, useSubplebbit, useAccountComments } from '@plebbit/plebbit-react-hooks';
|
||||||
import { Virtuoso, VirtuosoHandle, StateSnapshot } from 'react-virtuoso';
|
import { Virtuoso, VirtuosoHandle, StateSnapshot } from 'react-virtuoso';
|
||||||
@@ -16,7 +16,7 @@ import useFeedResetStore from '../../stores/use-feed-reset-store';
|
|||||||
import useFeedViewSettingsStore from '../../stores/use-feed-view-settings-store';
|
import useFeedViewSettingsStore from '../../stores/use-feed-view-settings-store';
|
||||||
import useSortingStore from '../../stores/use-sorting-store';
|
import useSortingStore from '../../stores/use-sorting-store';
|
||||||
import useCatalogFiltersStore from '../../stores/use-catalog-filters-store';
|
import useCatalogFiltersStore from '../../stores/use-catalog-filters-store';
|
||||||
import { getSubplebbitAddress, isDirectoryBoard } from '../../lib/utils/route-utils';
|
import { getSubplebbitAddress, isDirectoryBoard, normalizeMultiboardFeedPath } from '../../lib/utils/route-utils';
|
||||||
import CatalogRow from '../../components/catalog-row';
|
import CatalogRow from '../../components/catalog-row';
|
||||||
import LoadingEllipsis from '../../components/loading-ellipsis';
|
import LoadingEllipsis from '../../components/loading-ellipsis';
|
||||||
import ErrorDisplay from '../../components/error-display/error-display';
|
import ErrorDisplay from '../../components/error-display/error-display';
|
||||||
@@ -34,6 +34,7 @@ interface CatalogFooterProps {
|
|||||||
onNewerPostsClick: () => void;
|
onNewerPostsClick: () => void;
|
||||||
isInAllView: boolean;
|
isInAllView: boolean;
|
||||||
isInSubscriptionsView: boolean;
|
isInSubscriptionsView: boolean;
|
||||||
|
isInModView: boolean;
|
||||||
showMorePostsSuggestion: boolean;
|
showMorePostsSuggestion: boolean;
|
||||||
weeklyFeedLength: number;
|
weeklyFeedLength: number;
|
||||||
monthlyFeedLength: number;
|
monthlyFeedLength: number;
|
||||||
@@ -56,6 +57,7 @@ const CatalogFooter = ({
|
|||||||
onNewerPostsClick,
|
onNewerPostsClick,
|
||||||
isInAllView,
|
isInAllView,
|
||||||
isInSubscriptionsView,
|
isInSubscriptionsView,
|
||||||
|
isInModView,
|
||||||
showMorePostsSuggestion,
|
showMorePostsSuggestion,
|
||||||
weeklyFeedLength,
|
weeklyFeedLength,
|
||||||
monthlyFeedLength,
|
monthlyFeedLength,
|
||||||
@@ -91,7 +93,7 @@ const CatalogFooter = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
(isInAllView || isInSubscriptionsView) &&
|
(isInAllView || isInSubscriptionsView || isInModView) &&
|
||||||
showMorePostsSuggestion &&
|
showMorePostsSuggestion &&
|
||||||
(monthlyFeedLength > feedLength || yearlyFeedLength > monthlyFeedLength) &&
|
(monthlyFeedLength > feedLength || yearlyFeedLength > monthlyFeedLength) &&
|
||||||
(weeklyFeedLength > feedLength ? (
|
(weeklyFeedLength > feedLength ? (
|
||||||
@@ -100,7 +102,11 @@ const CatalogFooter = ({
|
|||||||
i18nKey='more_threads_last_week'
|
i18nKey='more_threads_last_week'
|
||||||
values={{ currentTimeFilterName, count: feedLength }}
|
values={{ currentTimeFilterName, count: feedLength }}
|
||||||
components={{
|
components={{
|
||||||
1: <Link to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subs/catalog' : `/${boardPath}/catalog`) + '/1w'} />,
|
1: (
|
||||||
|
<Link
|
||||||
|
to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subs/catalog' : isInModView ? '/mod/catalog' : `/${boardPath}/catalog`) + '/1w'}
|
||||||
|
/>
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -110,7 +116,11 @@ const CatalogFooter = ({
|
|||||||
i18nKey='more_threads_last_month'
|
i18nKey='more_threads_last_month'
|
||||||
values={{ currentTimeFilterName, count: feedLength }}
|
values={{ currentTimeFilterName, count: feedLength }}
|
||||||
components={{
|
components={{
|
||||||
1: <Link to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subs/catalog' : `/${boardPath}/catalog`) + '/1m'} />,
|
1: (
|
||||||
|
<Link
|
||||||
|
to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subs/catalog' : isInModView ? '/mod/catalog' : `/${boardPath}/catalog`) + '/1m'}
|
||||||
|
/>
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -120,7 +130,11 @@ const CatalogFooter = ({
|
|||||||
i18nKey='more_threads_last_year'
|
i18nKey='more_threads_last_year'
|
||||||
values={{ currentTimeFilterName, count: feedLength }}
|
values={{ currentTimeFilterName, count: feedLength }}
|
||||||
components={{
|
components={{
|
||||||
1: <Link to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subs/catalog' : `/${boardPath}/catalog`) + '/1y'} />,
|
1: (
|
||||||
|
<Link
|
||||||
|
to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subs/catalog' : isInModView ? '/mod/catalog' : `/${boardPath}/catalog`) + '/1y'}
|
||||||
|
/>
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -282,10 +296,16 @@ export interface CatalogProps {
|
|||||||
const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, timeFilterNameFromCache, isVisible = true }: CatalogProps) => {
|
const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, timeFilterNameFromCache, isVisible = true }: CatalogProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const navigate = useNavigate();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
|
||||||
const isInAllView = viewType ? viewType === 'all' : false;
|
const isInAllView = viewType ? viewType === 'all' : false;
|
||||||
const isInSubscriptionsView = viewType ? viewType === 'subs' : false;
|
const isInSubscriptionsView = viewType ? viewType === 'subs' : false;
|
||||||
|
const isInModView = viewType ? viewType === 'mod' : false;
|
||||||
|
|
||||||
|
const enableInfiniteScroll = useFeedViewSettingsStore((state) => state.enableInfiniteScroll);
|
||||||
|
const isForcedInfiniteScroll = isInAllView || isInSubscriptionsView || isInModView;
|
||||||
|
const effectiveInfiniteScroll = enableInfiniteScroll || isForcedInfiniteScroll;
|
||||||
|
|
||||||
const directories = useDirectories();
|
const directories = useDirectories();
|
||||||
const resolvedAddressFromUrl = useResolvedSubplebbitAddress();
|
const resolvedAddressFromUrl = useResolvedSubplebbitAddress();
|
||||||
@@ -320,10 +340,18 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
const columnCount = Math.floor(useWindowWidth() / columnWidth);
|
const columnCount = Math.floor(useWindowWidth() / columnWidth);
|
||||||
const postsPerPage = columnCount <= 2 ? 10 : columnCount === 3 ? 15 : columnCount === 4 ? 20 : 25;
|
const postsPerPage = columnCount <= 2 ? 10 : columnCount === 3 ? 15 : columnCount === 4 ? 20 : 25;
|
||||||
|
|
||||||
const enableInfiniteScroll = useFeedViewSettingsStore((state) => state.enableInfiniteScroll);
|
const community = useDirectoryByAddress(isInAllView || isInSubscriptionsView || isInModView ? undefined : subplebbitAddress);
|
||||||
const community = useDirectoryByAddress(isInAllView || isInSubscriptionsView ? undefined : subplebbitAddress);
|
|
||||||
const { guiPostsPerPage: boardPostsPerPage, maxGuiPages, paginationFeedPostsPerPage, infiniteFeedPostsPerPage } = useBoardFeedPageSize(community);
|
const { guiPostsPerPage: boardPostsPerPage, maxGuiPages, paginationFeedPostsPerPage, infiniteFeedPostsPerPage } = useBoardFeedPageSize(community);
|
||||||
|
|
||||||
|
// Canonical redirect for multiboard catalog paths with numeric page segment (e.g. /all/catalog/1w/5 -> /all/catalog/1w)
|
||||||
|
useEffect(() => {
|
||||||
|
if (!(isInAllView || isInSubscriptionsView || isInModView)) return;
|
||||||
|
const canonical = normalizeMultiboardFeedPath(location.pathname);
|
||||||
|
if (location.pathname !== canonical) {
|
||||||
|
navigate(canonical, { replace: true });
|
||||||
|
}
|
||||||
|
}, [isInAllView, isInSubscriptionsView, isInModView, location.pathname, navigate]);
|
||||||
|
|
||||||
const { timeFilterSeconds: timeFilterSecondsFromHook, timeFilterName: timeFilterNameFromHook } = useTimeFilter();
|
const { timeFilterSeconds: timeFilterSecondsFromHook, timeFilterName: timeFilterNameFromHook } = useTimeFilter();
|
||||||
const { sortType } = useSortingStore();
|
const { sortType } = useSortingStore();
|
||||||
const timeFilterName = timeFilterNameFromCache || timeFilterNameFromHook;
|
const timeFilterName = timeFilterNameFromCache || timeFilterNameFromHook;
|
||||||
@@ -344,7 +372,13 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
|
|
||||||
const feedOptions = useMemo(() => {
|
const feedOptions = useMemo(() => {
|
||||||
const catalogPostsPerPage =
|
const catalogPostsPerPage =
|
||||||
isInAllView || isInSubscriptionsView ? (enableInfiniteScroll ? 10 : 100) : enableInfiniteScroll ? infiniteFeedPostsPerPage : paginationFeedPostsPerPage;
|
isInAllView || isInSubscriptionsView || isInModView
|
||||||
|
? effectiveInfiniteScroll
|
||||||
|
? 10
|
||||||
|
: 100
|
||||||
|
: effectiveInfiniteScroll
|
||||||
|
? infiniteFeedPostsPerPage
|
||||||
|
: paginationFeedPostsPerPage;
|
||||||
|
|
||||||
const options: any = {
|
const options: any = {
|
||||||
subplebbitAddresses,
|
subplebbitAddresses,
|
||||||
@@ -353,7 +387,7 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
filter: createCombinedFilter(filterItems, searchText, subplebbitAddress || 'all', handleFilterMatch),
|
filter: createCombinedFilter(filterItems, searchText, subplebbitAddress || 'all', handleFilterMatch),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isInAllView || isInSubscriptionsView) {
|
if (isInAllView || isInSubscriptionsView || isInModView) {
|
||||||
options.newerThan = timeFilterSeconds;
|
options.newerThan = timeFilterSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,7 +397,8 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
sortType,
|
sortType,
|
||||||
isInAllView,
|
isInAllView,
|
||||||
isInSubscriptionsView,
|
isInSubscriptionsView,
|
||||||
enableInfiniteScroll,
|
isInModView,
|
||||||
|
effectiveInfiniteScroll,
|
||||||
infiniteFeedPostsPerPage,
|
infiniteFeedPostsPerPage,
|
||||||
paginationFeedPostsPerPage,
|
paginationFeedPostsPerPage,
|
||||||
timeFilterSeconds,
|
timeFilterSeconds,
|
||||||
@@ -420,8 +455,8 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
}, [feed, filteredComments]);
|
}, [feed, filteredComments]);
|
||||||
|
|
||||||
const cappedFeed = useMemo(
|
const cappedFeed = useMemo(
|
||||||
() => (enableInfiniteScroll ? combinedFeed : combinedFeed.slice(0, boardPostsPerPage * maxGuiPages)),
|
() => (effectiveInfiniteScroll ? combinedFeed : combinedFeed.slice(0, boardPostsPerPage * maxGuiPages)),
|
||||||
[enableInfiniteScroll, combinedFeed, boardPostsPerPage, maxGuiPages],
|
[effectiveInfiniteScroll, combinedFeed, boardPostsPerPage, maxGuiPages],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -499,13 +534,14 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
onNewerPostsClick={handleNewerPostsButtonClick}
|
onNewerPostsClick={handleNewerPostsButtonClick}
|
||||||
isInAllView={isInAllView}
|
isInAllView={isInAllView}
|
||||||
isInSubscriptionsView={isInSubscriptionsView}
|
isInSubscriptionsView={isInSubscriptionsView}
|
||||||
|
isInModView={isInModView}
|
||||||
showMorePostsSuggestion={showMorePostsSuggestion}
|
showMorePostsSuggestion={showMorePostsSuggestion}
|
||||||
weeklyFeedLength={weeklyFeedLength}
|
weeklyFeedLength={weeklyFeedLength}
|
||||||
monthlyFeedLength={monthlyFeedLength}
|
monthlyFeedLength={monthlyFeedLength}
|
||||||
yearlyFeedLength={yearlyFeedLength}
|
yearlyFeedLength={yearlyFeedLength}
|
||||||
boardPath={boardPath}
|
boardPath={boardPath}
|
||||||
currentTimeFilterName={currentTimeFilterName}
|
currentTimeFilterName={currentTimeFilterName}
|
||||||
showLoadingEllipsis={enableInfiniteScroll}
|
showLoadingEllipsis={effectiveInfiniteScroll}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
@@ -518,13 +554,14 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
handleNewerPostsButtonClick,
|
handleNewerPostsButtonClick,
|
||||||
isInAllView,
|
isInAllView,
|
||||||
isInSubscriptionsView,
|
isInSubscriptionsView,
|
||||||
|
isInModView,
|
||||||
showMorePostsSuggestion,
|
showMorePostsSuggestion,
|
||||||
weeklyFeedLength,
|
weeklyFeedLength,
|
||||||
monthlyFeedLength,
|
monthlyFeedLength,
|
||||||
yearlyFeedLength,
|
yearlyFeedLength,
|
||||||
boardPath,
|
boardPath,
|
||||||
currentTimeFilterName,
|
currentTimeFilterName,
|
||||||
enableInfiniteScroll,
|
effectiveInfiniteScroll,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -650,7 +687,7 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
<div className={styles.catalog}>
|
<div className={styles.catalog}>
|
||||||
{processedFeed?.length !== 0 ? (
|
{processedFeed?.length !== 0 ? (
|
||||||
<>
|
<>
|
||||||
{enableInfiniteScroll ? (
|
{effectiveInfiniteScroll ? (
|
||||||
hasMore ? (
|
hasMore ? (
|
||||||
<Virtuoso
|
<Virtuoso
|
||||||
increaseViewportBy={{ bottom: 1200, top: 1200 }}
|
increaseViewportBy={{ bottom: 1200, top: 1200 }}
|
||||||
@@ -678,6 +715,7 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
onNewerPostsClick={handleNewerPostsButtonClick}
|
onNewerPostsClick={handleNewerPostsButtonClick}
|
||||||
isInAllView={isInAllView}
|
isInAllView={isInAllView}
|
||||||
isInSubscriptionsView={isInSubscriptionsView}
|
isInSubscriptionsView={isInSubscriptionsView}
|
||||||
|
isInModView={isInModView}
|
||||||
showMorePostsSuggestion={showMorePostsSuggestion}
|
showMorePostsSuggestion={showMorePostsSuggestion}
|
||||||
weeklyFeedLength={weeklyFeedLength}
|
weeklyFeedLength={weeklyFeedLength}
|
||||||
monthlyFeedLength={monthlyFeedLength}
|
monthlyFeedLength={monthlyFeedLength}
|
||||||
@@ -702,6 +740,7 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
onNewerPostsClick={handleNewerPostsButtonClick}
|
onNewerPostsClick={handleNewerPostsButtonClick}
|
||||||
isInAllView={isInAllView}
|
isInAllView={isInAllView}
|
||||||
isInSubscriptionsView={isInSubscriptionsView}
|
isInSubscriptionsView={isInSubscriptionsView}
|
||||||
|
isInModView={isInModView}
|
||||||
showMorePostsSuggestion={showMorePostsSuggestion}
|
showMorePostsSuggestion={showMorePostsSuggestion}
|
||||||
weeklyFeedLength={weeklyFeedLength}
|
weeklyFeedLength={weeklyFeedLength}
|
||||||
monthlyFeedLength={monthlyFeedLength}
|
monthlyFeedLength={monthlyFeedLength}
|
||||||
|
|||||||
Reference in New Issue
Block a user