Status interaction action (#39681)
This commit is contained in:
9 files changed
+414
-79
No files matched your search
@@ -16,19 +16,9 @@ import {
|
||||
|
||||
import type { AttachmentArgs } from './testing';
|
||||
import { attachmentArgTypes, attachmentFactory } from './testing';
|
||||
import type { StatusContextType } from './types';
|
||||
import { TypedStatus } from './types';
|
||||
|
||||
type ContextTypes =
|
||||
| 'account'
|
||||
| 'bookmarks'
|
||||
| 'detailed'
|
||||
| 'favourites'
|
||||
| 'home'
|
||||
| 'notifications'
|
||||
| 'public'
|
||||
| 'search'
|
||||
| 'thread';
|
||||
|
||||
interface StatusStoryProps extends AttachmentArgs {
|
||||
// Contents
|
||||
text: string;
|
||||
@@ -51,7 +41,7 @@ interface StatusStoryProps extends AttachmentArgs {
|
||||
|
||||
// Display
|
||||
showThread?: boolean;
|
||||
contextType?: ContextTypes;
|
||||
contextType?: StatusContextType;
|
||||
showCounters?: boolean;
|
||||
favouriteCount?: number;
|
||||
reblogCount?: number;
|
||||
@@ -319,6 +309,7 @@ const meta = {
|
||||
options: [
|
||||
'account',
|
||||
'bookmarks',
|
||||
'composer',
|
||||
'detailed',
|
||||
'favourites',
|
||||
'home',
|
||||
@@ -326,7 +317,7 @@ const meta = {
|
||||
'public',
|
||||
'search',
|
||||
'thread',
|
||||
] satisfies ContextTypes[],
|
||||
] satisfies StatusContextType[],
|
||||
},
|
||||
hidden: categoryDisplay,
|
||||
muted: categoryDisplay,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ComponentType, MouseEventHandler, ReactNode } from 'react';
|
||||
|
||||
import StatusContainer from '@/mastodon/containers/status_container';
|
||||
import type { Account as TAccount } from '@/mastodon/models/account';
|
||||
import type { Status as TStatus } from '@/mastodon/models/status';
|
||||
|
||||
@@ -7,15 +8,55 @@ import Status from '../status';
|
||||
|
||||
import type { StatusHeaderRenderFn } from './header';
|
||||
|
||||
// Taken from the Status component.
|
||||
export interface StatusProps {
|
||||
status: TStatus;
|
||||
export type StatusContextType =
|
||||
| 'account'
|
||||
| 'bookmarks'
|
||||
| 'composer'
|
||||
| 'detailed'
|
||||
| 'favourites'
|
||||
| 'home'
|
||||
| `list:${string}`
|
||||
| 'notifications'
|
||||
| 'public'
|
||||
| 'search'
|
||||
| 'thread';
|
||||
|
||||
export interface StatusContainerProps {
|
||||
id?: string | null;
|
||||
account?: TAccount;
|
||||
children?: ReactNode;
|
||||
previousId?: string;
|
||||
nextInReplyToId?: string;
|
||||
rootId?: string;
|
||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||
muted?: boolean;
|
||||
hidden?: boolean;
|
||||
unread?: boolean;
|
||||
featured?: boolean;
|
||||
showThread?: boolean;
|
||||
showActions?: boolean;
|
||||
isQuotedPost?: boolean;
|
||||
shouldHighlightOnMount?: boolean;
|
||||
contextType?: StatusContextType;
|
||||
withCounters?: boolean;
|
||||
unfocusable?: boolean;
|
||||
headerRenderFn?: StatusHeaderRenderFn;
|
||||
getScrollPosition?: () => null | { height: number; top: number };
|
||||
updateScrollBottom?: (snapshot: number) => void;
|
||||
cacheMediaWidth?: (width: number) => void;
|
||||
cachedMediaWidth?: number;
|
||||
scrollKey?: string;
|
||||
skipPrepend?: boolean;
|
||||
avatarSize?: number;
|
||||
withDismiss?: boolean;
|
||||
}
|
||||
|
||||
export const TypedStatusContainer =
|
||||
StatusContainer as ComponentType<StatusContainerProps>;
|
||||
|
||||
// Taken from the Status component.
|
||||
export interface StatusProps extends StatusContainerProps {
|
||||
status: TStatus;
|
||||
nextInReplyToId?: string;
|
||||
onReply: (status: TStatus) => void;
|
||||
onFavourite: (status: TStatus) => void;
|
||||
onReblog: (status: TStatus, event?: unknown) => void;
|
||||
@@ -44,31 +85,12 @@ export interface StatusProps {
|
||||
onToggleCollapsed: (status: TStatus, isCollapsed: boolean) => void;
|
||||
onTranslate: (status: TStatus) => void;
|
||||
onInteractionModal?: (type: string, status: TStatus) => void;
|
||||
muted?: boolean;
|
||||
hidden?: boolean;
|
||||
unread?: boolean;
|
||||
featured?: 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;
|
||||
deployPictureInPicture: (
|
||||
status: TStatus,
|
||||
type: string,
|
||||
mediaProps: unknown,
|
||||
) => void;
|
||||
unfocusable?: boolean;
|
||||
headerRenderFn?: StatusHeaderRenderFn;
|
||||
pictureInPicture: Immutable.Map<'inUse' | 'available', boolean>;
|
||||
contextType?: string;
|
||||
withCounters?: boolean;
|
||||
}
|
||||
|
||||
export const TypedStatus = Status as ComponentType<StatusProps>;
|
||||
Reference in new issue
Block a user