mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Update post-form
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Challenge as ChallengeType, useComment } from '@plebbit/plebbit-react-hooks';
|
import Draggable from 'react-draggable';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { Challenge as ChallengeType } from '@plebbit/plebbit-react-hooks';
|
||||||
|
import { getPublicationType } from '../../lib/utils/challenge-utils';
|
||||||
import useChallenges from '../../hooks/use-challenges';
|
import useChallenges from '../../hooks/use-challenges';
|
||||||
import styles from './challenge-modal.module.css';
|
import styles from './challenge-modal.module.css';
|
||||||
import { getPublicationType } from '../../lib/utils/challenge-utils';
|
|
||||||
import Draggable from 'react-draggable';
|
|
||||||
|
|
||||||
interface ChallengeProps {
|
interface ChallengeProps {
|
||||||
challenge: ChallengeType;
|
challenge: ChallengeType;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
padding: var(--post-form-field-title-padding);
|
padding: var(--post-form-field-title-padding);
|
||||||
font-size: var(--post-form-field-title-font-size);
|
font-size: var(--post-form-field-title-font-size);
|
||||||
width: 80px;
|
width: 80px;
|
||||||
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.postFormTable td {
|
.postFormTable td {
|
||||||
@@ -78,7 +79,11 @@
|
|||||||
|
|
||||||
.postFormTable button {
|
.postFormTable button {
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
|
bottom: 0px;
|
||||||
filter: var(--filter80);
|
filter: var(--filter80);
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.linkType {
|
.linkType {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { isValidURL } from '../../lib/utils/url-utils';
|
|||||||
import { isDescriptionView, isPostPageView, isRulesView } from '../../lib/utils/view-utils';
|
import { isDescriptionView, isPostPageView, isRulesView } from '../../lib/utils/view-utils';
|
||||||
import challengesStore from '../../hooks/use-challenges';
|
import challengesStore from '../../hooks/use-challenges';
|
||||||
import useReply from '../../hooks/use-reply';
|
import useReply from '../../hooks/use-reply';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
type SubmitState = {
|
type SubmitState = {
|
||||||
subplebbitAddress: string | undefined;
|
subplebbitAddress: string | undefined;
|
||||||
@@ -58,6 +59,7 @@ const LinkTypePreviewer = ({ link }: { link: string }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const PostFormTable = () => {
|
const PostFormTable = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const account = useAccount();
|
const account = useAccount();
|
||||||
const { displayName } = account?.author || {};
|
const { displayName } = account?.author || {};
|
||||||
|
|
||||||
@@ -134,20 +136,20 @@ const PostFormTable = () => {
|
|||||||
<table className={styles.postFormTable}>
|
<table className={styles.postFormTable}>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Name</td>
|
<td>{t('name')}</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<input
|
||||||
type='text'
|
type='text'
|
||||||
placeholder={!displayName ? 'Anonymous' : undefined}
|
placeholder={!displayName ? _.capitalize(t('anonymous')) : undefined}
|
||||||
defaultValue={displayName || undefined}
|
defaultValue={displayName || undefined}
|
||||||
onChange={(e) => setAccount({ ...account, author: { ...account?.author, displayName: e.target.value } })}
|
onChange={(e) => setAccount({ ...account, author: { ...account?.author, displayName: e.target.value } })}
|
||||||
/>
|
/>
|
||||||
<button onClick={onPublishReply}>Post</button>
|
{isInPostPage && <button onClick={onPublishReply}>{t('post')}</button>}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{!isInPostPage && (
|
{!isInPostPage && (
|
||||||
<tr>
|
<tr>
|
||||||
<td>Subject</td>
|
<td>{t('subject')}</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<input
|
||||||
type='text'
|
type='text'
|
||||||
@@ -155,12 +157,12 @@ const PostFormTable = () => {
|
|||||||
setSubmitStore({ title: e.target.value });
|
setSubmitStore({ title: e.target.value });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<button onClick={onPublishPost}>Post</button>
|
<button onClick={onPublishPost}>{t('post')}</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
<tr>
|
<tr>
|
||||||
<td>Comment</td>
|
<td>{t('comment')}</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea
|
<textarea
|
||||||
cols={48}
|
cols={48}
|
||||||
@@ -174,7 +176,7 @@ const PostFormTable = () => {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Link</td>
|
<td>{t('link')}</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<input
|
||||||
type='text'
|
type='text'
|
||||||
|
|||||||
Reference in New Issue
Block a user