Skip to content

Commit

Permalink
Merge pull request #163 from bcgsc/release/v6.9.0
Browse files Browse the repository at this point in the history
Release/v6.9.0
  • Loading branch information
kttkjl committed Feb 19, 2022
2 parents e21c3bd + 49160d1 commit 387a524
Show file tree
Hide file tree
Showing 18 changed files with 27,684 additions and 28,809 deletions.
39 changes: 39 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
"extends": [
"airbnb",
"airbnb-typescript",
"airbnb/hooks",
"plugin:@typescript-eslint/recommended"
],
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"react/function-component-definition": "off",
"import/extensions": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"import/prefer-default-export": "warn",
"max-len": "off",
"no-param-reassign": "warn",
"no-underscore-dangle": ["warn", { "allow": ["_env_"] }],
"no-restricted-syntax": [
"error",
"ForInStatement",
"LabeledStatement",
"WithStatement"
],
"prefer-destructuring": ["error", { "object": true, "array": true }],
},
"settings": {
"import/resolver": {
typescript: {}
},
},
}
112 changes: 0 additions & 112 deletions .eslintrc.json

This file was deleted.

77 changes: 2 additions & 75 deletions app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { SnackbarProvider } from 'notistack';
import CssBaseline from '@mui/material/CssBaseline';
import { createTheme, ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
// eslint-disable-next-line import/no-extraneous-dependencies
Expand All @@ -14,7 +14,7 @@ import { CsvExportModule } from '@ag-grid-community/csv-export';
import MainView from './views/MainView';
import { SnackbarUtilsConfigurator } from './services/SnackbarUtils';
import CacheBuster from './components/CacheBuster';
import cssTheme from './styles/_theme.module.scss';
import theme from './appTheme';

// eslint-disable-next-line import/no-extraneous-dependencies
import '@ag-grid-community/core/dist/styles/ag-grid.min.css';
Expand All @@ -23,75 +23,6 @@ import '@ag-grid-community/core/dist/styles/ag-theme-material.min.css';
import '@fontsource/roboto';
import './styles/ag-grid.scss';

const theme = createTheme({
direction: 'ltr',
palette: {
primary: {
main: cssTheme.primaryMain,
light: cssTheme.primaryLight,
dark: cssTheme.primaryDark,
contrastText: cssTheme.primaryContrastText,
},
secondary: {
main: cssTheme.secondaryMain,
light: cssTheme.secondaryLight,
dark: cssTheme.secondaryDark,
contrastText: cssTheme.secondaryContrastText,
},
error: {
main: cssTheme.errorMain,
light: cssTheme.errorLight,
dark: cssTheme.errorDark,
contrastText: cssTheme.errorContrastText,
},
text: {
primary: cssTheme.textPrimary,
secondary: cssTheme.textSecondary,
disabled: cssTheme.textDisabled,
},
},
typography: {
body1: { fontSize: cssTheme.fontSizeBody1 },
body2: { fontSize: cssTheme.fontSizeBody2 },
h1: { fontSize: cssTheme.fontSizeH1 },
h2: { fontSize: cssTheme.fontSizeH2 },
h3: { fontSize: cssTheme.fontSizeH3 },
h4: { fontSize: cssTheme.fontSizeH4 },
h5: { fontSize: cssTheme.fontSizeH5 },
h6: { fontSize: cssTheme.fontSizeH6 },
subtitle1: { fontSize: cssTheme.fontSizeSubtitle1 },
},
components: {
MuiCssBaseline: {
styleOverrides: {
'@global': {
html: {
WebkitFontSmoothing: 'auto',
},
},
},
},
MuiDialogTitle: {
styleOverrides: {
root: {
fontSize: cssTheme.fontSizeH2,
},
},
},
MuiButton: {
defaultProps: {
color: 'inherit',
},
},
MuiTabs: {
defaultProps: {
indicatorColor: 'secondary',
textColor: 'secondary',
},
},
},
});

ModuleRegistry.registerModules([
ClientSideRowModelModule,
CsvExportModule,
Expand Down Expand Up @@ -126,7 +57,3 @@ function App() {
}

export default App;

export {
theme,
};
73 changes: 73 additions & 0 deletions app/appTheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { createTheme } from '@mui/material/styles';
import cssTheme from './styles/_theme.module.scss';

const theme = createTheme({
direction: 'ltr',
palette: {
primary: {
main: cssTheme.primaryMain,
light: cssTheme.primaryLight,
dark: cssTheme.primaryDark,
contrastText: cssTheme.primaryContrastText,
},
secondary: {
main: cssTheme.secondaryMain,
light: cssTheme.secondaryLight,
dark: cssTheme.secondaryDark,
contrastText: cssTheme.secondaryContrastText,
},
error: {
main: cssTheme.errorMain,
light: cssTheme.errorLight,
dark: cssTheme.errorDark,
contrastText: cssTheme.errorContrastText,
},
text: {
primary: cssTheme.textPrimary,
secondary: cssTheme.textSecondary,
disabled: cssTheme.textDisabled,
},
},
typography: {
body1: { fontSize: cssTheme.fontSizeBody1 },
body2: { fontSize: cssTheme.fontSizeBody2 },
h1: { fontSize: cssTheme.fontSizeH1 },
h2: { fontSize: cssTheme.fontSizeH2 },
h3: { fontSize: cssTheme.fontSizeH3 },
h4: { fontSize: cssTheme.fontSizeH4 },
h5: { fontSize: cssTheme.fontSizeH5 },
h6: { fontSize: cssTheme.fontSizeH6 },
subtitle1: { fontSize: cssTheme.fontSizeSubtitle1 },
},
components: {
MuiCssBaseline: {
styleOverrides: {
'@global': {
html: {
WebkitFontSmoothing: 'auto',
},
},
},
},
MuiDialogTitle: {
styleOverrides: {
root: {
fontSize: cssTheme.fontSizeH2,
},
},
},
MuiButton: {
defaultProps: {
color: 'inherit',
},
},
MuiTabs: {
defaultProps: {
indicatorColor: 'secondary',
textColor: 'secondary',
},
},
},
});

export default theme;
26 changes: 21 additions & 5 deletions app/components/PrintTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ const PrintTable = ({
const colA = columnDefs.find((col) => col.colId === keyA);
const colB = columnDefs.find((col) => col.colId === keyB);

let indexA = order.findIndex((key) => key === colA?.headerName);
let indexB = order.findIndex((key) => key === colB?.headerName);
let indexA;
let indexB;

if (order?.length > 0) {
indexA = order.findIndex((key) => key === colA?.headerName);
indexB = order.findIndex((key) => key === colB?.headerName);
} else {
indexA = columnDefs.findIndex((colD) => colD.field === colA.field);
indexB = columnDefs.findIndex((colD) => colD.field === colB.field);
}

// -1 would sort the column first. Put not found columns last instead
if (indexA === -1) {
Expand All @@ -45,8 +53,16 @@ const PrintTable = ({
}, [columnDefs, order]);

const headerSortFunc = useCallback((columnA, columnB): number => {
let indexA = order.findIndex((key) => key === columnA.headerName && columnA.colId);
let indexB = order.findIndex((key) => key === columnB.headerName && columnB.colId);
let indexA;
let indexB;

if (order?.length > 0) {
indexA = order.findIndex((key) => key === columnA.headerName && columnA.colId);
indexB = order.findIndex((key) => key === columnB.headerName && columnB.colId);
} else {
indexA = columnDefs.findIndex((col) => col.headerName === columnA.headerName && columnA.colId);
indexB = columnDefs.findIndex((col) => col.headerName === columnB.headerName && columnB.colId);
}

// -1 would sort the column first. Put not found columns last instead
if (indexA === -1) {
Expand All @@ -63,7 +79,7 @@ const PrintTable = ({
return 1;
}
return 0;
}, [columnDefs.length, order]);
}, [columnDefs, order]);

return (
<div className="table-container">
Expand Down
7 changes: 4 additions & 3 deletions app/services/api/ApiCall.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { ThemeProvider, Theme, StyledEngineProvider } from '@mui/material/styles';
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';

import {
BadRequestError,
} from '../errors/errors';
import AlertDialog from '../../components/AlertDialog';
import { theme } from '../../App';
import theme from '../../appTheme';
import errorHandler from '../errors/errorHandler';
import SnackbarUtils from '../SnackbarUtils';

Expand Down Expand Up @@ -181,4 +181,5 @@ class ApiCall {
}
}

export default ApiCall;
export { ApiCall };
export type { ApiCall as ApiCallType };
Loading

0 comments on commit 387a524

Please sign in to comment.