mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
update app layout, add 'thread closed' banner
This commit is contained in:
@@ -10,6 +10,15 @@
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.closed {
|
||||
font-size: x-large;
|
||||
text-align: center;
|
||||
color: red;
|
||||
font-weight: 700;
|
||||
padding-top: 100px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.postFormButtonDesktop {
|
||||
display: none;
|
||||
|
||||
@@ -1,26 +1,39 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import styles from './post-form.module.css';
|
||||
import { isPostPageView } from '../../lib/utils/view-utils';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import { useComment } from '@plebbit/plebbit-react-hooks';
|
||||
import { isPostPageView } from '../../lib/utils/view-utils';
|
||||
import styles from './post-form.module.css';
|
||||
|
||||
export interface PostFormProps {
|
||||
address: string | undefined;
|
||||
}
|
||||
|
||||
const PostForm = ({ address }: PostFormProps) => {
|
||||
const PostForm = () => {
|
||||
const { t } = useTranslation();
|
||||
const { subplebbitAddress, commentCid } = useParams<{ subplebbitAddress: string; commentCid: string }>();
|
||||
|
||||
const comment = useComment({ commentCid });
|
||||
const { deleted, locked, removed } = comment || {};
|
||||
const isThreadClosed = deleted || locked || removed;
|
||||
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const isInPostPage = isPostPageView(useLocation().pathname, useParams());
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={styles.postFormButtonDesktop}>
|
||||
[
|
||||
<button className='button' onClick={() => setShowForm(true)}>
|
||||
{isInPostPage ? t('post_a_reply') : t('start_new_thread')}
|
||||
</button>
|
||||
]
|
||||
{isThreadClosed ? (
|
||||
<div className={styles.closed}>
|
||||
Thread closed.
|
||||
<br />
|
||||
You may not reply at this time.
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
[
|
||||
<button className='button' onClick={() => setShowForm(true)}>
|
||||
{isInPostPage ? t('post_a_reply') : t('start_new_thread')}
|
||||
</button>
|
||||
]
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.postFormButtonMobile}>
|
||||
<button className='button' onClick={() => setShowForm(!showForm)}>
|
||||
|
||||
Reference in New Issue
Block a user