Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #1917 Purge unused code from settings page #2043

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ exports[`DeveloperSettingsPage should match snapshot 1`] = `
}
}
>
<DevelperSettingsPage />
<SettingsPage />
</ContextProvider>
`;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { shallow } from 'enzyme'
import DeveloperSettingsPage from '../developer-settings'
import DeveloperSettingsPage from '../settings'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be Settings or SettingsPage only

import { ReduxState } from '@/types/core'
import { Provider } from 'react-redux'
import configureStore from 'redux-mock-store'
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
GridItem,
} from '@reapit/elements'
import { DeveloperModel } from '@reapit/foundations-ts-definitions'
import { validate } from '@/utils/form/developer-settings-contact-information'
import { validate } from '@/utils/form/settings-contact-information'

export type ContactInformationFormProps = FormikProps<ContactInformationValues>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Settings from './settings'
export default Settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { shallow } from 'enzyme'
import DeveloperBillingTabPage from '../developer-settings-billing-tab'
import DeveloperBillingTabPage from '../settings-billing-tab'

describe('DeveloperBillingTabPage', () => {
it('should match snapshot', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './settings-billing-tab'
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as React from 'react'
import { Section } from '@reapit/elements'
import { Tabs } from '../tabs'
import AccountsInformationForm from './accounts-information-form'
import Subcriptions from '@/components/ui/developer-settings/billing/subscriptions'
import Subcriptions from '@/components/pages/settings/billing/subscriptions'

const DevelperSettingsBillingTabPage: React.FC<{}> = () => {
const SettingsBillingTabPage: React.FC<{}> = () => {
// FEATURE FLAG
const isProd = window.reapit.config.appEnv === 'production'

Expand All @@ -20,4 +20,4 @@ const DevelperSettingsBillingTabPage: React.FC<{}> = () => {
)
}

export default DevelperSettingsBillingTabPage
export default SettingsBillingTabPage
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { shallow } from 'enzyme'
import DeveloperOrganisationTabPage, { handleToggleVisibleModal } from '../developer-settings-organisation-tab'
import DeveloperOrganisationTabPage, { handleToggleVisibleModal } from '../settings-organisation-tab'
import * as ReactRedux from 'react-redux'

describe('DeveloperOrganisationTabPage', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './settings-organisation-tab'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { FlexContainerBasic, Table, Section, H5 } from '@reapit/elements'
import SetAsAdminModal from '@/components/ui/developer-settings/set-as-admin-modal'
import SetAsAdminModal from '@/components/pages/settings/set-as-admin-modal'
import SetMemberStatusModal from '@/components/ui/organisation-set-member-status-modal'
import styles from '@/styles/elements/link.scss?mod'
import { developerStub } from '@/sagas/__stubs__/developer'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { selectLoginIdentity } from '@/selector/auth'
import { useSelector } from 'react-redux'
import { Loader, Section } from '@reapit/elements'
import { Forms } from './forms/forms'
import { Tabs } from '../tabs'
import { Tabs } from './tabs'

/**
* render one of:
* developer version and admin version - profile tab
* ^ they both sit on "/developer/settings" route which is so confusing atm
*/
const DevelperSettingsPage: React.FC = () => {
const SettingsPage: React.FC = () => {
// it take a while to 'AUTH_LOGIN_SUCCESS' to fire. If you user is admin, they may exerience a flash
// this make sure settings page don't render until 'loginIdentity' is availabe
const loginIdentity = useSelector(selectLoginIdentity)
Expand All @@ -29,4 +29,4 @@ const DevelperSettingsPage: React.FC = () => {
)
}

export default DevelperSettingsPage
export default SettingsPage
18 changes: 9 additions & 9 deletions packages/developer-portal/src/components/pages/settings/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@ export type TabConfigsProps = {
export const tabConfigs = ({ currentUrl, history, isAdmin, isProd }: TabConfigsProps): TabConfig[] => {
const tabs = [
{
tabIdentifier: Routes.DEVELOPER_SETTINGS,
tabIdentifier: Routes.SETTINGS,
displayText: 'Profile',
onTabClick: () => {
history.push(Routes.DEVELOPER_SETTINGS)
history.push(Routes.SETTINGS)
},
active: currentUrl === Routes.DEVELOPER_SETTINGS,
active: currentUrl === Routes.SETTINGS,
},
{
tabIdentifier: Routes.DEVELOPER_SETTINGS_BILLING_TAB,
tabIdentifier: Routes.SETTINGS_BILLING_TAB,
displayText: 'Billing',
onTabClick: () => {
history.push(Routes.DEVELOPER_SETTINGS_BILLING_TAB)
history.push(Routes.SETTINGS_BILLING_TAB)
},
active: currentUrl === Routes.DEVELOPER_SETTINGS_BILLING_TAB,
active: currentUrl === Routes.SETTINGS_BILLING_TAB,
},
]

if (isAdmin && !isProd) {
// Use splice to make sure ORGANISATION_TAB is second tab
tabs.splice(1, 0, {
tabIdentifier: Routes.DEVELOPER_SETTINGS_ORGANISATION_TAB,
tabIdentifier: Routes.SETTINGS_ORGANISATION_TAB,
displayText: 'Organisation',
onTabClick: () => {
history.push(Routes.DEVELOPER_SETTINGS_ORGANISATION_TAB)
history.push(Routes.SETTINGS_ORGANISATION_TAB)
},
active: currentUrl === Routes.DEVELOPER_SETTINGS_ORGANISATION_TAB,
active: currentUrl === Routes.SETTINGS_ORGANISATION_TAB,
})
}

Expand Down
2 changes: 1 addition & 1 deletion packages/developer-portal/src/components/ui/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const generateMenuConfig = (
{
title: 'Settings',
key: 'SETTINGS',
url: Routes.DEVELOPER_SETTINGS,
url: Routes.SETTINGS,
icon: <FaCog className="nav-item-icon" />,
type: 'SECONDARY',
},
Expand Down
6 changes: 3 additions & 3 deletions packages/developer-portal/src/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const Routes = {
ANALYTICS_TAB: '/developer/analytics/:activeTab?',
DEVELOPER_RESET_PASSWORD: '/developer/reset-password',
DEVELOPER_WEBHOOKS: '/developer/webhooks',
DEVELOPER_SETTINGS: '/developer/settings/',
DEVELOPER_SETTINGS_ORGANISATION_TAB: '/developer/settings/organisation',
DEVELOPER_SETTINGS_BILLING_TAB: '/developer/settings/billing',
SETTINGS: '/developer/settings/',
SETTINGS_ORGANISATION_TAB: '/developer/settings/organisation',
SETTINGS_BILLING_TAB: '/developer/settings/billing',
SUBMIT_APP: '/developer/submit-app',
DEVELOPER_HELP: '/developer/help',
DEVELOPER_APP_PREVIEW: '/developer/apps/:appId/preview',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,6 @@ exports[`Router should match a snapshot 1`] = `
fetcher={true}
path="/client/help"
/>
<Component
allow="CLIENT"
component={
Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
}
}
exact={true}
fetcher={true}
path="/client/settings"
/>
<Component
allow="DEVELOPER"
component={
Expand Down
Loading