pleroma/app/soapbox/features/compose/containers/quoted_status_container.tsx

33 lines
776 B
TypeScript
Raw Normal View History

2022-06-07 12:48:24 -07:00
import React from 'react';
import { cancelQuoteCompose } from 'soapbox/actions/compose';
2022-06-08 09:07:41 -07:00
import QuotedStatus from 'soapbox/components/quoted-status';
2022-06-07 12:48:24 -07:00
import { useAppSelector, useAppDispatch } from 'soapbox/hooks';
import { makeGetStatus } from 'soapbox/selectors';
const getStatus = makeGetStatus();
/** QuotedStatus shown in post composer. */
const QuotedStatusContainer: React.FC = () => {
const dispatch = useAppDispatch();
const status = useAppSelector(state => getStatus(state, { id: state.compose.quote! }));
2022-06-07 12:48:24 -07:00
const onCancel = () => {
dispatch(cancelQuoteCompose());
};
if (!status) {
return null;
}
return (
<QuotedStatus
status={status}
onCancel={onCancel}
compose
/>
);
};
export default QuotedStatusContainer;