Skip to content

Commit

Permalink
Add information tooltip to privacy dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Jan 25, 2024
1 parent 6266754 commit e50f446
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const defaultMediaVisibility = (status) => {

const messages = defineMessages({
public_short: { id: 'privacy.public.short', defaultMessage: 'Public' },
unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Low-key public' },
unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Quiet public' },
private_short: { id: 'privacy.private.short', defaultMessage: 'Followers' },
direct_short: { id: 'privacy.direct.short', defaultMessage: 'Specific people' },
edited: { id: 'status.edited', defaultMessage: 'Edited {date}' },
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/visibility_icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const messages = defineMessages({
public_short: { id: 'privacy.public.short', defaultMessage: 'Public' },
unlisted_short: {
id: 'privacy.unlisted.short',
defaultMessage: 'Low-key public',
defaultMessage: 'Quiet public',
},
private_short: {
id: 'privacy.private.short',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { supportsPassiveEvents } from 'detect-passive-events';
import Overlay from 'react-overlays/Overlay';

import AlternateEmailIcon from '@/material-icons/400-24px/alternate_email.svg?react';
import InfoIcon from '@/material-icons/400-24px/info.svg?react';
import LockIcon from '@/material-icons/400-24px/lock.svg?react';
import PublicIcon from '@/material-icons/400-24px/public.svg?react';
import QuietTimeIcon from '@/material-icons/400-24px/quiet_time.svg?react';
Expand All @@ -17,13 +18,14 @@ import { Icon } from 'mastodon/components/icon';
const messages = defineMessages({
public_short: { id: 'privacy.public.short', defaultMessage: 'Public' },
public_long: { id: 'privacy.public.long', defaultMessage: 'Anyone on and off Mastodon' },
unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Low-key public' },
unlisted_long: { id: 'privacy.unlisted.long', defaultMessage: 'Public with less reach' },
unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Quiet public' },
unlisted_long: { id: 'privacy.unlisted.long', defaultMessage: 'Fewer algorithmic fanfares' },
private_short: { id: 'privacy.private.short', defaultMessage: 'Followers' },
private_long: { id: 'privacy.private.long', defaultMessage: 'Only your followers' },
direct_short: { id: 'privacy.direct.short', defaultMessage: 'Specific people' },
direct_long: { id: 'privacy.direct.long', defaultMessage: 'Everyone mentioned in the post' },
change_privacy: { id: 'privacy.change', defaultMessage: 'Change post privacy' },
unlisted_extra: { id: 'privacy.unlisted.additional', defaultMessage: 'This behaves exactly like public, except the post will not appear in live feeds or hashtags, explore, or Mastodon search, even if you are opted-in account-wide.' },
});

const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true;
Expand Down Expand Up @@ -132,6 +134,12 @@ class PrivacyDropdownMenu extends PureComponent {
<strong>{item.text}</strong>
{item.meta}
</div>

{item.extra && (
<div className='privacy-dropdown__option__additional' title={item.extra}>
<Icon icon={InfoIcon} />
</div>
)}
</div>
))}
</div>
Expand Down Expand Up @@ -206,7 +214,7 @@ class PrivacyDropdown extends PureComponent {

this.options = [
{ icon: 'globe', iconComponent: PublicIcon, value: 'public', text: formatMessage(messages.public_short), meta: formatMessage(messages.public_long) },
{ icon: 'unlock', iconComponent: QuietTimeIcon, value: 'unlisted', text: formatMessage(messages.unlisted_short), meta: formatMessage(messages.unlisted_long) },
{ icon: 'unlock', iconComponent: QuietTimeIcon, value: 'unlisted', text: formatMessage(messages.unlisted_short), meta: formatMessage(messages.unlisted_long), extra: formatMessage(messages.unlisted_extra) },
{ icon: 'lock', iconComponent: LockIcon, value: 'private', text: formatMessage(messages.private_short), meta: formatMessage(messages.private_long) },
];

Expand Down
5 changes: 3 additions & 2 deletions app/javascript/mastodon/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,9 @@
"privacy.private.short": "Followers",
"privacy.public.long": "Anyone on and off Mastodon",
"privacy.public.short": "Public",
"privacy.unlisted.long": "Public with less reach",
"privacy.unlisted.short": "Low-key public",
"privacy.unlisted.additional": "This behaves exactly like public, except the post will not appear in live feeds or hashtags, explore, or Mastodon search, even if you are opted-in account-wide.",
"privacy.unlisted.long": "Fewer algorithmic fanfares",
"privacy.unlisted.short": "Quiet public",
"privacy_policy.last_updated": "Last updated {date}",
"privacy_policy.title": "Privacy Policy",
"recommended": "Recommended",
Expand Down
12 changes: 11 additions & 1 deletion app/javascript/styles/mastodon/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4978,6 +4978,7 @@ a.status-card {
padding: 8px 12px;
cursor: pointer;
display: flex;
align-items: center;
gap: 12px;
border-radius: 4px;
color: $primary-text-color;
Expand All @@ -4994,10 +4995,19 @@ a.status-card {
outline: 0;

.privacy-dropdown__option__content,
.privacy-dropdown__option__content strong {
.privacy-dropdown__option__content strong,
.privacy-dropdown__option__additional {
color: $primary-text-color;
}
}

&__additional {
display: flex;
align-items: center;
justify-content: center;
color: $darker-text-color;
cursor: help;
}
}

.privacy-dropdown__option__icon {
Expand Down

0 comments on commit e50f446

Please sign in to comment.