Merge pull request #3608 from sharlayan/glitch-1
Fix local-only indicator in detailed status
This commit is contained in:
1 parent
33b4d7b1e6
commit
839591f21b
1 file changed
+24
-1
@@ -6,11 +6,12 @@
|
||||
import type { CSSProperties } from 'react';
|
||||
import { useState, useRef, useCallback, useEffect } from 'react';
|
||||
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import HomeIcon from '@/material-icons/400-24px/home.svg?react';
|
||||
import { AnimatedNumber } from 'flavours/glitch/components/animated_number';
|
||||
import AttachmentList from 'flavours/glitch/components/attachment_list';
|
||||
import { Avatar } from 'flavours/glitch/components/avatar';
|
||||
@@ -21,6 +22,7 @@ import { FilterWarning } from 'flavours/glitch/components/filter_warning';
|
||||
import { FormattedDateWrapper } from 'flavours/glitch/components/formatted_date';
|
||||
import type { StatusLike } from 'flavours/glitch/components/hashtag_bar';
|
||||
import { getHashtagBarForStatus } from 'flavours/glitch/components/hashtag_bar';
|
||||
import { Icon } from 'flavours/glitch/components/icon';
|
||||
import { IconLogo } from 'flavours/glitch/components/logo';
|
||||
import MediaGallery from 'flavours/glitch/components/media_gallery';
|
||||
import { MentionsPlaceholder } from 'flavours/glitch/components/mentions_placeholder';
|
||||
@@ -40,6 +42,13 @@ import { compareUrls } from 'flavours/glitch/utils/compare_urls';
|
||||
|
||||
import Card from './card';
|
||||
|
||||
const messages = defineMessages({
|
||||
localOnly: {
|
||||
id: 'status.local_only',
|
||||
defaultMessage: 'Only visible from your instance',
|
||||
},
|
||||
});
|
||||
|
||||
interface VideoModalOptions {
|
||||
startTime: number;
|
||||
autoPlay?: boolean;
|
||||
@@ -85,6 +94,7 @@ export const DetailedStatus: React.FC<{
|
||||
const [height, setHeight] = useState(0);
|
||||
const [showDespiteFilter, setShowDespiteFilter] = useState(false);
|
||||
const nodeRef = useRef<HTMLDivElement>(null);
|
||||
const intl = useIntl();
|
||||
|
||||
const letterboxMedia = useAppSelector(
|
||||
(state) =>
|
||||
@@ -359,6 +369,18 @@ export const DetailedStatus: React.FC<{
|
||||
</>
|
||||
);
|
||||
|
||||
const localOnlyLink = status.get('local_only') ? (
|
||||
<>
|
||||
·
|
||||
<Icon
|
||||
id='home'
|
||||
icon={HomeIcon}
|
||||
className='status__visibility-icon'
|
||||
aria-label={intl.formatMessage(messages.localOnly)}
|
||||
/>
|
||||
</>
|
||||
) : null;
|
||||
|
||||
if (['private', 'direct'].includes(status.get('visibility') as string)) {
|
||||
reblogLink = '';
|
||||
} else {
|
||||
@@ -547,6 +569,7 @@ export const DetailedStatus: React.FC<{
|
||||
/>
|
||||
</a>
|
||||
|
||||
{localOnlyLink}
|
||||
{visibilityLink}
|
||||
{applicationLink}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user