Migrate from Redux to React Query and React Context. This modernizes state management while maintaining all existing functionality. All the redux code and files were removed, including all redux and related packages.
28 lines
837 B
JavaScript
28 lines
837 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { useIntl } from '@edx/frontend-platform/i18n';
|
|
|
|
import { useSelectSessionModal } from 'data/context';
|
|
import useActionDisabledState from '../hooks';
|
|
import ActionButton from './ActionButton';
|
|
import messages from './messages';
|
|
|
|
export const SelectSessionButton = ({ cardId }) => {
|
|
const { formatMessage } = useIntl();
|
|
const { disableSelectSession } = useActionDisabledState(cardId);
|
|
const { updateSelectSessionModal } = useSelectSessionModal();
|
|
return (
|
|
<ActionButton
|
|
disabled={disableSelectSession}
|
|
onClick={() => updateSelectSessionModal(cardId)}
|
|
>
|
|
{formatMessage(messages.selectSession)}
|
|
</ActionButton>
|
|
);
|
|
};
|
|
SelectSessionButton.propTypes = {
|
|
cardId: PropTypes.string.isRequired,
|
|
};
|
|
export default SelectSessionButton;
|