Skip to content

Commit

Permalink
Address review comments #1379
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvdavies committed Dec 2, 2024
1 parent 09cb6b7 commit 26fab0f
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ vi.mock('axios', async () => {
if (path === '/settings.json') {
return Promise.resolve({
data: {
// Set provider to icat as that supports maintenance states needed for App.test.tsx
'auth-provider': 'icat',
'ui-strings': '/res/default.json',
plugins: [],
Expand Down
5 changes: 1 addition & 4 deletions src/adminPage/adminPage.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ const AdminPage = (props: AdminPageProps): ReactElement => {
location.pathname.startsWith(adminRoutes[key])
) ??
(props.adminPageDefaultTab &&
Object.prototype.hasOwnProperty.call(
adminRoutes,
props.adminPageDefaultTab
)
Object.hasOwn(adminRoutes, props.adminPageDefaultTab)
? props.adminPageDefaultTab
: 'maintenance')
);
Expand Down
3 changes: 1 addition & 2 deletions src/mainAppBar/mobileOverflowMenu.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ function MobileOverflowMenu({

function navigateToAdminPage(): void {
const targetRoute =
adminPageDefaultTab &&
Object.prototype.hasOwnProperty.call(adminRoutes, adminPageDefaultTab)
adminPageDefaultTab && Object.hasOwn(adminRoutes, adminPageDefaultTab)
? adminRoutes[adminPageDefaultTab]
: adminRoutes['maintenance'];

Expand Down
3 changes: 1 addition & 2 deletions src/mainAppBar/pageLinks.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ function PageLinks(): JSX.Element {

function navigateToAdminPage(): void {
const targetRoute =
adminPageDefaultTab &&
Object.prototype.hasOwnProperty.call(adminRoutes, adminPageDefaultTab)
adminPageDefaultTab && Object.hasOwn(adminRoutes, adminPageDefaultTab)
? adminRoutes[adminPageDefaultTab]
: adminRoutes['maintenance'];

Expand Down
2 changes: 1 addition & 1 deletion src/state/reducers/createReducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Action {

function createReducer(initialState: any, handlers: Record<string, any>): any {
return function reducer(state: any = initialState, action: Action) {
if (action && Object.prototype.hasOwnProperty.call(handlers, action.type)) {
if (action && Object.hasOwn(handlers, action.type)) {
return handlers[action.type](state, action.payload);
}
return state;
Expand Down
2 changes: 0 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export default defineConfig(({ mode }) => {
plugins: plugins,
server: {
port: 3000,
// Don't open by default as Dockerfile wont run as it can't find a display
open: false,
},
preview: {
port: 5001,
Expand Down

0 comments on commit 26fab0f

Please sign in to comment.