1
0
Fork 0
forked from gitea/nas

Merge remote-tracking branch 'parent/main' into upstream-20240401

This commit is contained in:
KMY 2024-04-01 08:52:35 +09:00
commit bef755a577
111 changed files with 989 additions and 720 deletions

View file

@ -1,26 +1,26 @@
import type { PropsWithChildren } from 'react';
import { useCallback } from 'react';
import classNames from 'classnames';
interface BaseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
interface BaseProps
extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
block?: boolean;
secondary?: boolean;
text?: JSX.Element;
}
interface PropsWithChildren extends BaseProps {
text?: never;
interface PropsChildren extends PropsWithChildren<BaseProps> {
text?: undefined;
}
interface PropsWithText extends BaseProps {
text: JSX.Element;
children: never;
text: JSX.Element | string;
children?: undefined;
}
type Props = PropsWithText | PropsWithChildren;
type Props = PropsWithText | PropsChildren;
export const Button: React.FC<Props> = ({
text,
type = 'button',
onClick,
disabled,
@ -28,6 +28,7 @@ export const Button: React.FC<Props> = ({
secondary,
className,
title,
text,
children,
...props
}) => {

View file

@ -191,7 +191,7 @@ const timeRemainingString = (
interface Props {
intl: IntlShape;
timestamp: string;
year: number;
year?: number;
futureDate?: boolean;
short?: boolean;
}
@ -203,11 +203,6 @@ class RelativeTimestamp extends Component<Props, States> {
now: Date.now(),
};
static defaultProps = {
year: new Date().getFullYear(),
short: true,
};
_timer: number | undefined;
shouldComponentUpdate(nextProps: Props, nextState: States) {
@ -257,7 +252,13 @@ class RelativeTimestamp extends Component<Props, States> {
}
render() {
const { timestamp, intl, year, futureDate, short } = this.props;
const {
timestamp,
intl,
futureDate,
year = new Date().getFullYear(),
short = true,
} = this.props;
const timeGiven = timestamp.includes('T');
const date = new Date(timestamp);

View file

@ -91,7 +91,7 @@ class StatusActionBar extends ImmutablePureComponent {
static propTypes = {
status: ImmutablePropTypes.map.isRequired,
relationship: ImmutablePropTypes.map,
relationship: ImmutablePropTypes.record,
onReply: PropTypes.func,
onFavourite: PropTypes.func,
onEmojiReact: PropTypes.func,
@ -345,7 +345,9 @@ class StatusActionBar extends ImmutablePureComponent {
menu.push(null);
}
menu.push({ text: intl.formatMessage(status.get('reblogged') ? messages.cancelReblog : messages.reblog), action: this.handleReblogForceModalClick });
if (status.get('visibility_ex') !== 'limited') {
menu.push({ text: intl.formatMessage(status.get('reblogged') ? messages.cancelReblog : messages.reblog), action: this.handleReblogForceModalClick });
}
if (publicStatus) {
menu.push({ text: intl.formatMessage(messages.reference), action: this.handleReference });

View file

@ -11,22 +11,10 @@ import QuietTimeIcon from '@/material-icons/400-24px/quiet_time.svg?react';
import ReplyIcon from '@/material-icons/400-24px/reply.svg?react';
import LimitedIcon from '@/material-icons/400-24px/shield.svg?react';
import PersonalIcon from '@/material-icons/400-24px/sticky_note.svg?react';
import type { StatusVisibility } from 'mastodon/models/status';
import { Icon } from './icon';
type Visibility =
| 'public'
| 'unlisted'
| 'private'
| 'direct'
| 'public_unlisted'
| 'login'
| 'mutual'
| 'circle'
| 'personal'
| 'reply'
| 'limited';
const messages = defineMessages({
public_short: { id: 'privacy.public.short', defaultMessage: 'Public' },
public_unlisted_short: {
@ -71,7 +59,7 @@ const messages = defineMessages({
},
});
export const VisibilityIcon: React.FC<{ visibility: Visibility }> = ({
export const VisibilityIcon: React.FC<{ visibility: StatusVisibility }> = ({
visibility,
}) => {
const intl = useIntl();