Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit description length for map pins to 70 characters #926

Merged
merged 3 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/pages/Maps/Content/View/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export class Popup extends React.Component<IProps> {
: g.type === pin.type
})
const { lastActive, heroImageUrl, shortDescription, name } = pin.detail
const description =
shortDescription.length > 70
? shortDescription.substr(0, 70) + '...'
: shortDescription
const lastActiveText = lastActive
? distanceInWords(lastActive, new Date())
: 'a long time'
Expand All @@ -116,8 +120,8 @@ export class Popup extends React.Component<IProps> {
{name}
</Text>
</Link>
<Text auxiliary small clipped mb={2}>
{shortDescription}
<Text small mb={2} style={{ wordBreak: 'break-word' }}>
{description}
</Text>
<LastOnline>last active {lastActiveText} ago</LastOnline>
{pin.moderation !== 'accepted' && (
Expand Down
7 changes: 5 additions & 2 deletions src/pages/Settings/content/formSections/MapPin.section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,16 @@ export class UserMapPinSection extends React.Component<IProps, IState> {
</Flex>
<Box sx={{ display: isOpen ? 'block' : 'none' }}>
<Text mb={2} mt={4} medium>
Short description of your pin *
Short description of your pin*
</Text>
<Field
data-cy="pin-description"
name="mapPinDescription"
component={TextAreaField}
placeholder="We are shredding plastic in Plymouth, UK."
maxLength="70"
style={{ height: 'inherit' }}
rows="1"
placeholder="Short description of your pin (max 70 characters)"
validate={required}
/>
{!initialFormValues.location || editAddress ? (
Expand Down