Merge commit '96e23af89258068d05cc8557df914b4a9add385b' into glitch-soc/merge-upstream
This commit is contained in:
commit
bbbbb24dbd
21 files changed
+289
-28
No files matched your search
@@ -41,6 +41,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
|
||||
const account = useAccount(accountId);
|
||||
const { suspended, blockedBy, hidden } = useAccountVisibility(accountId);
|
||||
const forceEmptyState = suspended || blockedBy || hidden;
|
||||
const isOwnProfile = accountId === me;
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
@@ -69,10 +70,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
|
||||
|
||||
const { listedCollections = [], unlistedCollections = [] } = Object.groupBy(
|
||||
collections,
|
||||
(item) =>
|
||||
item.discoverable && !!item.item_count
|
||||
? 'listedCollections'
|
||||
: 'unlistedCollections',
|
||||
(item) => (item.discoverable ? 'listedCollections' : 'unlistedCollections'),
|
||||
);
|
||||
|
||||
const renderListItem = useCallback(
|
||||
@@ -166,7 +164,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
|
||||
defaultMessage='Collections'
|
||||
/>
|
||||
</h2>
|
||||
{accountId === me && (
|
||||
{isOwnProfile && (
|
||||
<SubheadingLink to='/collections/new' icon={AddIcon}>
|
||||
<FormattedMessage
|
||||
id='account.featured.new_collection'
|
||||
@@ -179,7 +177,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
|
||||
<ItemList>
|
||||
<TruncatedListItems
|
||||
visibleItems={listedCollections}
|
||||
truncatedItems={unlistedCollections}
|
||||
truncatedItems={isOwnProfile ? unlistedCollections : []}
|
||||
toggleButton={{
|
||||
title: (
|
||||
<FormattedMessage
|
||||
|
||||
@@ -193,7 +193,11 @@ const Compose: React.FC<{ multiColumn: boolean }> = ({ multiColumn }) => {
|
||||
/>
|
||||
|
||||
<div className='scrollable'>
|
||||
<ComposeFormContainer />
|
||||
<ComposeFormContainer
|
||||
// This is fine on this single-purpose view
|
||||
// eslint-disable-next-line jsx-a11y/no-autofocus
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Helmet>
|
||||
|
||||
@@ -263,7 +263,7 @@ export const NavigationPanel: React.FC<{ multiColumn?: boolean }> = ({
|
||||
{!multiColumn && (
|
||||
<li>
|
||||
<ColumnLink
|
||||
to='/publish'
|
||||
to={{ pathname: '/publish', state: { focusTarget: false } }}
|
||||
icon='plus'
|
||||
iconComponent={AddIcon}
|
||||
activeIconComponent={AddIcon}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Blurhash } from 'mastodon/components/blurhash';
|
||||
import { Icon } from 'mastodon/components/icon';
|
||||
import { MoreFromAuthor } from 'mastodon/components/more_from_author';
|
||||
import { RelativeTimestamp } from 'mastodon/components/relative_timestamp';
|
||||
import { useBlurhash } from 'mastodon/initial_state';
|
||||
import { displayMedia, useBlurhash } from 'mastodon/initial_state';
|
||||
import type { Card as CardType } from 'mastodon/models/status';
|
||||
|
||||
const IDNA_PREFIX = 'xn--';
|
||||
@@ -63,6 +63,8 @@ const handleIframeUrl = (html: string, url: string, providerName: string) => {
|
||||
return html;
|
||||
};
|
||||
|
||||
const hideAllMedia = displayMedia === 'hide_all';
|
||||
|
||||
interface CardProps {
|
||||
card: CardType | null;
|
||||
sensitive?: boolean;
|
||||
@@ -87,7 +89,7 @@ const CardVideo: React.FC<Pick<CardProps, 'card'>> = ({ card }) => (
|
||||
const Card: React.FC<CardProps> = ({ card, sensitive }) => {
|
||||
const [previewLoaded, setPreviewLoaded] = useState(false);
|
||||
const [embedded, setEmbedded] = useState(false);
|
||||
const [revealed, setRevealed] = useState(!sensitive);
|
||||
const [revealed, setRevealed] = useState(!sensitive && !hideAllMedia);
|
||||
|
||||
const handleEmbedClick = useCallback(() => {
|
||||
setEmbedded(true);
|
||||
@@ -283,6 +285,7 @@ const Card: React.FC<CardProps> = ({ card, sensitive }) => {
|
||||
embed = (
|
||||
<div className='status-card__image'>
|
||||
{canvas}
|
||||
{revealed ? undefined : spoilerButton}
|
||||
{thumbnail}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useRouteMatch, NavLink } from 'react-router-dom';
|
||||
|
||||
import { Icon } from 'mastodon/components/icon';
|
||||
import type { IconProp } from 'mastodon/components/icon';
|
||||
import type { MastodonLocationDescriptor } from 'mastodon/components/router';
|
||||
|
||||
export const ColumnLink: React.FC<{
|
||||
icon: React.ReactNode;
|
||||
@@ -11,7 +12,7 @@ export const ColumnLink: React.FC<{
|
||||
activeIconComponent?: IconProp;
|
||||
isActive?: (match: unknown, location: { pathname: string }) => boolean;
|
||||
text: string;
|
||||
to?: string;
|
||||
to?: MastodonLocationDescriptor;
|
||||
href?: string;
|
||||
method?: string;
|
||||
badge?: React.ReactNode;
|
||||
@@ -31,7 +32,9 @@ export const ColumnLink: React.FC<{
|
||||
transparent,
|
||||
...other
|
||||
}) => {
|
||||
const match = useRouteMatch(to ?? '');
|
||||
const match = useRouteMatch(
|
||||
(typeof to === 'string' ? to : to?.pathname) ?? '',
|
||||
);
|
||||
const className = classNames('column-link', {
|
||||
'column-link--transparent': transparent,
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ import { toggleNavigation } from 'mastodon/actions/navigation';
|
||||
import { fetchServer } from 'mastodon/actions/server';
|
||||
import { Icon } from 'mastodon/components/icon';
|
||||
import { IconWithBadge } from 'mastodon/components/icon_with_badge';
|
||||
import type { MastodonLocationDescriptor } from 'mastodon/components/router';
|
||||
import { useIdentity } from 'mastodon/identity_context';
|
||||
import { registrationsOpen, sso_redirect } from 'mastodon/initial_state';
|
||||
import { selectUnreadNotificationGroupsCount } from 'mastodon/selectors/notifications';
|
||||
@@ -38,12 +39,14 @@ export const messages = defineMessages({
|
||||
});
|
||||
|
||||
const IconLabelButton: React.FC<{
|
||||
to: string;
|
||||
to: MastodonLocationDescriptor;
|
||||
icon?: React.ReactNode;
|
||||
activeIcon?: React.ReactNode;
|
||||
title: string;
|
||||
}> = ({ to, icon, activeIcon, title }) => {
|
||||
const match = useRouteMatch(to);
|
||||
const match = useRouteMatch(
|
||||
typeof to === 'string' ? to : (to.pathname ?? ''),
|
||||
);
|
||||
|
||||
return (
|
||||
<NavLink
|
||||
@@ -189,7 +192,7 @@ export const NavigationBar: React.FC = () => {
|
||||
/>
|
||||
<IconLabelButton
|
||||
title={intl.formatMessage(messages.publish)}
|
||||
to='/publish'
|
||||
to={{ pathname: '/publish', state: { focusTarget: false } }}
|
||||
icon={<Icon id='' icon={AddIcon} />}
|
||||
/>
|
||||
<NotificationsButton />
|
||||
|
||||
Reference in new issue
Block a user