mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix: p/all description showed "undefined" in window title
This commit is contained in:
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Comment, Role, useComment, useEditedComment, useSubplebbit } from '@plebbit/plebbit-react-hooks';
|
import { Comment, Role, useComment, useEditedComment, useSubplebbit } from '@plebbit/plebbit-react-hooks';
|
||||||
import { useLocation, useParams } from 'react-router-dom';
|
import { useLocation, useParams } from 'react-router-dom';
|
||||||
import { isDescriptionView, isRulesView, isSettingsView } from '../../lib/utils/view-utils';
|
import { isAllView, isDescriptionView, isRulesView, isSettingsView } from '../../lib/utils/view-utils';
|
||||||
import useIsMobile from '../../hooks/use-is-mobile';
|
import useIsMobile from '../../hooks/use-is-mobile';
|
||||||
import useReplyModal from '../../hooks/use-reply-modal';
|
import useReplyModal from '../../hooks/use-reply-modal';
|
||||||
import PostDesktop from '../../components/post-desktop';
|
import PostDesktop from '../../components/post-desktop';
|
||||||
@@ -55,6 +55,7 @@ const PostPage = () => {
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { commentCid, subplebbitAddress } = params;
|
const { commentCid, subplebbitAddress } = params;
|
||||||
|
const isInAllView = isAllView(location.pathname, params);
|
||||||
const isInSettigsView = isSettingsView(location.pathname, params);
|
const isInSettigsView = isSettingsView(location.pathname, params);
|
||||||
const isInDescriptionView = isDescriptionView(location.pathname, params);
|
const isInDescriptionView = isDescriptionView(location.pathname, params);
|
||||||
const isInRulesView = isRulesView(location.pathname, params);
|
const isInRulesView = isRulesView(location.pathname, params);
|
||||||
@@ -85,8 +86,9 @@ const PostPage = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const boardTitle = title ? title : shortAddress || subplebbitAddress;
|
const boardTitle = title ? title : shortAddress || subplebbitAddress;
|
||||||
const postTitle = post?.title?.slice(0, 30) || post?.content?.slice(0, 30);
|
const postTitle = post?.title?.slice(0, 30) || post?.content?.slice(0, 30);
|
||||||
document.title = (postTitle ? postTitle.trim() + '... - ' : '') + boardTitle + ' - plebchan';
|
const postDucumentTitle = (postTitle ? postTitle.trim() + '... - ' : '') + boardTitle + ' - plebchan';
|
||||||
}, [title, shortAddress, subplebbitAddress, post?.title, post?.content]);
|
document.title = isInAllView ? `${t('all')} - plebchan` : postDucumentTitle;
|
||||||
|
}, [title, shortAddress, subplebbitAddress, post?.title, post?.content, isInAllView, t]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
|
|||||||
Reference in New Issue
Block a user