diff --git a/packages/developer-portal/src/components/pages/admin-approvals/__tests__/__snapshots__/admin-approvals.test.tsx.snap b/packages/developer-portal/src/components/pages/admin-approvals/__tests__/__snapshots__/admin-approvals.test.tsx.snap deleted file mode 100644 index 29e57125c4..0000000000 --- a/packages/developer-portal/src/components/pages/admin-approvals/__tests__/__snapshots__/admin-approvals.test.tsx.snap +++ /dev/null @@ -1,444 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`admin-approvals AdminApprovals should match a snapshot 1`] = ` - - - - - -
- -

- App Revision Approvals -

-
-
-
- -
- - -
- There are no updates that require approval -
-
-
-
-
- - - - - - - - - - - -
-
-
-`; - -exports[`admin-approvals Content should match snapshot 1`] = ` - -`; - -exports[`admin-approvals Content should match snapshot 2`] = ` -
- -
-`; - -exports[`admin-approvals renderId should renderId correctly 1`] = ` -
- -
-`; - -exports[`admin-approvals renderId should renderId correctly 2`] = ` -
- -
-`; - -exports[`admin-approvals renderViewDetailButton should render correctly 1`] = ` -
- -
-`; diff --git a/packages/developer-portal/src/components/pages/admin-approvals/__tests__/admin-approvals.test.tsx b/packages/developer-portal/src/components/pages/admin-approvals/__tests__/admin-approvals.test.tsx deleted file mode 100644 index a9ff95a612..0000000000 --- a/packages/developer-portal/src/components/pages/admin-approvals/__tests__/admin-approvals.test.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import * as React from 'react' -import { shallow, mount } from 'enzyme' -import configureStore from 'redux-mock-store' -import * as ReactRedux from 'react-redux' -import { MemoryRouter } from 'react-router' -import { approvalsStub } from '@/sagas/__stubs__/approvals' -import routes from '@/constants/routes' -import { revisionDetailDataStub } from '@/sagas/__stubs__/revision-detail' -import { appDetailDataStub } from '@/sagas/__stubs__/app-detail' -import Routes from '@/constants/routes' -import appState from '@/reducers/__stubs__/app-state' -import { - AdminApprovals, - handleCloseModal, - handleOnPageChange, - Content, - renderId, - renderViewDetailButton, - generateTableColumn, - handleViewDetailOnClick, - HandleViewDetailOnClickParams, -} from '../admin-approvals' - -describe('admin-approvals', () => { - describe('handleCloseModal', () => { - it('should call dispatch', () => { - const setIsModalOpen = jest.fn() - const fn = handleCloseModal({ setIsModalOpen }) - fn() - expect(setIsModalOpen).toBeCalled() - }) - }) - - describe('handleOnPageChange', () => { - it('should call dispatch', () => { - const mockHistory = { - push: jest.fn(), - } - const fn = handleOnPageChange(mockHistory) - fn(1) - expect(mockHistory.push).toBeCalledWith(`${routes.ADMIN_APPROVALS}?page=1`) - }) - }) - - describe('Content', () => { - const mockTableColumns = [ - { - Header: 'AppId', - accessor: 'appId', - }, - { - Header: 'Type', - accessor: 'type', - }, - { - Header: 'Description', - accessor: 'description', - }, - ] - it('should match snapshot', () => { - const wrapper = shallow( - , - ) - expect(wrapper).toMatchSnapshot() - }) - it('should match snapshot', () => { - const wrapper = shallow() - expect(wrapper).toMatchSnapshot() - }) - }) - - describe('renderId', () => { - it('should renderId correctly', () => { - const input = { - page: 1, - } - const wrapper = shallow(
{renderId(input)}
) - expect(wrapper).toMatchSnapshot() - }) - - it('should renderId correctly', () => { - const input = { - page: 2, - } - const wrapper = shallow(
{renderId(input)}
) - expect(wrapper).toMatchSnapshot() - }) - }) - - describe('renderViewDetailButton', () => { - it('should render correctly', () => { - const mockProps = { - revisionDetail: revisionDetailDataStub.data, - appDetail: appDetailDataStub.data, - setIsModalOpen: jest.fn(), - dispatch: jest.fn(), - } - const wrapper = shallow(
{renderViewDetailButton(mockProps)}
) - expect(wrapper).toMatchSnapshot() - }) - }) - - describe('generateTableColumn', () => { - it('should render correctly', () => { - const mockProps = { - page: 1, - revisionDetail: revisionDetailDataStub.data, - appDetail: appDetailDataStub.data, - setIsModalOpen: jest.fn(), - dispatch: jest.fn(), - } - const result = generateTableColumn(mockProps) - expect(result).toHaveLength(5) - }) - }) - - describe('AdminApprovals', () => { - let store - beforeEach(() => { - const mockStore = configureStore() - store = mockStore(appState) - }) - it('should match a snapshot', () => { - expect( - mount( - - - - - , - ), - ).toMatchSnapshot() - }) - }) - - describe('handleViewDetailOnClick', () => { - it('should render correctly', () => { - const mockParams = { - dispatch: jest.fn(), - appRevisionId: '1231', - currentRevisionId: '1232', - appId: '1234', - currentAppId: '1233', - setIsModalOpen: jest.fn(), - } as HandleViewDetailOnClickParams - const fn = handleViewDetailOnClick(mockParams) - fn() - expect(mockParams.dispatch).toBeCalled() - }) - }) -}) diff --git a/packages/developer-portal/src/components/pages/admin-approvals/admin-approvals.tsx b/packages/developer-portal/src/components/pages/admin-approvals/admin-approvals.tsx deleted file mode 100644 index ebe2c33670..0000000000 --- a/packages/developer-portal/src/components/pages/admin-approvals/admin-approvals.tsx +++ /dev/null @@ -1,203 +0,0 @@ -import * as React from 'react' -import { useDispatch, useSelector } from 'react-redux' -import { Dispatch } from 'redux' -import { useHistory, useLocation } from 'react-router' -import { Loader, Pagination, Table, Button, Helper, infoText, Section, H3 } from '@reapit/elements' -import { revisionDetailRequestData } from '@/actions/revision-detail' -import routes from '@/constants/routes' -import { REVISIONS_PER_PAGE } from '@/constants/paginator' -import { appDetailRequestData } from '@/actions/app-detail' -import { ApprovalModel, AppRevisionModel } from '@reapit/foundations-ts-definitions' -import { AppDetailModel } from '@/types/marketplace-api-schema' -import { selectApp } from '@/selector/app-detail' -import { selectAppRevision } from '@/selector/app-revisions' -import AdminApprovalModal from '@/components/ui/admin-approval-modal' -import { selectAdminApprovalsState, selectWaitingApprovalData } from '@/selector/admin' - -export type HandleCloseModalParams = { - setIsModalOpen: React.Dispatch> -} - -export const handleCloseModal = ({ setIsModalOpen }: HandleCloseModalParams) => () => setIsModalOpen(false) - -export const handleOnPageChange = (history: { push: (path: string) => void }) => (page: number) => - history.push(`${routes.ADMIN_APPROVALS}?page=${page}`) - -export const Content = ({ - loading, - waitingApprovalList, - tableColumns, -}: { - loading: Boolean - waitingApprovalList: ApprovalModel[] - tableColumns: any -}) => { - if (loading) { - return ( -
- -
- ) - } - - if (!loading && !waitingApprovalList.length) { - return {infoText('ADMIN_APPROVALS_EMPTY')} - } - - return -} - -export type RenderIdParams = { - page: number -} - -export type RowIdParams = { - row: { index: number } -} - -export const renderId = ({ page }: RenderIdParams) => ({ row: { index } }: RowIdParams) => { - const pageNoTimesRevsions = (page - 1) * REVISIONS_PER_PAGE - return
{pageNoTimesRevsions + index + 1}
-} - -export type HandleViewDetailOnClickParams = { - dispatch: Dispatch - appId: string - setIsModalOpen: React.Dispatch> - appRevisionId: string - currentRevisionId?: string - currentAppId?: string -} - -export const handleViewDetailOnClick = ({ - dispatch, - appRevisionId, - currentRevisionId, - appId, - currentAppId, - setIsModalOpen, -}: HandleViewDetailOnClickParams) => () => { - const isNeedFetchRevision = currentRevisionId !== appRevisionId - const isNeedFetchAppDetail = currentAppId !== appId - if (appRevisionId && appId && isNeedFetchRevision) { - dispatch(revisionDetailRequestData({ appId, appRevisionId })) - } - if (appRevisionId && appId && isNeedFetchAppDetail) { - dispatch(appDetailRequestData({ id: appId })) - } - setIsModalOpen(true) -} - -export type RenderViewDetailButtonParams = { - revisionDetail: AppRevisionModel - appDetail: AppDetailModel - setIsModalOpen: React.Dispatch> - dispatch: Dispatch -} - -export type RowDetailButtonParams = { - row: { original: { appId: string; appRevisionId: string } } -} - -export const renderViewDetailButton = ({ - revisionDetail, - appDetail, - setIsModalOpen, - dispatch, -}: RenderViewDetailButtonParams) => ({ row: { original } }: RowDetailButtonParams) => { - const { appId, appRevisionId } = original - const currentRevisionId = revisionDetail?.id - const currentAppId = appDetail?.id - return ( - - ) -} - -export const generateTableColumn = ({ - page, - revisionDetail, - appDetail, - setIsModalOpen, - dispatch, -}: RenderIdParams & RenderViewDetailButtonParams) => [ - { - Header: '#', - id: 'id', - Cell: renderId({ page }), - }, - { - Header: 'AppId', - accessor: 'appId', - }, - { - Header: 'Type', - accessor: 'type', - }, - { - Header: 'Description', - accessor: 'description', - }, - { - Header: '', - id: 'buttonColumn', - Cell: renderViewDetailButton({ revisionDetail, appDetail, dispatch, setIsModalOpen }), - }, -] - -export const AdminApprovals: React.FC = () => { - const [isModalOpen, setIsModalOpen] = React.useState(false) - const dispatch = useDispatch() - const appDetail = useSelector(selectApp) - const location = useLocation() - const history = useHistory() - const revisionDetail = useSelector(selectAppRevision) - const approvalsState = useSelector(selectAdminApprovalsState) - const waitingApprovalListData = useSelector(selectWaitingApprovalData) - const urlParams = new URLSearchParams(location.search) - const page = urlParams.get('page') || 1 - const isLoading = approvalsState.loading - - return ( - <> -
-

App Revision Approvals

-
-
- -
- - - - ) -} - -export default AdminApprovals diff --git a/packages/developer-portal/src/components/pages/admin-approvals/index.ts b/packages/developer-portal/src/components/pages/admin-approvals/index.ts deleted file mode 100644 index b8a9aaf9be..0000000000 --- a/packages/developer-portal/src/components/pages/admin-approvals/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import AdminApprovals from './admin-approvals' - -export default AdminApprovals diff --git a/packages/developer-portal/src/components/pages/admin-apps/admin-apps.tsx b/packages/developer-portal/src/components/pages/admin-apps/admin-apps.tsx index 8b5a1481e6..f7ddb43038 100644 --- a/packages/developer-portal/src/components/pages/admin-apps/admin-apps.tsx +++ b/packages/developer-portal/src/components/pages/admin-apps/admin-apps.tsx @@ -25,7 +25,7 @@ import { } from '@reapit/elements' import { selectAdminAppsData, selectAdminAppsLoading } from '@/selector/admin' import { adminAppsRequestFeatured } from '@/actions/admin-apps' -import AppDeleteModal from '@/components/ui/app-delete' +import AppDeleteModal from '@/components/pages/app-detail/app-delete' import { addQuery, stringifyObjectIntoQueryString, getParamsFromPath } from '@/utils/client-url-params' import { cleanObject } from '@reapit/utils' import Routes from '@/constants/routes' diff --git a/packages/developer-portal/src/components/ui/__tests__/__snapshots__/app-authentication-detail.test.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/__tests__/__snapshots__/app-authentication-detail.test.tsx.snap similarity index 100% rename from packages/developer-portal/src/components/ui/__tests__/__snapshots__/app-authentication-detail.test.tsx.snap rename to packages/developer-portal/src/components/pages/app-detail/__tests__/__snapshots__/app-authentication-detail.test.tsx.snap diff --git a/packages/developer-portal/src/components/ui/__tests__/__snapshots__/app-delete.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/__tests__/__snapshots__/app-delete.test.tsx.snap similarity index 100% rename from packages/developer-portal/src/components/ui/__tests__/__snapshots__/app-delete.tsx.snap rename to packages/developer-portal/src/components/pages/app-detail/__tests__/__snapshots__/app-delete.test.tsx.snap diff --git a/packages/developer-portal/src/components/pages/app-detail/__tests__/__snapshots__/app-revision-modal.test.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/__tests__/__snapshots__/app-revision-modal.test.tsx.snap index 8355b0c4b5..4ca7a0406c 100644 --- a/packages/developer-portal/src/components/pages/app-detail/__tests__/__snapshots__/app-revision-modal.test.tsx.snap +++ b/packages/developer-portal/src/components/pages/app-detail/__tests__/__snapshots__/app-revision-modal.test.tsx.snap @@ -1,83 +1,89 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ClientAppInstallConfirmation should match a snapshot 1`] = ` - - - + > + + CANCEL PENDING REVISIONS + + } + title="Pending Revisions" + visible={true} + /> + + `; diff --git a/packages/developer-portal/src/components/pages/app-detail/__tests__/aside.test.tsx b/packages/developer-portal/src/components/pages/app-detail/__tests__/app-aside.test.tsx similarity index 93% rename from packages/developer-portal/src/components/pages/app-detail/__tests__/aside.test.tsx rename to packages/developer-portal/src/components/pages/app-detail/__tests__/app-aside.test.tsx index 51ae31dcd1..ec5de1b70c 100644 --- a/packages/developer-portal/src/components/pages/app-detail/__tests__/aside.test.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/__tests__/app-aside.test.tsx @@ -1,6 +1,6 @@ import React from 'react' import { DeveloperAppDetailState } from '@/reducers/developer' -import { DeveloperAside, onBackToAppsButtonClick } from '../aside' +import { DeveloperAside, onBackToAppsButtonClick } from '../app-aside' import { shallow } from 'enzyme' import { integrationTypesStub } from '@/sagas/__stubs__/integration-types' import { appDetailDataStub } from '@/sagas/__stubs__/app-detail' diff --git a/packages/developer-portal/src/components/ui/__tests__/app-authentication-detail.test.tsx b/packages/developer-portal/src/components/pages/app-detail/__tests__/app-authentication-detail.test.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/__tests__/app-authentication-detail.test.tsx rename to packages/developer-portal/src/components/pages/app-detail/__tests__/app-authentication-detail.test.tsx diff --git a/packages/developer-portal/src/components/ui/__tests__/app-delete.tsx b/packages/developer-portal/src/components/pages/app-detail/__tests__/app-delete.test.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/__tests__/app-delete.tsx rename to packages/developer-portal/src/components/pages/app-detail/__tests__/app-delete.test.tsx diff --git a/packages/developer-portal/src/components/pages/app-detail/__tests__/manage-app.test.tsx b/packages/developer-portal/src/components/pages/app-detail/__tests__/app-management.test.tsx similarity index 97% rename from packages/developer-portal/src/components/pages/app-detail/__tests__/manage-app.test.tsx rename to packages/developer-portal/src/components/pages/app-detail/__tests__/app-management.test.tsx index 8e3635d39a..9b9764c155 100644 --- a/packages/developer-portal/src/components/pages/app-detail/__tests__/manage-app.test.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/__tests__/app-management.test.tsx @@ -7,7 +7,7 @@ import { MemoryRouter } from 'react-router' import { getMockRouterProps } from '@/utils/mock-helper' import configureStore from 'redux-mock-store' import Routes from '@/constants/routes' -import DeveloperManageApp from '../manage-app' +import DeveloperManageApp from '../app-management' import { appDetailDataStub } from '@/sagas/__stubs__/app-detail' import { DeveloperAppDetailState } from '@/reducers/developer' import { @@ -17,7 +17,7 @@ import { onPendingRevisionButtonClick, onEditDetailButtonClick, onDeleteAppButtonClick, -} from '../manage-app' +} from '../app-management' const mockState = { ...appState, diff --git a/packages/developer-portal/src/components/pages/app-detail/__tests__/app-revision-modal.test.tsx b/packages/developer-portal/src/components/pages/app-detail/__tests__/app-revision-modal.test.tsx deleted file mode 100644 index 8367c5ae80..0000000000 --- a/packages/developer-portal/src/components/pages/app-detail/__tests__/app-revision-modal.test.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import * as React from 'react' -import * as ReactRedux from 'react-redux' -import { shallow } from 'enzyme' -import configureStore from 'redux-mock-store' - -import { appDetailDataStub } from '@/sagas/__stubs__/app-detail' -import AppRevisionModal, { - AppRevisionModalProps, - handleUseEffectToFetchAppRevisions, - handleUseEffectToFetchAppRevisionDetail, - handleCancelPendingRevisionsSuccessCallback, -} from '../app-revision-modal' -import { revisionsRequestData } from '@/actions/revisions' -import { revisionDetailRequestData } from '@/actions/revision-detail' -import { developerFetchAppDetail } from '@/actions/developer' -import appState from '@/reducers/__stubs__/app-state' - -const mockProps: AppRevisionModalProps = { - appDetailState: { - data: appDetailDataStub.data, - isAppDetailLoading: false, - }, - visible: true, - appId: appDetailDataStub.data.id || '', - afterClose: jest.fn(), -} - -describe('ClientAppInstallConfirmation', () => { - let store - let spyDispatch - const appId = mockProps.appDetailState.data?.id || '' - beforeEach(() => { - /* mocking store */ - const mockStore = configureStore() - store = mockStore(appState) - /* mocking useDispatch on our mock store */ - spyDispatch = jest.spyOn(ReactRedux, 'useDispatch').mockImplementation(() => store.dispatch) - }) - - it('should match a snapshot', () => { - expect( - shallow( - - - , - ), - ).toMatchSnapshot() - }) - - describe('handleUseEffectToFetchAppRevisions', () => { - it('should run correctly when the modal is visible', () => { - const fn = handleUseEffectToFetchAppRevisions(appId, true, spyDispatch) - fn() - expect(spyDispatch).toBeCalledWith( - revisionsRequestData({ - appId, - }), - ) - }) - }) - - describe('handleUseEffectToFetchAppRevisionDetail', () => { - it('should run correctly when the modal is visible', () => { - const revisions = appState.revisions.revisions?.data - const appRevisionId = (revisions && (revisions[0].id as string)) || 'SOME_ID' - const fn = handleUseEffectToFetchAppRevisionDetail(appId, true, spyDispatch, appRevisionId) - fn() - expect(spyDispatch).toBeCalledWith( - revisionDetailRequestData({ - appId, - appRevisionId, - }), - ) - }) - }) - - describe('handleCancelPendingRevisionsSuccessCallback', () => { - it('should run correctly when the modal is visible', () => { - const setIsConfirmationModalVisible = jest.fn() - const clientId = appState.auth.loginSession?.loginIdentity.clientId || '' - const fn = handleCancelPendingRevisionsSuccessCallback( - appId, - clientId, - spyDispatch, - setIsConfirmationModalVisible, - ) - fn() - expect(spyDispatch).toBeCalledWith( - developerFetchAppDetail({ - id: appId, - clientId, - }), - ) - }) - }) -}) diff --git a/packages/developer-portal/src/components/pages/app-detail/__tests__/helpers.test.tsx b/packages/developer-portal/src/components/pages/app-detail/__tests__/helpers.test.tsx index 75e85e69b3..33c4c92a02 100644 --- a/packages/developer-portal/src/components/pages/app-detail/__tests__/helpers.test.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/__tests__/helpers.test.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Tag, AppDetailSection, ImageSection } from '../helpers' +import { Tag, AppDetailSection, ImageSection } from '../app-ui-helpers' import { shallow } from 'enzyme' describe('Ui Sections', () => { diff --git a/packages/developer-portal/src/components/pages/app-detail/aside.tsx b/packages/developer-portal/src/components/pages/app-detail/app-aside.tsx similarity index 91% rename from packages/developer-portal/src/components/pages/app-detail/aside.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-aside.tsx index c11b29adb1..4e45c2dd22 100644 --- a/packages/developer-portal/src/components/pages/app-detail/aside.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-aside.tsx @@ -7,7 +7,7 @@ import { DesktopIntegrationTypeModel } from '@reapit/foundations-ts-definitions' import { DeveloperAppDetailState } from '@/reducers/developer' import { AppDetailModel } from '@reapit/foundations-ts-definitions' import useReactResponsive from '@/components/hooks/use-react-responsive' -import DeveloperManageApp from './manage-app' +import AppManageMent from './app-management' import { CategorySection, DesktopIntegrationSection, @@ -41,7 +41,7 @@ export const DeveloperAside: React.FC = ({ desktopIntegrationTypes, - + {isMobile && } ) diff --git a/packages/developer-portal/src/components/ui/app-authentication-detail.tsx b/packages/developer-portal/src/components/pages/app-detail/app-authentication-detail.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/app-authentication-detail.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-authentication-detail.tsx diff --git a/packages/developer-portal/src/components/pages/app-detail/app-content.tsx b/packages/developer-portal/src/components/pages/app-detail/app-content.tsx index 4af0a098cc..f442c6243c 100644 --- a/packages/developer-portal/src/components/pages/app-detail/app-content.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-content.tsx @@ -5,9 +5,9 @@ import { GET_ALL_PAGE_SIZE } from '@/constants/paginator' import { appInstallationsRequestData } from '@/actions/app-installations' import { selectDeveloperId } from '@/selector' import { Button, DATE_TIME_FORMAT, Section } from '@reapit/elements' -import ConfirmUninstall from '@/components/ui/app-installations/confirm-uninstall' +import ConfirmUninstall from './app-uninstall-modal/confirm-uninstall' +import { handleUninstall, handleAfterClose } from './app-uninstall-modal/app-uninstall-modal' import { PagedResultInstallationModel_, InstallationModel } from '@reapit/foundations-ts-definitions' -import { handleUninstall, handleAfterClose } from '@/components/ui/app-installations/app-installations-modal' import { useSelector, useDispatch } from 'react-redux' import { selectInstallationAppData } from '@/selector/installations' import { Modal } from '@reapit/elements' diff --git a/packages/developer-portal/src/components/ui/app-delete.tsx b/packages/developer-portal/src/components/pages/app-detail/app-delete.tsx similarity index 98% rename from packages/developer-portal/src/components/ui/app-delete.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-delete.tsx index 925507c38a..a4e8d68ad6 100644 --- a/packages/developer-portal/src/components/ui/app-delete.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-delete.tsx @@ -4,7 +4,7 @@ import { useDispatch, useSelector } from 'react-redux' import { appDeleteRequest } from '@/actions/app-delete' import { Button, ModalProps, Modal, ModalBody, ModalHeader, ModalFooter } from '@reapit/elements' import appPermissionContentStyles from '@/styles/pages/app-permission-content.scss?mod' -import CallToAction from './call-to-action' +import CallToAction from '../../ui/call-to-action' import { selectAppDeleteFormState } from '@/selector/app-delete' import { Dispatch } from 'redux' diff --git a/packages/developer-portal/src/components/pages/app-detail/app-detail.tsx b/packages/developer-portal/src/components/pages/app-detail/app-detail.tsx index 4130cb5742..d737df4909 100644 --- a/packages/developer-portal/src/components/pages/app-detail/app-detail.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-detail.tsx @@ -4,7 +4,7 @@ import { selectIntegrationTypes } from '@/selector/integration-types' import { DesktopIntegrationTypeModel } from '@/actions/app-integration-types' import { selectInstallationAppData } from '@/selector/installations' import { PagedResultInstallationModel_ } from '@reapit/foundations-ts-definitions' -import { DeveloperAside } from './aside' +import { DeveloperAside } from './app-aside' import { useSelector } from 'react-redux' import { History } from 'history' import { selectAppDetailState, selectAppDetailData, selectAppDetailLoading } from '@/selector/developer-app-detail' diff --git a/packages/developer-portal/src/components/pages/app-detail/manage-app.tsx b/packages/developer-portal/src/components/pages/app-detail/app-management.tsx similarity index 95% rename from packages/developer-portal/src/components/pages/app-detail/manage-app.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-management.tsx index 35514f3e47..e35707cbda 100644 --- a/packages/developer-portal/src/components/pages/app-detail/manage-app.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-management.tsx @@ -2,8 +2,8 @@ import React from 'react' import { DeveloperAppDetailState } from '@/reducers/developer' import { useDispatch, useSelector } from 'react-redux' import { selectClientId } from '@/selector/client' -import DeveloperAppRevisionModal from '@/components/ui/developer-app-revision-modal/developer-app-revision-modal' -import AppDelete from '@/components/ui/app-delete' +import DeveloperAppRevisionModal from './app-revision-modal' +import AppDelete from '@/components/pages/app-detail/app-delete' import { Content, Button } from '@reapit/elements' import { useHistory } from 'react-router' import routes from '@/constants/routes' diff --git a/packages/developer-portal/src/components/pages/app-detail/app-revision-modal.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal.tsx deleted file mode 100644 index 5c9d2b1b1c..0000000000 --- a/packages/developer-portal/src/components/pages/app-detail/app-revision-modal.tsx +++ /dev/null @@ -1,179 +0,0 @@ -import * as React from 'react' -import { useDispatch, useSelector } from 'react-redux' -import { selectAppRevisions, selectAppRevisionDetail } from '@/selector/app-revisions' -import { Modal, Button, Loader } from '@reapit/elements' -import { DeveloperAppDetailState } from '@/reducers/developer' -import { revisionsRequestData } from '@/actions/revisions' -import { revisionDetailRequestData, declineRevision } from '@/actions/revision-detail' -import { Dispatch } from 'redux' -import { LoginIdentity } from '@reapit/cognito-auth' -import { selectLoginIdentity } from '@/selector/auth' -import { selectClientId } from '@/selector/client' -import { developerFetchAppDetail } from '@/actions/developer' -import CallToAction from '@/components/ui/call-to-action' -import AppRevisionComparison from '@/components/ui/app-revision-comparison/app-revision-comparison' - -export type AppRevisionModalProps = { - visible: boolean - appId: string - appDetailState: DeveloperAppDetailState - afterClose: () => void -} - -export const handleUseEffectToFetchAppRevisions = (appId: string, visible: boolean, dispatch: Dispatch) => () => { - if (appId && visible) { - dispatch( - revisionsRequestData({ - appId, - }), - ) - } -} - -export const handleUseEffectToFetchAppRevisionDetail = ( - appId: string, - visible: boolean, - dispatch: Dispatch, - appRevisionId?: string, -) => () => { - if (appId && appRevisionId && visible) { - dispatch( - revisionDetailRequestData({ - appId, - appRevisionId, - }), - ) - } -} - -export const handleCancelPendingRevisionsSuccessCallback = ( - appId: string, - clientId: string, - dispatch: Dispatch, - setIsConfirmationModalVisible: (isVisible: boolean) => void, -) => () => { - dispatch( - developerFetchAppDetail({ - id: appId, - clientId, - }), - ) - setIsConfirmationModalVisible(false) -} - -export const handleCancelPendingRevisionsButtonClick = ( - appId: string, - clientId: string, - dispatch: Dispatch, - setIsConfirmationModalVisible: (isVisible: boolean) => void, - appRevisionId?: string, - loginIdentity?: LoginIdentity, -) => () => { - if (!appRevisionId || !loginIdentity) { - return - } - const { name, email } = loginIdentity - dispatch( - declineRevision({ - appId, - appRevisionId, - name, - email, - rejectionReason: 'Developer Cancelled', - callback: handleCancelPendingRevisionsSuccessCallback(appId, clientId, dispatch, setIsConfirmationModalVisible), - }), - ) -} - -const AppRevisionModal: React.FC = ({ appId, visible, appDetailState, afterClose }) => { - const [isConfirmationModalVisible, setIsConfirmationModalVisible] = React.useState(false) - const dispatch = useDispatch() - const revisions = useSelector(selectAppRevisions) - const appRevisionDetail = useSelector(selectAppRevisionDetail) - const loginIdentity = useSelector(selectLoginIdentity) - const clientId = useSelector(selectClientId) - - const revisionsData = revisions?.data - const latestAppRevisionId = revisionsData && revisionsData[0].id - const { declineFormState, revisionDetailData } = appRevisionDetail - const isDeclining = declineFormState === 'SUBMITTING' - const isDeclinedSuccessfully = declineFormState === 'SUCCESS' - let hasRevisionDetailData = false - if (revisionDetailData) { - hasRevisionDetailData = true - } - - React.useEffect(handleUseEffectToFetchAppRevisions(appId, visible, dispatch), [appId, visible, dispatch]) - - React.useEffect(handleUseEffectToFetchAppRevisionDetail(appId, visible, dispatch, latestAppRevisionId), [ - appId, - latestAppRevisionId, - visible, - dispatch, - ]) - - return ( - setIsConfirmationModalVisible(true)} - dataTest="revision-approve-button" - > - CANCEL PENDING REVISIONS - - } - > - <> - {!hasRevisionDetailData ? ( - - ) : ( - - )} - setIsConfirmationModalVisible(false)} - footerItems={ - <> - - - - } - > -

Are you sure you wish to cancel any pending revisions for this App?

-
- - - - All pending revisions for this app have been cancelled. You can now use the ‘Edit Detail’ option to make any - additional changes as required. - - - -
- ) -} - -export default AppRevisionModal diff --git a/packages/developer-portal/src/components/ui/developer-app-revision-modal/__test__/__snapshots__/developer-app-revision-modal.test.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/__test__/__snapshots__/app-revision-modal.test.tsx.snap similarity index 100% rename from packages/developer-portal/src/components/ui/developer-app-revision-modal/__test__/__snapshots__/developer-app-revision-modal.test.tsx.snap rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/__test__/__snapshots__/app-revision-modal.test.tsx.snap diff --git a/packages/developer-portal/src/components/ui/developer-app-revision-modal/__test__/developer-app-revision-modal.test.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/__test__/app-revision-modal.test.tsx similarity index 99% rename from packages/developer-portal/src/components/ui/developer-app-revision-modal/__test__/developer-app-revision-modal.test.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/__test__/app-revision-modal.test.tsx index b05d294a8d..7c3185151d 100644 --- a/packages/developer-portal/src/components/ui/developer-app-revision-modal/__test__/developer-app-revision-modal.test.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/__test__/app-revision-modal.test.tsx @@ -13,7 +13,7 @@ import { handelePendingRevisionsModalAfterClose, handleCancelPendingRevisionsButtonClick, backToAppDetailsModal, -} from '../developer-app-revision-modal' +} from '../app-revision-modal' import { appDetailDataStub } from '@/sagas/__stubs__/app-detail' import { revisionDetailRequestData, revisionDetailClearData, declineRevision } from '@/actions/revision-detail' import { revisionsRequestData, revisionsClearData } from '@/actions/revisions' diff --git a/packages/developer-portal/src/components/ui/app-revision-comparison/__tests__/__snapshots__/app-revision-comparison.test.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/app-revision-comparison.test.tsx.snap similarity index 100% rename from packages/developer-portal/src/components/ui/app-revision-comparison/__tests__/__snapshots__/app-revision-comparison.test.tsx.snap rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/app-revision-comparison.test.tsx.snap diff --git a/packages/developer-portal/src/components/ui/__tests__/__snapshots__/diff-checkbox.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/diff-checkbox.test.tsx.snap similarity index 100% rename from packages/developer-portal/src/components/ui/__tests__/__snapshots__/diff-checkbox.tsx.snap rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/diff-checkbox.test.tsx.snap diff --git a/packages/developer-portal/src/components/ui/__tests__/__snapshots__/diff-media.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/diff-media.test.tsx.snap similarity index 100% rename from packages/developer-portal/src/components/ui/__tests__/__snapshots__/diff-media.tsx.snap rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/diff-media.test.tsx.snap diff --git a/packages/developer-portal/src/components/ui/__tests__/__snapshots__/diff-render-html.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/diff-render-html.test.tsx.snap similarity index 100% rename from packages/developer-portal/src/components/ui/__tests__/__snapshots__/diff-render-html.tsx.snap rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/diff-render-html.test.tsx.snap diff --git a/packages/developer-portal/src/components/ui/__tests__/__snapshots__/diff-view.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/diff-view.test.tsx.snap similarity index 100% rename from packages/developer-portal/src/components/ui/__tests__/__snapshots__/diff-view.tsx.snap rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/__snapshots__/diff-view.test.tsx.snap diff --git a/packages/developer-portal/src/components/ui/app-revision-comparison/__tests__/app-revision-comparison.test.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/app-revision-comparison.test.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/app-revision-comparison/__tests__/app-revision-comparison.test.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/app-revision-comparison.test.tsx diff --git a/packages/admin-portal/src/components/ui/__tests__/diff-checkbox.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/diff-checkbox.test.tsx similarity index 100% rename from packages/admin-portal/src/components/ui/__tests__/diff-checkbox.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/diff-checkbox.test.tsx diff --git a/packages/admin-portal/src/components/ui/__tests__/diff-media.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/diff-media.test.tsx similarity index 100% rename from packages/admin-portal/src/components/ui/__tests__/diff-media.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/diff-media.test.tsx diff --git a/packages/admin-portal/src/components/ui/__tests__/diff-render-html.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/diff-render-html.test.tsx similarity index 100% rename from packages/admin-portal/src/components/ui/__tests__/diff-render-html.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/diff-render-html.test.tsx diff --git a/packages/admin-portal/src/components/ui/__tests__/diff-view.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/diff-view.test.tsx similarity index 100% rename from packages/admin-portal/src/components/ui/__tests__/diff-view.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/__tests__/diff-view.test.tsx diff --git a/packages/developer-portal/src/components/ui/app-revision-comparison/app-revision-comparison.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/app-revision-comparison.tsx similarity index 97% rename from packages/developer-portal/src/components/ui/app-revision-comparison/app-revision-comparison.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/app-revision-comparison.tsx index 788c3bacf9..473fad5155 100644 --- a/packages/developer-portal/src/components/ui/app-revision-comparison/app-revision-comparison.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/app-revision-comparison.tsx @@ -2,12 +2,12 @@ import * as React from 'react' import { AppDetailState } from '@/reducers/app-detail' import { RevisionDetailState } from '@/reducers/revision-detail' import { AppRevisionModel, MediaModel, ScopeModel } from '@reapit/foundations-ts-definitions' -import DiffMedia from '@/components/ui/diff-media' +import DiffMedia from './diff-media' import { AppDetailModel } from '@/types/marketplace-api-schema' import { DesktopIntegrationTypeModel, PagedResultDesktopIntegrationTypeModel_ } from '@/actions/app-integration-types' -import DiffCheckbox from '../diff-checkbox' -import DiffViewer from '../diff-viewer' -import DiffRenderHTML from '../diff-render-html' +import DiffCheckbox from './diff-checkbox' +import DiffViewer from './diff-viewer' +import DiffRenderHTML from './diff-render-html' import { DeveloperAppDetailState } from '@/reducers/developer' export type AppRevisionComparisonProps = { diff --git a/packages/developer-portal/src/components/ui/diff-checkbox.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/diff-checkbox.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/diff-checkbox.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/diff-checkbox.tsx diff --git a/packages/developer-portal/src/components/ui/diff-media.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/diff-media.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/diff-media.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/diff-media.tsx diff --git a/packages/developer-portal/src/components/ui/diff-render-html.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/diff-render-html.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/diff-render-html.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/diff-render-html.tsx diff --git a/packages/developer-portal/src/components/ui/diff-viewer.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/diff-viewer.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/diff-viewer.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/diff-viewer.tsx diff --git a/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/index.ts b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/index.ts new file mode 100644 index 0000000000..217b9511e3 --- /dev/null +++ b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-comparison/index.ts @@ -0,0 +1,2 @@ +import AppRevisionComparison from './app-revision-comparison' +export default AppRevisionComparison diff --git a/packages/developer-portal/src/components/ui/developer-app-revision-modal/developer-app-revision-modal.tsx b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-modal.tsx similarity index 98% rename from packages/developer-portal/src/components/ui/developer-app-revision-modal/developer-app-revision-modal.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-modal.tsx index 31c3909dd1..00e68b5e9a 100644 --- a/packages/developer-portal/src/components/ui/developer-app-revision-modal/developer-app-revision-modal.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/app-revision-modal.tsx @@ -8,7 +8,7 @@ import { AppDetailState } from '@/reducers/app-detail' import { LoginIdentity } from '@reapit/cognito-auth' import { Modal, Loader, Button } from '@reapit/elements' -import AppRevisionComparison from '../app-revision-comparison/app-revision-comparison' +import AppRevisionComparison from './app-revision-comparison' import CallToAction from '@/components/ui/call-to-action' import { DeveloperAppDetailState } from '@/reducers/developer' import { selectAppRevisions, selectAppRevisionDetail } from '@/selector/app-revisions' diff --git a/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/index.ts b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/index.ts new file mode 100644 index 0000000000..d255906684 --- /dev/null +++ b/packages/developer-portal/src/components/pages/app-detail/app-revision-modal/index.ts @@ -0,0 +1,2 @@ +import DeveloperAppRevisionModal from './app-revision-modal' +export default DeveloperAppRevisionModal diff --git a/packages/developer-portal/src/components/pages/app-detail/app-sections.tsx b/packages/developer-portal/src/components/pages/app-detail/app-sections.tsx index 4043b7ac86..0c9304758e 100644 --- a/packages/developer-portal/src/components/pages/app-detail/app-sections.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-sections.tsx @@ -6,7 +6,7 @@ import { MediaModel, ScopeModel, } from '@reapit/foundations-ts-definitions' -import { AppDetailSection, Tag, ImageSection } from './helpers' +import { AppDetailSection, Tag, ImageSection } from './app-ui-helpers' import { convertBooleanToYesNoString } from '@/utils/boolean-to-yes-no-string' import { FaCheck, FaExternalLinkAlt } from 'react-icons/fa' import styles from '@/styles/blocks/standalone-app-detail.scss?mod' @@ -22,7 +22,7 @@ import { Content, } from '@reapit/elements' import AuthFlow from '@/constants/app-auth-flow' -import AppAuthenticationDetail from '@/components/ui/app-authentication-detail' +import AppAuthenticationDetail from '@/components/pages/app-detail/app-authentication-detail' interface IsSidebar { isSidebar?: boolean diff --git a/packages/developer-portal/src/components/pages/app-detail/helpers.tsx b/packages/developer-portal/src/components/pages/app-detail/app-ui-helpers.tsx similarity index 100% rename from packages/developer-portal/src/components/pages/app-detail/helpers.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-ui-helpers.tsx diff --git a/packages/developer-portal/src/components/ui/app-installations/__tests__/app-installations-modal.tsx b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/__tests__/app-uninstall-modal.test.tsx similarity index 96% rename from packages/developer-portal/src/components/ui/app-installations/__tests__/app-installations-modal.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/__tests__/app-uninstall-modal.test.tsx index 743a720e0d..4717174e41 100644 --- a/packages/developer-portal/src/components/ui/app-installations/__tests__/app-installations-modal.tsx +++ b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/__tests__/app-uninstall-modal.test.tsx @@ -6,7 +6,7 @@ import { handleAfterClose, handleUninstall, AppInstallationsModalProps, -} from '../app-installations-modal' +} from '../app-uninstall-modal' import { installationStub } from '@/sagas/__stubs__/installation' const props: AppInstallationsModalProps = { diff --git a/packages/developer-portal/src/components/ui/app-installations/app-installations-modal.tsx b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/app-uninstall-modal.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/app-installations/app-installations-modal.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/app-uninstall-modal.tsx diff --git a/packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/__tests__/__snapshots__/confirm-uninstall.test.tsx.snap b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/__tests__/__snapshots__/confirm-uninstall.test.tsx.snap similarity index 100% rename from packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/__tests__/__snapshots__/confirm-uninstall.test.tsx.snap rename to packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/__tests__/__snapshots__/confirm-uninstall.test.tsx.snap diff --git a/packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/__tests__/confirm-uninstall.test.tsx b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/__tests__/confirm-uninstall.test.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/__tests__/confirm-uninstall.test.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/__tests__/confirm-uninstall.test.tsx diff --git a/packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/confirm-uninstall.tsx b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/confirm-uninstall.tsx similarity index 100% rename from packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/confirm-uninstall.tsx rename to packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/confirm-uninstall.tsx diff --git a/packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/form-schema/form-fields.ts b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/form-schema/form-fields.ts similarity index 100% rename from packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/form-schema/form-fields.ts rename to packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/form-schema/form-fields.ts diff --git a/packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/form-schema/validation-schema.ts b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/form-schema/validation-schema.ts similarity index 100% rename from packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/form-schema/validation-schema.ts rename to packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/form-schema/validation-schema.ts diff --git a/packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/index.ts b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/index.ts similarity index 100% rename from packages/developer-portal/src/components/ui/app-installations/confirm-uninstall/index.ts rename to packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/confirm-uninstall/index.ts diff --git a/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/index.ts b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/index.ts new file mode 100644 index 0000000000..5d188fecb2 --- /dev/null +++ b/packages/developer-portal/src/components/pages/app-detail/app-uninstall-modal/index.ts @@ -0,0 +1,2 @@ +import AppUninstallModal from './app-uninstall-modal' +export default AppUninstallModal diff --git a/packages/developer-portal/src/components/ui/__tests__/diff-checkbox.tsx b/packages/developer-portal/src/components/ui/__tests__/diff-checkbox.tsx deleted file mode 100644 index 575fb3ec27..0000000000 --- a/packages/developer-portal/src/components/ui/__tests__/diff-checkbox.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import * as React from 'react' -import { shallow } from 'enzyme' -import DiffCheckbox, { DiffCheckboxProps } from '../diff-checkbox' - -const props: DiffCheckboxProps = { - changedChecked: false, - currentChecked: true, -} - -describe('DiffCheckbox', () => { - it('should match a snapshot', () => { - expect(shallow()).toMatchSnapshot() - }) - - it('should only render one checkbox if no different', () => { - const wrapper = shallow() - expect(wrapper.find('input[type="checkbox"]')).toHaveLength(1) - }) - - afterEach(() => { - jest.resetAllMocks() - }) -}) diff --git a/packages/developer-portal/src/components/ui/__tests__/diff-media.tsx b/packages/developer-portal/src/components/ui/__tests__/diff-media.tsx deleted file mode 100644 index c8295a7a4d..0000000000 --- a/packages/developer-portal/src/components/ui/__tests__/diff-media.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import * as React from 'react' -import { shallow } from 'enzyme' -import DiffMedia, { DiffMediaProps } from '../diff-media' - -const props: DiffMediaProps = { - changedMedia: 'image-1', - currentMedia: 'image-2', -} - -describe('DiffMedia', () => { - it('should match a snapshot', () => { - expect(shallow()).toMatchSnapshot() - }) - - afterEach(() => { - jest.resetAllMocks() - }) -}) diff --git a/packages/developer-portal/src/components/ui/__tests__/diff-render-html.tsx b/packages/developer-portal/src/components/ui/__tests__/diff-render-html.tsx deleted file mode 100644 index d7c55a5c29..0000000000 --- a/packages/developer-portal/src/components/ui/__tests__/diff-render-html.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import * as React from 'react' -import { shallow } from 'enzyme' -import DiffRenderHTML, { DiffRenderHTMLProps } from '../diff-render-html' - -const props: DiffRenderHTMLProps = { - currentString: 'abc', - changedString: 'axxxxxxxxxxxbc', -} - -describe('DiffRenderHTML', () => { - it('should match a snapshot', () => { - expect(shallow()).toMatchSnapshot() - }) - - afterEach(() => { - jest.resetAllMocks() - }) -}) diff --git a/packages/developer-portal/src/components/ui/__tests__/diff-view.tsx b/packages/developer-portal/src/components/ui/__tests__/diff-view.tsx deleted file mode 100644 index e6c9911f22..0000000000 --- a/packages/developer-portal/src/components/ui/__tests__/diff-view.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import * as React from 'react' -import { shallow } from 'enzyme' -import DiffViewer, { DiffViewerProps } from '../diff-viewer' - -const props: DiffViewerProps = { - currentString: 'abc', - changedString: 'axxxxxxxxxxxbc', -} - -describe('DiffViewer', () => { - it('should match a snapshot', () => { - expect(shallow()).toMatchSnapshot() - }) - - afterEach(() => { - jest.resetAllMocks() - }) -}) diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/__snapshots__/admin-approval-modal.test.tsx.snap b/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/__snapshots__/admin-approval-modal.test.tsx.snap deleted file mode 100644 index 9b06103642..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/__snapshots__/admin-approval-modal.test.tsx.snap +++ /dev/null @@ -1,21 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AdminRevisionModalInner should match a snapshot when ERROR true 1`] = ` - - - -`; diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/__snapshots__/approve-revision-modal.test.tsx.snap b/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/__snapshots__/approve-revision-modal.test.tsx.snap deleted file mode 100644 index 113515ce87..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/__snapshots__/approve-revision-modal.test.tsx.snap +++ /dev/null @@ -1,27 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ApproveRevisionModal should match a snapshot 1`] = ` - - - - - -`; diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/__snapshots__/decline-revision-modal.test.tsx.snap b/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/__snapshots__/decline-revision-modal.test.tsx.snap deleted file mode 100644 index 4e802b0a96..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/__snapshots__/decline-revision-modal.test.tsx.snap +++ /dev/null @@ -1,40 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DeclineRevisionModal should match a snapshot 1`] = ` - - - -`; diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/admin-approval-modal.test.tsx b/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/admin-approval-modal.test.tsx deleted file mode 100644 index 6c936a7b63..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/admin-approval-modal.test.tsx +++ /dev/null @@ -1,90 +0,0 @@ -import * as React from 'react' -import * as ReactRedux from 'react-redux' -import { mount } from 'enzyme' -import configureStore from 'redux-mock-store' -import appState from '@/reducers/__stubs__/app-state' -import { - AdminApprovalModalInner, - AdminApprovalModalInnerProps, - handleOnApproveSuccess, - handleOnDeclineSuccess, - handleSetIsDeclineModal, - handleSetIsApproveModal, -} from '../admin-approval-modal' - -const props: AdminApprovalModalInnerProps = { - onApprovalClick: jest.fn(), - onDeclineClick: jest.fn(), -} - -describe('AdminRevisionModalInner', () => { - let store - beforeEach(() => { - /* mocking store */ - const mockStore = configureStore() - store = mockStore(appState) - }) - it('should match a snapshot when ERROR true', () => { - expect( - mount( - - - , - ), - ).toMatchSnapshot() - }) -}) - -describe('handleOnApproveSuccess', () => { - it('should call function correctly', () => { - const setIsApproveModalOpen = jest.fn() - const fn = handleOnApproveSuccess(setIsApproveModalOpen) - fn() - expect(setIsApproveModalOpen).toBeCalled() - }) -}) - -describe('handleOnDeclineSuccess', () => { - it('should call function correctly', () => { - const setIsDeclineModalOpen = jest.fn() - const fn = handleOnDeclineSuccess(setIsDeclineModalOpen) - fn() - expect(setIsDeclineModalOpen).toBeCalled() - }) -}) - -describe('handleSetIsDeclineModal', () => { - it('should call function correctly', () => { - const setIsDeclineModalOpen = jest.fn() - const afterClose = jest.fn() - const fn = handleSetIsDeclineModal({ setIsDeclineModalOpen, isDeclineModalOpen: true, afterClose }) - fn() - expect(setIsDeclineModalOpen).toBeCalled() - expect(afterClose).toBeCalled() - }) - - it('should call function correctly', () => { - const setIsDeclineModalOpen = jest.fn() - const fn = handleSetIsDeclineModal({ setIsDeclineModalOpen, isDeclineModalOpen: true }) - fn() - expect(setIsDeclineModalOpen).toBeCalled() - }) -}) - -describe('handleSetIsApproveModal', () => { - it('should call function correctly', () => { - const setIsApproveModalOpen = jest.fn() - const afterClose = jest.fn() - const fn = handleSetIsApproveModal({ setIsApproveModalOpen, isApproveModalOpen: true, afterClose }) - fn() - expect(setIsApproveModalOpen).toBeCalled() - expect(afterClose).toBeCalled() - }) - - it('should call function correctly', () => { - const setIsApproveModalOpen = jest.fn() - const fn = handleSetIsApproveModal({ setIsApproveModalOpen, isApproveModalOpen: true }) - fn() - expect(setIsApproveModalOpen).toBeCalled() - }) -}) diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/approve-revision-modal.test.tsx b/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/approve-revision-modal.test.tsx deleted file mode 100644 index 9766627c8e..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/approve-revision-modal.test.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import * as React from 'react' -import * as ReactRedux from 'react-redux' -import { mount } from 'enzyme' -import configureStore from 'redux-mock-store' -import { - ApproveRevisionModal, - ApproveRevisionModalProps, - handleAfterClose, - handleOnSubmit, - onCancelButtonClick, -} from '../approve-revision-modal' -import appState from '@/reducers/__stubs__/app-state' -import { approveRevision } from '@/actions/revision-detail' - -const props: ApproveRevisionModalProps = { - onApproveSuccess: jest.fn(), - visible: true, -} - -describe('ApproveRevisionModal', () => { - let store - let spyDispatch - beforeEach(() => { - /* mocking store */ - const mockStore = configureStore() - store = mockStore(appState) - spyDispatch = jest.spyOn(ReactRedux, 'useDispatch').mockImplementation(() => store.dispatch) - }) - - it('should match a snapshot', () => { - expect( - mount( - - - , - ), - ).toMatchSnapshot() - }) - - describe('handleAfterClose', () => { - it('should call onApproveSuccess correctly', () => { - const mockProps = { - isSuccessed: true, - onApproveSuccess: jest.fn(), - isLoading: true, - afterClose: jest.fn(), - } - const fn = handleAfterClose(mockProps) - fn() - expect(mockProps.onApproveSuccess).toBeCalled() - }) - it('should call onApproveSuccess correctly', () => { - const mockProps = { - isSuccessed: false, - onApproveSuccess: jest.fn(), - isLoading: false, - afterClose: jest.fn(), - } - const fn = handleAfterClose(mockProps) - fn() - expect(mockProps.afterClose).toBeCalled() - }) - }) - - describe('handleOnSubmit', () => { - it('should call submitApproveRevision', () => { - const mockAppId = 'test' - const mockAppRevisionId = 'test' - const mockFormValues = { - email: 'test@test.com', - name: 'test', - } - const fn = handleOnSubmit(spyDispatch, mockAppId, mockAppRevisionId) - fn(mockFormValues) - expect(spyDispatch).toBeCalledWith( - approveRevision({ appId: mockAppId, appRevisionId: mockAppRevisionId, ...mockFormValues }), - ) - }) - }) - - describe('onCancelButtonClick', () => { - it('should run directly', () => { - const mockAfterClose = jest.fn() - const fn = onCancelButtonClick(mockAfterClose) - fn() - expect(mockAfterClose).toBeCalled() - }) - }) - - afterEach(() => { - jest.resetAllMocks() - }) -}) diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/decline-revision-modal.test.tsx b/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/decline-revision-modal.test.tsx deleted file mode 100644 index 39f8049745..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/__tests__/decline-revision-modal.test.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import * as React from 'react' -import * as ReactRedux from 'react-redux' -import { shallow } from 'enzyme' -import configureStore from 'redux-mock-store' - -import { - DeclineRevisionModal, - DeclineRevisionModalProps, - handleAfterClose, - handleOnSubmit, - onCancelButtonClick, -} from '../decline-revision-modal' -import appState from '@/reducers/__stubs__/app-state' -import { declineRevision } from '@/actions/revision-detail' - -const props: DeclineRevisionModalProps = { - onDeclineSuccess: jest.fn(), - visible: true, -} - -describe('DeclineRevisionModal', () => { - let store - let spyDispatch - beforeEach(() => { - /* mocking store */ - const mockStore = configureStore() - store = mockStore(appState) - spyDispatch = jest.spyOn(ReactRedux, 'useDispatch').mockImplementation(() => store.dispatch) - }) - - afterEach(() => { - jest.resetAllMocks() - }) - - it('should match a snapshot', () => { - expect( - shallow( - - - , - ), - ).toMatchSnapshot() - }) - - describe('handleAfterClose', () => { - it('should call afterClose', () => { - const mockProps = { - isSuccessed: false, - onDeclineSuccess: jest.fn(), - isLoading: false, - afterClose: jest.fn(), - } - const fn = handleAfterClose(mockProps) - fn() - expect(mockProps.afterClose).toBeCalled() - }) - it('should call onDeclineSuccess', () => { - const mockProps = { - isSuccessed: true, - onDeclineSuccess: jest.fn(), - isLoading: true, - afterClose: jest.fn(), - } - const fn = handleAfterClose(mockProps) - fn() - expect(mockProps.onDeclineSuccess).toBeCalled() - }) - - it('handleOnSubmit', () => { - const mockSetRejectionReason = jest.fn() - const mockAppId = '123' - const mockAppRevisionId = '123' - const mockFormValues = { - email: 'test@asd.com', - name: 'test', - rejectionReason: 'test', - } - const fn = handleOnSubmit(mockSetRejectionReason, spyDispatch, mockAppId, mockAppRevisionId) - fn(mockFormValues) - expect(mockSetRejectionReason).toBeCalled() - expect(spyDispatch).toBeCalledWith( - declineRevision({ appId: mockAppId, appRevisionId: mockAppRevisionId, ...mockFormValues }), - ) - }) - }) - - describe('onCancelButtonClick', () => { - it('should run directly', () => { - const mockAfterClose = jest.fn() - const fn = onCancelButtonClick(mockAfterClose) - fn() - expect(mockAfterClose).toBeCalled() - }) - }) -}) diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/admin-approval-modal.tsx b/packages/developer-portal/src/components/ui/admin-approval-modal/admin-approval-modal.tsx deleted file mode 100644 index e9f070dc8d..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/admin-approval-modal.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import * as React from 'react' -import { useSelector } from 'react-redux' -import { Modal, ModalProps, Loader, Button, ModalHeader, ModalFooter, ModalBody, Alert } from '@reapit/elements' -import ApproveRevisionModal from './approve-revision-modal' -import DeclineRevisionModal from './decline-revision-modal' -import AppRevisionComparison from '../app-revision-comparison/app-revision-comparison' -import { selectAppRevisionDetail } from '@/selector/app-revisions' -import { selectAppDetailState } from '@/selector/app-detail' - -export type AdminApprovalModalInnerProps = { - closeParentModal?: () => void - onApprovalClick: () => void - onDeclineClick: () => void -} -export const AdminApprovalModalInner: React.FunctionComponent = ({ - closeParentModal, - onApprovalClick, - onDeclineClick, -}) => { - const revisionDetailState = useSelector(selectAppRevisionDetail) - const appDetailState = useSelector(selectAppDetailState) - if (revisionDetailState.loading || appDetailState.loading) { - return } /> - } - - if (revisionDetailState.error || appDetailState.error) { - return } /> - } - - if (!revisionDetailState.revisionDetailData || !appDetailState.appDetailData) { - return null - } - - const app = appDetailState.appDetailData.data - - return ( - - void} - data-test="revision-detail-modal" - /> - } - /> - - - - - - } - /> - - ) -} - -export const handleOnApproveSuccess = (setIsApproveModalOpen: React.Dispatch>) => () => { - setIsApproveModalOpen(false) -} - -export const handleOnDeclineSuccess = (setIsDeclineModalOpen: React.Dispatch>) => () => { - setIsDeclineModalOpen(false) -} - -export type HandleSetIsApproveModalParams = { - setIsApproveModalOpen: React.Dispatch> - isApproveModalOpen: boolean - afterClose?: () => void -} - -export const handleSetIsApproveModal = ({ - setIsApproveModalOpen, - isApproveModalOpen, - afterClose, -}: HandleSetIsApproveModalParams) => () => { - afterClose && afterClose() - setIsApproveModalOpen(isApproveModalOpen) -} - -export type HandleSetIsDeclineModalParams = { - setIsDeclineModalOpen: React.Dispatch> - isDeclineModalOpen: boolean - afterClose?: () => void -} - -export const handleSetIsDeclineModal = ({ - setIsDeclineModalOpen, - isDeclineModalOpen, - afterClose, -}: HandleSetIsDeclineModalParams) => () => { - afterClose && afterClose() - setIsDeclineModalOpen(isDeclineModalOpen) -} - -export type AdminApprovalModalProps = Pick - -export const AdminApprovalModal: React.FunctionComponent = ({ - visible = true, - afterClose, -}) => { - const [isApproveModalOpen, setIsApproveModalOpen] = React.useState(false) - const [isDeclineModalOpen, setIsDeclineModalOpen] = React.useState(false) - return ( - - - - - - - - ) -} - -export default AdminApprovalModal diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/approve-revision-modal.tsx b/packages/developer-portal/src/components/ui/admin-approval-modal/approve-revision-modal.tsx deleted file mode 100644 index 74eece6d70..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/approve-revision-modal.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import * as React from 'react' -import { useSelector, useDispatch } from 'react-redux' -import { ApproveModel } from '@reapit/foundations-ts-definitions' -import { Button, Modal, ModalProps, ModalBody, SubTitleH6, ModalFooter, Form, Formik } from '@reapit/elements' -import { approveRevision } from '@/actions/revision-detail' -import CallToAction from '../call-to-action' -import { selectAppRevisionDetail } from '@/selector/app-revisions' -import { selectLoginIdentity } from '@/selector/auth' -import { Dispatch } from 'redux' - -export type ApproveRevisionModalProps = Pick & { - onApproveSuccess: () => void -} - -export const handleAfterClose = ({ isSuccessed, onApproveSuccess, isLoading, afterClose }) => () => { - if (isSuccessed) { - onApproveSuccess() - } else if (!isLoading && afterClose) { - afterClose() - } -} - -export const handleOnSubmit = (dispatch: Dispatch, appId?: string, appRevisionId?: string) => formValues => { - if (appId && appRevisionId) { - dispatch(approveRevision({ appId, appRevisionId, ...formValues })) - } -} - -export const onCancelButtonClick = (afterClose?: () => void) => { - return () => { - afterClose && afterClose() - } -} - -export const ApproveRevisionModal: React.FunctionComponent = ({ - visible = true, - afterClose, - onApproveSuccess, -}) => { - const dispatch = useDispatch() - const revisionDetail = useSelector(selectAppRevisionDetail) - const { email, name } = useSelector(selectLoginIdentity) || {} - - const { approveFormState } = revisionDetail - - const { appId, id: appRevisionId } = revisionDetail?.revisionDetailData?.data || {} - - const isLoading = approveFormState === 'SUBMITTING' - const isSuccessed = approveFormState === 'SUCCESS' - - return ( - - - {isSuccessed ? ( - - Revision has been approved successfully. - - ) : ( -
- Do you want to approve this revision?} /> - - - - - } - /> - - )} -
-
- ) -} - -export default ApproveRevisionModal diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/decline-revision-modal.tsx b/packages/developer-portal/src/components/ui/admin-approval-modal/decline-revision-modal.tsx deleted file mode 100644 index ba29bd6592..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/decline-revision-modal.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import * as React from 'react' -import { Dispatch } from 'redux' -import { useDispatch, useSelector } from 'react-redux' -import { RejectRevisionModel } from '@reapit/foundations-ts-definitions' -import { Button, TextArea, Modal, ModalProps, ModalFooter, ModalBody, Form, Formik } from '@reapit/elements' -import { declineRevision } from '@/actions/revision-detail' -import CallToAction from '../call-to-action' -import { selectAppRevisionDetail } from '@/selector/app-revisions' -import { selectLoginIdentity } from '@/selector/auth' -import { validationSchemaDeclineModal as validationSchema } from './validation-schema' -import { formFieldsDeclineModal as formFields } from './form-fields' - -const { rejectionReasonField } = formFields - -export type DeclineRevisionModalProps = Pick & { - onDeclineSuccess: () => void -} - -export const handleAfterClose = ({ isSuccessed, onDeclineSuccess, isLoading, afterClose }) => () => { - if (isSuccessed) { - onDeclineSuccess() - } else if (!isLoading && afterClose) { - afterClose() - } -} - -export const handleOnSubmit = ( - setRejectionReason: React.Dispatch>, - dispatch: Dispatch, - appId?: string, - appRevisionId?: string, -) => (formValues: RejectRevisionModel) => { - if (appId && appRevisionId) { - setRejectionReason(formValues.rejectionReason || '') - dispatch(declineRevision({ appId, appRevisionId, ...formValues })) - } -} - -export const onCancelButtonClick = (afterClose?: () => void) => { - return () => { - afterClose && afterClose() - } -} - -export const DeclineRevisionModal: React.FunctionComponent = ({ - visible, - afterClose, - onDeclineSuccess, -}) => { - const dispatch = useDispatch() - const revisionDetail = useSelector(selectAppRevisionDetail) - const { email, name } = useSelector(selectLoginIdentity) || {} - - const { declineFormState } = revisionDetail - - const { appId, id: appRevisionId } = revisionDetail?.revisionDetailData?.data || {} - const [rejectionReason, setRejectionReason] = React.useState('') - - const isLoading = declineFormState === 'SUBMITTING' - const isSuccessed = declineFormState === 'SUCCESS' - - return ( - - - {isSuccessed ? ( - - Revision has been declined successfully. - - ) : ( -
- - } - /> - - - - - } - /> - - )} -
-
- ) -} - -export default DeclineRevisionModal diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/form-fields.ts b/packages/developer-portal/src/components/ui/admin-approval-modal/form-fields.ts deleted file mode 100644 index 40ba2f5762..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/form-fields.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { FormFieldInfo } from '@reapit/utils' -export type FieldKeyDeclineModal = 'rejectionReasonField' - -export const formFieldsDeclineModal: Record = { - rejectionReasonField: { - name: 'rejectionReason', - label: 'Rejection reason', - }, -} diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/index.ts b/packages/developer-portal/src/components/ui/admin-approval-modal/index.ts deleted file mode 100644 index 48a9895bdb..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './admin-approval-modal' diff --git a/packages/developer-portal/src/components/ui/admin-approval-modal/validation-schema.ts b/packages/developer-portal/src/components/ui/admin-approval-modal/validation-schema.ts deleted file mode 100644 index 6bdd18f811..0000000000 --- a/packages/developer-portal/src/components/ui/admin-approval-modal/validation-schema.ts +++ /dev/null @@ -1,9 +0,0 @@ -import * as Yup from 'yup' -import { formFieldsDeclineModal } from './form-fields' -import errorMessages from '@/constants/error-messages' - -export const validationSchemaDeclineModal = Yup.object().shape({ - [formFieldsDeclineModal.rejectionReasonField.name]: Yup.string() - .trim() - .required(errorMessages.FIELD_REQUIRED), -}) diff --git a/packages/developer-portal/src/components/ui/app-installations/__tests__/__snapshots__/app-installations-modal.tsx.snap b/packages/developer-portal/src/components/ui/app-installations/__tests__/__snapshots__/app-installations-modal.tsx.snap deleted file mode 100644 index 7c2efa8d17..0000000000 --- a/packages/developer-portal/src/components/ui/app-installations/__tests__/__snapshots__/app-installations-modal.tsx.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AppInstallationsModal should match a snapshot 1`] = ` - -`; diff --git a/packages/developer-portal/src/components/ui/developer-app-revision-modal/index.ts b/packages/developer-portal/src/components/ui/developer-app-revision-modal/index.ts deleted file mode 100644 index 78422e3584..0000000000 --- a/packages/developer-portal/src/components/ui/developer-app-revision-modal/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import DeveloperAppRevisionModal from './developer-app-revision-modal' -export default DeveloperAppRevisionModal diff --git a/packages/developer-portal/src/components/ui/submit-app-wizard/steps/step-submit-app-success.tsx b/packages/developer-portal/src/components/ui/submit-app-wizard/steps/step-submit-app-success.tsx index 404457212d..b352b42894 100644 --- a/packages/developer-portal/src/components/ui/submit-app-wizard/steps/step-submit-app-success.tsx +++ b/packages/developer-portal/src/components/ui/submit-app-wizard/steps/step-submit-app-success.tsx @@ -1,6 +1,6 @@ import React from 'react' import AuthFlow from '@/constants/app-auth-flow' -import AppAuthenticationDetail from '@/components/ui/app-authentication-detail' +import AppAuthenticationDetail from '@/components/pages/app-detail/app-authentication-detail' import { CustomCreateAppModel } from '@/actions/submit-app' import { ModalBody, Button, ModalFooter, H5 } from '@reapit/elements' import { WizardStepComponent } from '../types' diff --git a/packages/developer-portal/src/core/__tests__/__snapshots__/router.tsx.snap b/packages/developer-portal/src/core/__tests__/__snapshots__/router.tsx.snap index 3edd831d2b..b1f8a34cf0 100644 --- a/packages/developer-portal/src/core/__tests__/__snapshots__/router.tsx.snap +++ b/packages/developer-portal/src/core/__tests__/__snapshots__/router.tsx.snap @@ -369,20 +369,6 @@ exports[`Router should match a snapshot 1`] = ` fetcher={true} path="/developer/help" /> - catchChunkError(() => import('../components/pa const Apps = React.lazy(() => catchChunkError(() => import('../components/pages/apps'))) const DeveloperAppDetail = React.lazy(() => catchChunkError(() => import('../components/pages/app-detail'))) const DeveloperEditApp = React.lazy(() => catchChunkError(() => import('../components/pages/developer-edit-app'))) -const AdminApprovalsPage = React.lazy(() => catchChunkError(() => import('../components/pages/admin-approvals'))) const AdminDevManagementPage = React.lazy(() => catchChunkError(() => import('../components/pages/admin-dev-management')), ) @@ -158,13 +157,6 @@ const Router = () => { fetcher component={DeveloperHelpPage} /> - { - const changed = currentChecked !== changedChecked - - return ( -
- - - - {changed && } - {changed && ( - - - - )} -
- ) -} - -export default DiffCheckbox diff --git a/packages/marketplace/src/components/ui/diff-media.tsx b/packages/marketplace/src/components/ui/diff-media.tsx deleted file mode 100644 index 089f8a52c2..0000000000 --- a/packages/marketplace/src/components/ui/diff-media.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import * as React from 'react' -import styles from '@/styles/blocks/diff-media.scss?mod' - -export interface DiffMediaProps { - currentMedia?: string - changedMedia?: string - type?: string -} - -const DiffMedia = ({ currentMedia, changedMedia, type }: DiffMediaProps) => { - const blockStyle = type === 'icon' ? styles.iconBlock : styles.mediaBlock - const imageStyle = type === 'icon' ? styles.iconImage : styles.mediaImage - const isDiff = currentMedia !== changedMedia - return ( -
-
-
-
- -
-
-
-
- ) -} - -export default DiffMedia diff --git a/packages/marketplace/src/components/ui/diff-render-html.tsx b/packages/marketplace/src/components/ui/diff-render-html.tsx deleted file mode 100644 index 834fda1de4..0000000000 --- a/packages/marketplace/src/components/ui/diff-render-html.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import * as React from 'react' -import styles from '@/styles/blocks/diff-render-html.scss?mod' -import { HTMLRender } from '@reapit/elements' - -export interface DiffRenderHTMLProps { - currentString?: string - changedString?: string -} - -const DiffRenderHTML = ({ currentString, changedString }: DiffRenderHTMLProps) => { - const isDiff = currentString !== changedString - return ( -
- - - -
- ) -} - -export default DiffRenderHTML diff --git a/packages/marketplace/src/components/ui/diff-viewer.tsx b/packages/marketplace/src/components/ui/diff-viewer.tsx deleted file mode 100644 index 24a1e2ebcb..0000000000 --- a/packages/marketplace/src/components/ui/diff-viewer.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import * as React from 'react' -import * as jsdiff from 'diff' -import styles from '@/styles/blocks/diff-viewer.scss?mod' - -export type DiffType = 'chars' | 'words' | 'lines' | 'wordsWithSpace' - -export interface DiffViewerProps { - currentString: string - changedString: string - type?: DiffType -} - -const diffTypes = { - chars: jsdiff.diffChars, - words: jsdiff.diffWords, - lines: jsdiff.diffLines, - wordsWithSpace: jsdiff.diffWordsWithSpace, -} - -const DiffViewer = ({ currentString, changedString, type = 'words' }: DiffViewerProps) => { - const result = diffTypes[type](currentString, changedString).map((part, index) => { - return ( - - {part.value} - - ) - }) - return
{result}
-} - -export default DiffViewer