-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat: adding new plugin slot for an enterprise modal"
This reverts commit f110a0a.
- Loading branch information
Showing
9 changed files
with
163 additions
and
48 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
42 changes: 42 additions & 0 deletions
42
src/containers/EnterpriseDashboardModal/__snapshots__/index.test.jsx.snap
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,42 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EnterpriseDashboard empty snapshot 1`] = `null`; | ||
|
||
exports[`EnterpriseDashboard snapshot 1`] = ` | ||
<ModalDialog | ||
hasCloseButton={false} | ||
onClose={[MockFunction useEnterpriseDashboardHook.handleEscape]} | ||
title="" | ||
> | ||
<div | ||
className="bg-white p-3 rounded shadow" | ||
style={ | ||
{ | ||
"textAlign": "start", | ||
} | ||
} | ||
> | ||
<h4> | ||
You have access to the edX, Inc. dashboard | ||
</h4> | ||
<p> | ||
To access the courses available to you through edX, Inc., visit the edX, Inc. dashboard now. | ||
</p> | ||
<ActionRow> | ||
<Button | ||
onClick={[MockFunction useEnterpriseDashboardHook.handleClose]} | ||
variant="tertiary" | ||
> | ||
Dismiss | ||
</Button> | ||
<Button | ||
href="/edx-dashboard" | ||
onClick={[MockFunction useEnterpriseDashboardHook.handleCTAClick]} | ||
type="a" | ||
> | ||
Go to dashboard | ||
</Button> | ||
</ActionRow> | ||
</div> | ||
</ModalDialog> | ||
`; |
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,60 @@ | ||
import React from 'react'; | ||
// import PropTypes from 'prop-types'; | ||
|
||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import { | ||
ModalDialog, ActionRow, Button, | ||
} from '@openedx/paragon'; | ||
|
||
import messages from './messages'; | ||
import useEnterpriseDashboardHook from './hooks'; | ||
|
||
export const EnterpriseDashboardModal = () => { | ||
const { formatMessage } = useIntl(); | ||
const { | ||
showModal, | ||
handleClose, | ||
handleCTAClick, | ||
handleEscape, | ||
dashboard, | ||
} = useEnterpriseDashboardHook(); | ||
if (!dashboard || !dashboard.label) { | ||
return null; | ||
} | ||
return ( | ||
<ModalDialog | ||
isOpen={showModal} | ||
onClose={handleEscape} | ||
hasCloseButton={false} | ||
title="" | ||
> | ||
<div | ||
className="bg-white p-3 rounded shadow" | ||
style={{ textAlign: 'start' }} | ||
> | ||
<h4> | ||
{formatMessage(messages.enterpriseDialogHeader, { | ||
label: dashboard.label, | ||
})} | ||
</h4> | ||
<p> | ||
{formatMessage(messages.enterpriseDialogBody, { | ||
label: dashboard.label, | ||
})} | ||
</p> | ||
<ActionRow> | ||
<Button variant="tertiary" onClick={handleClose}> | ||
{formatMessage(messages.enterpriseDialogDismissButton)} | ||
</Button> | ||
<Button type="a" href={dashboard.url} onClick={handleCTAClick}> | ||
{formatMessage(messages.enterpriseDialogConfirmButton)} | ||
</Button> | ||
</ActionRow> | ||
</div> | ||
</ModalDialog> | ||
); | ||
}; | ||
|
||
EnterpriseDashboardModal.propTypes = {}; | ||
|
||
export default EnterpriseDashboardModal; |
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,29 @@ | ||
import { shallow } from '@edx/react-unit-test-utils'; | ||
import EnterpriseDashboard from '.'; | ||
|
||
import useEnterpriseDashboardHook from './hooks'; | ||
|
||
jest.mock('./hooks', () => ({ | ||
__esModule: true, | ||
default: jest.fn(), | ||
})); | ||
|
||
describe('EnterpriseDashboard', () => { | ||
test('snapshot', () => { | ||
const hookData = { | ||
dashboard: { label: 'edX, Inc.', url: '/edx-dashboard' }, | ||
showDialog: false, | ||
handleClose: jest.fn().mockName('useEnterpriseDashboardHook.handleClose'), | ||
handleCTAClick: jest.fn().mockName('useEnterpriseDashboardHook.handleCTAClick'), | ||
handleEscape: jest.fn().mockName('useEnterpriseDashboardHook.handleEscape'), | ||
}; | ||
useEnterpriseDashboardHook.mockReturnValueOnce({ ...hookData }); | ||
const el = shallow(<EnterpriseDashboard />); | ||
expect(el.snapshot).toMatchSnapshot(); | ||
}); | ||
test('empty snapshot', () => { | ||
useEnterpriseDashboardHook.mockReturnValueOnce({}); | ||
const el = shallow(<EnterpriseDashboard />); | ||
expect(el.snapshot).toMatchSnapshot(); | ||
}); | ||
}); |
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,26 @@ | ||
import { defineMessages } from '@edx/frontend-platform/i18n'; | ||
|
||
const messages = defineMessages({ | ||
enterpriseDialogHeader: { | ||
id: 'leanerDashboard.enterpriseDialogHeader', | ||
defaultMessage: 'You have access to the {label} dashboard', | ||
description: 'title for enterpise dashboard dialog', | ||
}, | ||
enterpriseDialogBody: { | ||
id: 'leanerDashboard.enterpriseDialogBody', | ||
defaultMessage: 'To access the courses available to you through {label}, visit the {label} dashboard now.', | ||
description: 'Body text for enterpise dashboard dialog', | ||
}, | ||
enterpriseDialogDismissButton: { | ||
id: 'leanerDashboard.enterpriseDialogDismissButton', | ||
defaultMessage: 'Dismiss', | ||
description: 'Dismiss button to cancel visiting dashboard', | ||
}, | ||
enterpriseDialogConfirmButton: { | ||
id: 'leanerDashboard.enterpriseDialogConfirmButton', | ||
defaultMessage: 'Go to dashboard', | ||
description: 'Confirm button to go to the dashboard url', | ||
}, | ||
}); | ||
|
||
export default messages; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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