bigbuffet-rw/app/soapbox/containers/status_container.tsx
marcin mikolajczak 9822266561 do i really understand this?
Signed-off-by: marcin mikolajczak <git@mkljczk.pl>
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
Signed-off-by: marcin mikolajczak <git@mkljczk.pl>
2022-09-13 13:49:50 +02:00

36 lines
987 B
TypeScript

import React, { useCallback } from 'react';
import Status, { IStatus } from 'soapbox/components/status';
import { useAppSelector } from 'soapbox/hooks';
import { makeGetStatus } from 'soapbox/selectors';
interface IStatusContainer extends Omit<IStatus, 'status'> {
id: string,
/** @deprecated Unused. */
contextType?: any,
/** @deprecated Unused. */
otherAccounts?: any,
/** @deprecated Unused. */
getScrollPosition?: any,
/** @deprecated Unused. */
updateScrollBottom?: any,
}
/**
* Legacy Status wrapper accepting a status ID instead of the full entity.
* @deprecated Use the Status component directly.
*/
const StatusContainer: React.FC<IStatusContainer> = (props) => {
const { id, ...rest } = props;
const getStatus = useCallback(makeGetStatus(), []);
const status = useAppSelector(state => getStatus(state, { id }));
if (status) {
return <Status status={status} {...rest} />;
} else {
return null;
}
};
export default StatusContainer;