Merge branch 'next-console-errors' into 'next'
Next console errors See merge request soapbox-pub/soapbox-fe!1135
This commit is contained in:
commit
6c1ed1b79c
|
@ -1,39 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import { withRouter } from 'react-router-dom';
|
|
||||||
|
|
||||||
export default @withRouter
|
|
||||||
class Permalink extends React.PureComponent {
|
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
className: PropTypes.string,
|
|
||||||
href: PropTypes.string.isRequired,
|
|
||||||
to: PropTypes.string.isRequired,
|
|
||||||
children: PropTypes.node,
|
|
||||||
onInterceptClick: PropTypes.func,
|
|
||||||
history: PropTypes.object,
|
|
||||||
};
|
|
||||||
|
|
||||||
handleClick = e => {
|
|
||||||
if (this.props.onInterceptClick && this.props.onInterceptClick()) {
|
|
||||||
e.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.props.history && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.props.history.push(this.props.to);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { href, children, className, onInterceptClick, ...other } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<a target='_blank' href={href} onClick={this.handleClick} {...other} className={`permalink${className ? ' ' + className : ''}`}>
|
|
||||||
{children}
|
|
||||||
</a>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
import * as React from 'react';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
interface IPermaLink extends Pick<React.HTMLAttributes<HTMLAnchorElement>, 'dangerouslySetInnerHTML'> {
|
||||||
|
className?: string,
|
||||||
|
href: string,
|
||||||
|
title?: string,
|
||||||
|
to: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
const Permalink: React.FC<IPermaLink> = (props) => {
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
const { className, href, title, to, children, ...filteredProps } = props;
|
||||||
|
|
||||||
|
const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
|
||||||
|
if (event.button === 0 && !(event.ctrlKey || event.metaKey)) {
|
||||||
|
event.preventDefault();
|
||||||
|
history.push(to);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
target='_blank'
|
||||||
|
href={href}
|
||||||
|
onClick={handleClick}
|
||||||
|
title={title}
|
||||||
|
className={`permalink${className ? ' ' + className : ''}`}
|
||||||
|
{...filteredProps}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Permalink;
|
|
@ -223,7 +223,7 @@ export default class StatusList extends ImmutablePureComponent {
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
showLoading={isLoading && statusIds.size === 0}
|
showLoading={isLoading && statusIds.size === 0}
|
||||||
onLoadMore={onLoadMore && this.handleLoadOlder}
|
onLoadMore={onLoadMore && this.handleLoadOlder}
|
||||||
placeholderComponent={() => <PlaceholderStatus />}
|
placeholderComponent={PlaceholderStatus}
|
||||||
placeholderCount={20}
|
placeholderCount={20}
|
||||||
ref={this.setRef}
|
ref={this.setRef}
|
||||||
className={divideType === 'border' ? 'divide-y divide-solid divide-gray-200' : 'sm:space-y-3 divide-y divide-solid divide-gray-200 sm:divide-none'}
|
className={divideType === 'border' ? 'divide-y divide-solid divide-gray-200' : 'sm:space-y-3 divide-y divide-solid divide-gray-200 sm:divide-none'}
|
||||||
|
|
|
@ -256,8 +256,6 @@ class PrivacyDropdown extends React.PureComponent {
|
||||||
className='text-gray-400 hover:text-gray-600'
|
className='text-gray-400 hover:text-gray-600'
|
||||||
src={valueOption.icon}
|
src={valueOption.icon}
|
||||||
title={intl.formatMessage(messages.change_privacy)}
|
title={intl.formatMessage(messages.change_privacy)}
|
||||||
expanded={open}
|
|
||||||
active={open}
|
|
||||||
onClick={this.handleToggle}
|
onClick={this.handleToggle}
|
||||||
onMouseDown={this.handleMouseDown}
|
onMouseDown={this.handleMouseDown}
|
||||||
onKeyDown={this.handleButtonKeyDown}
|
onKeyDown={this.handleButtonKeyDown}
|
||||||
|
|
Loading…
Reference in New Issue