mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix bugs
This commit is contained in:
@@ -17,10 +17,22 @@ interface BoardButtonsProps {
|
||||
|
||||
const CatalogButton = ({ address, isInAllView, isInSubscriptionsView }: BoardButtonsProps) => {
|
||||
const { t } = useTranslation();
|
||||
const link = isInAllView ? `/p/all/catalog` : isInSubscriptionsView ? `/p/subscriptions/catalog` : `/p/${address}/catalog`;
|
||||
const params = useParams();
|
||||
|
||||
const createCatalogLink = () => {
|
||||
if (isInAllView) {
|
||||
if (params?.timeFilterName) return `/p/all/catalog/${params.timeFilterName}`;
|
||||
return `/p/all/catalog`;
|
||||
} else if (isInSubscriptionsView) {
|
||||
if (params?.timeFilterName) return `/p/subscriptions/catalog/${params.timeFilterName}`;
|
||||
return `/p/subscriptions/catalog`;
|
||||
}
|
||||
return `/p/${address}/catalog`;
|
||||
};
|
||||
|
||||
return (
|
||||
<button className='button'>
|
||||
<Link to={link}>{t('catalog')}</Link>
|
||||
<Link to={createCatalogLink()}>{t('catalog')}</Link>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
@@ -38,10 +50,22 @@ const SubscribeButton = ({ address }: BoardButtonsProps) => {
|
||||
|
||||
const ReturnButton = ({ address, isInAllView, isInSubscriptionsView }: BoardButtonsProps) => {
|
||||
const { t } = useTranslation();
|
||||
const link = isInAllView ? `/p/all` : isInSubscriptionsView ? `/p/subscriptions` : `/p/${address}`;
|
||||
const params = useParams();
|
||||
|
||||
const createReturnLink = () => {
|
||||
if (isInAllView) {
|
||||
if (params?.timeFilterName) return `/p/all/${params.timeFilterName}`;
|
||||
return `/p/all`;
|
||||
} else if (isInSubscriptionsView) {
|
||||
if (params?.timeFilterName) return `/p/subscriptions/${params.timeFilterName}`;
|
||||
return `/p/subscriptions`;
|
||||
}
|
||||
return `/p/${address}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<button className='button'>
|
||||
<Link to={link}>{t('return')}</Link>
|
||||
<Link to={createReturnLink()}>{t('return')}</Link>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
@@ -66,7 +90,7 @@ const SortOptions = () => {
|
||||
};
|
||||
return (
|
||||
<>
|
||||
{t('sort_by')}:
|
||||
<span className='capitalize'>{t('sort_by')}</span>:
|
||||
<select value={sortType} onChange={handleSortChange}>
|
||||
<option value='active'>{t('bump_order')}</option>
|
||||
<option value='new'>{t('creation_date')}</option>
|
||||
|
||||
@@ -164,7 +164,7 @@ const CatalogPost = ({ post }: { post: Comment }) => {
|
||||
return (
|
||||
<>
|
||||
<div className={styles.post}>
|
||||
<div onMouseOver={() => setHoveredCid(cid)} onMouseLeave={() => setHoveredCid(null)}>
|
||||
<div onMouseOver={() => setHoveredCid(isDescription ? 'd' : isRules ? 'r' : cid)} onMouseLeave={() => setHoveredCid(null)}>
|
||||
{hasThumbnail ? (
|
||||
<Link to={postLink}>
|
||||
<div
|
||||
|
||||
@@ -20,11 +20,13 @@ export const isCatalogView = (pathname: string, params: ParamsType): boolean =>
|
||||
const decodedPathname = decodeURIComponent(pathname);
|
||||
|
||||
return (
|
||||
decodedPathname === `/p/${subplebbitAddress}/catalog` ||
|
||||
decodedPathname === `/p/${subplebbitAddress}/catalog/settings` ||
|
||||
decodedPathname === `/p/all/catalog/settings` ||
|
||||
decodedPathname === `/p/all/catalog` ||
|
||||
decodedPathname === `/p/all/catalog/settings` ||
|
||||
decodedPathname === `/p/all/catalog/${timeFilterName}` ||
|
||||
decodedPathname === `/p/subscriptions/catalog` ||
|
||||
decodedPathname === `/p/subscriptions/catalog/settings` ||
|
||||
decodedPathname === `/p/subscriptions/catalog/${timeFilterName}`
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user