[Glitch] Cancel quote button appearing in all statuses
Port d2dca826dd06c78e562a9eaf96c9993d6bbe2e08 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
55cd5e1ab1
commit
09206c7369
@ -157,6 +157,7 @@ class Status extends ImmutablePureComponent {
|
|||||||
'expanded',
|
'expanded',
|
||||||
'unread',
|
'unread',
|
||||||
'pictureInPicture',
|
'pictureInPicture',
|
||||||
|
'headerRenderFn',
|
||||||
'previousId',
|
'previousId',
|
||||||
'nextInReplyToId',
|
'nextInReplyToId',
|
||||||
'rootId',
|
'rootId',
|
||||||
@ -685,7 +686,7 @@ class Status extends ImmutablePureComponent {
|
|||||||
const {statusContentProps, hashtagBar} = getHashtagBarForStatus(status);
|
const {statusContentProps, hashtagBar} = getHashtagBarForStatus(status);
|
||||||
|
|
||||||
const header = this.props.headerRenderFn
|
const header = this.props.headerRenderFn
|
||||||
? this.props.headerRenderFn({ status, account, avatarSize, messages, onHeaderClick: this.handleHeaderClick })
|
? this.props.headerRenderFn({ status, account, avatarSize, messages, onHeaderClick: this.handleHeaderClick, statusProps: this.props })
|
||||||
: (
|
: (
|
||||||
<StatusHeader
|
<StatusHeader
|
||||||
status={status}
|
status={status}
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import type { DisplayNameProps } from '../display_name';
|
|||||||
import { LinkedDisplayName } from '../display_name';
|
import { LinkedDisplayName } from '../display_name';
|
||||||
import { VisibilityIcon } from '../visibility_icon';
|
import { VisibilityIcon } from '../visibility_icon';
|
||||||
|
|
||||||
|
import type { StatusProps } from './types';
|
||||||
|
|
||||||
export interface StatusHeaderProps {
|
export interface StatusHeaderProps {
|
||||||
status: Status;
|
status: Status;
|
||||||
account?: Account;
|
account?: Account;
|
||||||
@ -22,7 +24,10 @@ export interface StatusHeaderProps {
|
|||||||
onHeaderClick?: MouseEventHandler<HTMLDivElement>;
|
onHeaderClick?: MouseEventHandler<HTMLDivElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type StatusHeaderRenderFn = (args: StatusHeaderProps) => ReactNode;
|
export type StatusHeaderRenderFn = (
|
||||||
|
args: StatusHeaderProps,
|
||||||
|
statusProps?: StatusProps,
|
||||||
|
) => ReactNode;
|
||||||
|
|
||||||
export const StatusHeader: FC<StatusHeaderProps> = ({
|
export const StatusHeader: FC<StatusHeaderProps> = ({
|
||||||
status,
|
status,
|
||||||
|
|||||||
36
app/javascript/flavours/glitch/components/status/types.ts
Normal file
36
app/javascript/flavours/glitch/components/status/types.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import type { ComponentClass, MouseEventHandler, ReactNode } from 'react';
|
||||||
|
|
||||||
|
import type { Account } from '@/flavours/glitch/models/account';
|
||||||
|
|
||||||
|
import type { StatusHeaderRenderFn } from './header';
|
||||||
|
|
||||||
|
// Taken from the Status component.
|
||||||
|
export interface StatusProps {
|
||||||
|
account?: Account;
|
||||||
|
children?: ReactNode;
|
||||||
|
previousId?: string;
|
||||||
|
rootId?: string;
|
||||||
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||||
|
muted?: boolean;
|
||||||
|
hidden?: boolean;
|
||||||
|
unread?: boolean;
|
||||||
|
showThread?: boolean;
|
||||||
|
showActions?: boolean;
|
||||||
|
isQuotedPost?: boolean;
|
||||||
|
shouldHighlightOnMount?: boolean;
|
||||||
|
getScrollPosition?: () => null | { height: number; top: number };
|
||||||
|
updateScrollBottom?: (snapshot: number) => void;
|
||||||
|
cacheMediaWidth?: (width: number) => void;
|
||||||
|
cachedMediaWidth?: number;
|
||||||
|
scrollKey?: string;
|
||||||
|
skipPrepend?: boolean;
|
||||||
|
avatarSize?: number;
|
||||||
|
unfocusable?: boolean;
|
||||||
|
headerRenderFn?: StatusHeaderRenderFn;
|
||||||
|
contextType?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type StatusComponent = ComponentClass<
|
||||||
|
StatusProps,
|
||||||
|
{ showMedia?: boolean; showDespiteFilter?: boolean }
|
||||||
|
>;
|
||||||
@ -227,13 +227,15 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
|
|||||||
const headerRenderFn: StatusHeaderRenderFn = useCallback(
|
const headerRenderFn: StatusHeaderRenderFn = useCallback(
|
||||||
(props) => (
|
(props) => (
|
||||||
<StatusHeader {...props}>
|
<StatusHeader {...props}>
|
||||||
<IconButton
|
{onQuoteCancel && (
|
||||||
onClick={onQuoteCancel}
|
<IconButton
|
||||||
className='status__quote-cancel'
|
onClick={onQuoteCancel}
|
||||||
title={intl.formatMessage(quoteCancelMessage)}
|
className='status__quote-cancel'
|
||||||
icon='cancel-fill'
|
title={intl.formatMessage(quoteCancelMessage)}
|
||||||
iconComponent={CancelFillIcon}
|
icon='cancel-fill'
|
||||||
/>
|
iconComponent={CancelFillIcon}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</StatusHeader>
|
</StatusHeader>
|
||||||
),
|
),
|
||||||
[intl, onQuoteCancel],
|
[intl, onQuoteCancel],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user