Merge commit 'bbdde202be45da2bbdbcb24a167b4ebd320a4223' into glitch-soc/stable-4.7
Conflicts: - `package.json`: Upstream pinned all dependencies, but glitch-soc had two extra ones. Adopted upstream's changes and pinned the extra dependencies. - `yarn.lock`: Ditto.
This commit is contained in:
commit
d4c1a2c56a
95 files changed
+1668
-1116
No files matched your search
@@ -20,9 +20,11 @@ import { SpoilerButton } from 'mastodon/components/spoiler_button';
|
||||
import { formatTime, getPointerPosition } from 'mastodon/features/video';
|
||||
import { useAudioContext } from 'mastodon/hooks/useAudioContext';
|
||||
import { useAudioVisualizer } from 'mastodon/hooks/useAudioVisualizer';
|
||||
import { displayMedia, useBlurhash } from 'mastodon/initial_state';
|
||||
import { useBlurhash } from 'mastodon/initial_state';
|
||||
import { playerSettings } from 'mastodon/settings';
|
||||
|
||||
import { useRevealedMedia } from '../../hooks/useRevealedMedia';
|
||||
|
||||
import { AudioVisualizer } from './visualizer';
|
||||
|
||||
const messages = defineMessages({
|
||||
@@ -100,7 +102,7 @@ export const Audio: React.FC<{
|
||||
const [volume, setVolume] = useState(0.5);
|
||||
const [hovered, setHovered] = useState(false);
|
||||
const [dragging, setDragging] = useState(false);
|
||||
const [revealed, setRevealed] = useState(false);
|
||||
const [revealed, setRevealed] = useRevealedMedia({ visible, sensitive });
|
||||
|
||||
const playerRef = useRef<HTMLDivElement>(null);
|
||||
const audioRef = useRef<HTMLAudioElement>(null);
|
||||
@@ -177,17 +179,6 @@ export const Audio: React.FC<{
|
||||
}
|
||||
}, [volume, muted, gainNodeRef]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof visible !== 'undefined') {
|
||||
setRevealed(visible);
|
||||
} else {
|
||||
setRevealed(
|
||||
displayMedia === 'show_all' ||
|
||||
(displayMedia !== 'hide_all' && !sensitive),
|
||||
);
|
||||
}
|
||||
}, [visible, sensitive]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!revealed) {
|
||||
pauseAudio();
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useCurrentAccountId } from '@/mastodon/hooks/useAccountId';
|
||||
import type { Account } from '@/mastodon/models/account';
|
||||
import {
|
||||
addCollectionItem,
|
||||
collectionEditorActions,
|
||||
removeCollectionItem,
|
||||
} from '@/mastodon/reducers/slices/collections';
|
||||
import CloseIcon from '@/material-icons/400-24px/close.svg?react';
|
||||
@@ -23,6 +24,7 @@ import {
|
||||
} from '../collections/overview/created_by_account';
|
||||
|
||||
import { CollectionToggle } from './collection_toggle';
|
||||
import classes from './styles.module.scss';
|
||||
|
||||
const messages = defineMessages({
|
||||
close: {
|
||||
@@ -107,6 +109,23 @@ export const CollectionAdder: React.FC<{
|
||||
const account = useAppSelector((state) => state.accounts.get(accountId));
|
||||
const currentAccountId = useCurrentAccountId();
|
||||
const { collections, status } = useCollectionsCreatedBy(currentAccountId);
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const handleNewCollection = useCallback(() => {
|
||||
if (account) {
|
||||
dispatch(
|
||||
collectionEditorActions.reset({
|
||||
account_id: account.id,
|
||||
state:
|
||||
account.feature_approval.current_user === 'manual'
|
||||
? 'pending'
|
||||
: 'accepted',
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
onClose();
|
||||
}, [account, dispatch, onClose]);
|
||||
|
||||
return (
|
||||
<div className='modal-root__modal dialog-modal'>
|
||||
@@ -155,12 +174,22 @@ export const CollectionAdder: React.FC<{
|
||||
/>
|
||||
}
|
||||
>
|
||||
<NewCollectionButton onClick={onClose} />
|
||||
<NewCollectionButton compact onClick={handleNewCollection} />
|
||||
</EmptyState>
|
||||
) : (
|
||||
collections.map((item) => (
|
||||
<ListItem key={item.id} collection={item} account={account} />
|
||||
))
|
||||
<>
|
||||
<div className={classes.newCollection}>
|
||||
<NewCollectionButton secondary onClick={handleNewCollection}>
|
||||
<FormattedMessage
|
||||
id='collections.create_new_collection'
|
||||
defaultMessage='Create new collection'
|
||||
/>
|
||||
</NewCollectionButton>
|
||||
</div>
|
||||
{collections.map((item) => (
|
||||
<ListItem key={item.id} collection={item} account={account} />
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
.newCollection {
|
||||
padding: 16px;
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import AddIcon from '@/material-icons/400-24px/add.svg?react';
|
||||
@@ -26,16 +28,23 @@ import {
|
||||
} from '../editor';
|
||||
import classes from '../styles.module.scss';
|
||||
|
||||
export const NewCollectionButton: React.FC<{ onClick?: () => void }> = ({
|
||||
onClick,
|
||||
}) => (
|
||||
export const NewCollectionButton: React.FC<{
|
||||
compact?: boolean;
|
||||
secondary?: boolean;
|
||||
onClick?: () => void;
|
||||
children?: ReactNode;
|
||||
}> = ({ compact, secondary, onClick, children }) => (
|
||||
<Link
|
||||
to='/collections/new'
|
||||
className='button button--compact'
|
||||
className={classNames(
|
||||
'button',
|
||||
compact && 'button--compact',
|
||||
secondary && 'button-secondary',
|
||||
)}
|
||||
onClick={onClick}
|
||||
>
|
||||
<Icon id='plus' icon={AddIcon} />
|
||||
<FormattedMessage {...editorMessages.newCollection} />
|
||||
{children ?? <FormattedMessage {...editorMessages.newCollection} />}
|
||||
</Link>
|
||||
);
|
||||
|
||||
@@ -103,7 +112,7 @@ export const CollectionsCreatedByAccount: React.FC = () => {
|
||||
/>
|
||||
}
|
||||
>
|
||||
<NewCollectionButton />
|
||||
<NewCollectionButton compact />
|
||||
</EmptyState>
|
||||
);
|
||||
} else {
|
||||
@@ -135,7 +144,7 @@ export const CollectionsCreatedByAccount: React.FC = () => {
|
||||
}}
|
||||
/>
|
||||
</h2>
|
||||
{showCreateButton && <NewCollectionButton />}
|
||||
{showCreateButton && <NewCollectionButton compact />}
|
||||
</div>
|
||||
<ItemList>
|
||||
{isOwnCollectionPage && !canCreateMoreCollections && (
|
||||
|
||||
@@ -468,7 +468,7 @@ export const CollapsibleNavigationPanel: React.FC = () => {
|
||||
x({ value }: { value: number }) {
|
||||
if (value === 0) {
|
||||
dispatch(openNavigation());
|
||||
} else if (isLtrDir ? value > 0 : value < 0) {
|
||||
} else if (value === OPEN_MENU_OFFSET) {
|
||||
dispatch(closeNavigation());
|
||||
}
|
||||
},
|
||||
@@ -508,6 +508,7 @@ export const CollapsibleNavigationPanel: React.FC = () => {
|
||||
},
|
||||
{
|
||||
from: () => [x.get(), 0],
|
||||
axis: 'x',
|
||||
filterTaps: true,
|
||||
bounds: isLtrDir ? { left: 0 } : { right: 0 },
|
||||
rubberband: true,
|
||||
|
||||
@@ -121,6 +121,7 @@ class SwitchingColumnsArea extends PureComponent {
|
||||
singleColumn: PropTypes.bool,
|
||||
layout: PropTypes.string.isRequired,
|
||||
forceOnboarding: PropTypes.bool,
|
||||
minimalShell: PropTypes.bool,
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
@@ -158,7 +159,7 @@ class SwitchingColumnsArea extends PureComponent {
|
||||
};
|
||||
|
||||
render () {
|
||||
const { children, singleColumn, forceOnboarding } = this.props;
|
||||
const { children, singleColumn, forceOnboarding, minimalShell } = this.props;
|
||||
const { signedIn } = this.props.identity;
|
||||
const pathName = this.props.location.pathname;
|
||||
|
||||
@@ -185,7 +186,7 @@ class SwitchingColumnsArea extends PureComponent {
|
||||
|
||||
return (
|
||||
<ColumnsContextProvider multiColumn={!singleColumn}>
|
||||
<ColumnsArea ref={this.setRef} singleColumn={singleColumn} domain={domain} minimalShell={!signedIn && landingPage === 'overview' && pathName.startsWith('/overview')}>
|
||||
<ColumnsArea ref={this.setRef} singleColumn={singleColumn} domain={domain} minimalShell={minimalShell}>
|
||||
<WrappedSwitch>
|
||||
<Redirect from='/' to={{pathname: rootRedirect, state: {...this.props.location.state, focusTarget: false}}} exact />
|
||||
|
||||
@@ -651,6 +652,7 @@ class UI extends PureComponent {
|
||||
singleColumn={layout === 'mobile' || layout === 'single-column'}
|
||||
layout={layout}
|
||||
forceOnboarding={firstLaunch && newAccount}
|
||||
minimalShell={minimalShell}
|
||||
>
|
||||
{children}
|
||||
</SwitchingColumnsArea>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useSpring, animated, config } from '@react-spring/web';
|
||||
import { throttle } from 'lodash';
|
||||
|
||||
import type { DeployPictureInPictureCallback } from '@/mastodon/actions/picture_in_picture';
|
||||
import { useRevealedMedia } from '@/mastodon/hooks/useRevealedMedia';
|
||||
import Forward5Icon from '@/material-icons/400-24px/forward_5-fill.svg?react';
|
||||
import FullscreenIcon from '@/material-icons/400-24px/fullscreen.svg?react';
|
||||
import FullscreenExitIcon from '@/material-icons/400-24px/fullscreen_exit.svg?react';
|
||||
@@ -28,7 +29,7 @@ import {
|
||||
attachFullscreenListener,
|
||||
detachFullscreenListener,
|
||||
} from 'mastodon/features/ui/util/fullscreen';
|
||||
import { displayMedia, useBlurhash } from 'mastodon/initial_state';
|
||||
import { useBlurhash } from 'mastodon/initial_state';
|
||||
import { playerSettings } from 'mastodon/settings';
|
||||
|
||||
import { HotkeyIndicator } from './components/hotkey_indicator';
|
||||
@@ -214,7 +215,7 @@ export const Video: React.FC<{
|
||||
const [fullscreen, setFullscreen] = useState(false);
|
||||
const [hovered, setHovered] = useState(false);
|
||||
const [muted, setMuted] = useState(false);
|
||||
const [revealed, setRevealed] = useState(false);
|
||||
const [revealed, setRevealed] = useRevealedMedia({ visible, sensitive });
|
||||
const [hotkeyEvents, setHotkeyEvents] = useState<HotkeyEvent[]>([]);
|
||||
|
||||
const playerRef = useRef<HTMLDivElement>(null);
|
||||
@@ -362,17 +363,6 @@ export const Video: React.FC<{
|
||||
videoRef.current.muted = muted;
|
||||
}, [volume, muted]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof visible !== 'undefined') {
|
||||
setRevealed(visible);
|
||||
} else {
|
||||
setRevealed(
|
||||
displayMedia === 'show_all' ||
|
||||
(displayMedia !== 'hide_all' && !sensitive),
|
||||
);
|
||||
}
|
||||
}, [visible, sensitive]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!revealed && videoRef.current) {
|
||||
videoRef.current.pause();
|
||||
@@ -829,7 +819,7 @@ export const Video: React.FC<{
|
||||
role='button'
|
||||
tabIndex={0}
|
||||
aria-label={alt}
|
||||
title={alt}
|
||||
title={fullscreen ? undefined : alt}
|
||||
lang={lang}
|
||||
onClick={handleClick}
|
||||
onKeyDownCapture={handleVideoKeyDown}
|
||||
|
||||
Reference in new issue
Block a user