-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from edx/aakbar/PROD-2132
Add ability to expire Entitlements
- Loading branch information
Showing
10 changed files
with
446 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const REISSUE = 'reissue'; | ||
export const EXPIRE = 'expire'; | ||
export const CREATE = 'create'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { CREATE, REISSUE, EXPIRE } from './EntitlementActions'; | ||
import CreateEntitlementForm from './CreateEntitlementForm'; | ||
import ReissueEntitlementForm from './ReissueEntitlementForm'; | ||
import ExpireEntitlementForm from './ExpireEntitlementForm'; | ||
import { EntitlementPropTypes, EntitlementDefaultProps } from './PropTypes'; | ||
|
||
export default function EntitlementForm({ | ||
formType, | ||
entitlement, | ||
changeHandler, | ||
closeHandler, | ||
user, | ||
forwardedRef, | ||
}) { | ||
if (formType === CREATE) { | ||
return ( | ||
<CreateEntitlementForm | ||
key="entitlement-create-form" | ||
user={user} | ||
entitlement={entitlement} | ||
changeHandler={changeHandler} | ||
closeHandler={closeHandler} | ||
forwardedRef={forwardedRef} | ||
/> | ||
); | ||
} if (formType === EXPIRE) { | ||
return ( | ||
<ExpireEntitlementForm | ||
key="entitlement-expire-form" | ||
user={user} | ||
entitlement={entitlement} | ||
changeHandler={changeHandler} | ||
closeHandler={closeHandler} | ||
forwardedRef={forwardedRef} | ||
/> | ||
); | ||
} if (formType === REISSUE) { | ||
return ( | ||
<ReissueEntitlementForm | ||
key="entitlement-reissue-form" | ||
user={user} | ||
entitlement={entitlement} | ||
changeHandler={changeHandler} | ||
closeHandler={closeHandler} | ||
forwardedRef={forwardedRef} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
EntitlementForm.propTypes = { | ||
formType: PropTypes.string.isRequired, | ||
entitlement: EntitlementPropTypes, | ||
user: PropTypes.string.isRequired, | ||
changeHandler: PropTypes.func.isRequired, | ||
closeHandler: PropTypes.func.isRequired, | ||
forwardedRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }), | ||
}; | ||
|
||
EntitlementForm.defaultProps = { | ||
entitlement: EntitlementDefaultProps, | ||
forwardedRef: null, | ||
}; |
Oops, something went wrong.