diff --git a/components/bounty-form.js b/components/bounty-form.js index 7d0696e3..41c8da17 100644 --- a/components/bounty-form.js +++ b/components/bounty-form.js @@ -10,6 +10,7 @@ import { SubSelectInitial } from './sub-select-form' import CancelButton from './cancel-button' import { useCallback } from 'react' import { normalizeForwards } from '../lib/form' +import { MAX_TITLE_LENGTH } from '../lib/constants' export function BountyForm ({ item, @@ -98,7 +99,14 @@ export function BountyForm ({ storageKeyPrefix={item ? undefined : 'bounty'} > {children} - + sats} diff --git a/components/discussion-form.js b/components/discussion-form.js index 08b15575..00b5ec79 100644 --- a/components/discussion-form.js +++ b/components/discussion-form.js @@ -14,6 +14,7 @@ import { SubSelectInitial } from './sub-select-form' import CancelButton from './cancel-button' import { useCallback } from 'react' import { normalizeForwards } from '../lib/form' +import { MAX_TITLE_LENGTH } from '../lib/constants' export function DiscussionForm ({ item, sub, editThreshold, titleLabel = 'title', @@ -101,6 +102,7 @@ export function DiscussionForm ({ }) } }} + maxLength={MAX_TITLE_LENGTH} /> )} + {props.maxLength && ( + + {`${numWithUnits(props.maxLength - (field.value || '').length, { abbreviate: false, unitSingular: 'character', unitPlural: 'characters' })} remaining`} + + )} ) } diff --git a/components/job-form.js b/components/job-form.js index a710fb3b..938c515b 100644 --- a/components/job-form.js +++ b/components/job-form.js @@ -17,6 +17,7 @@ import Avatar from './avatar' import ActionTooltip from './action-tooltip' import { jobSchema } from '../lib/validate' import CancelButton from './cancel-button' +import { MAX_TITLE_LENGTH } from '../lib/constants' function satsMin2Mo (minute) { return minute * 30 * 24 * 60 @@ -116,6 +117,7 @@ export default function JobForm ({ item, sub }) { required autoFocus clear + maxLength={MAX_TITLE_LENGTH} /> : null} + maxLength={MAX_POLL_CHOICE_LENGTH} />