Refactor decode to match existing partner.
This commit is contained in:
51
package-lock.json
generated
51
package-lock.json
generated
@@ -17,12 +17,15 @@
|
||||
"electron-log": "^5.3.2",
|
||||
"electron-store": "^8.2.0",
|
||||
"electron-updater": "^6.3.9",
|
||||
"graphql-request": "^7.1.2",
|
||||
"i18next": "^24.2.2",
|
||||
"lodash": "^4.17.21",
|
||||
"playwright": "^1.51.0",
|
||||
"react-error-boundary": "^5.0.0",
|
||||
"react-i18next": "^15.4.1",
|
||||
"react-redux": "^9.2.0"
|
||||
"react-redux": "^9.2.0",
|
||||
"redux-logger": "^3.0.6",
|
||||
"redux-thunk": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ant-design/v5-patch-for-react-19": "^1.0.3",
|
||||
@@ -2217,6 +2220,15 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@graphql-typed-document-node/core": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz",
|
||||
"integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@grpc/grpc-js": {
|
||||
"version": "1.9.15",
|
||||
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.15.tgz",
|
||||
@@ -5402,6 +5414,12 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/deep-diff": {
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-0.3.8.tgz",
|
||||
"integrity": "sha512-yVn6RZmHiGnxRKR9sJb3iVV2XTF1Ghh2DiWRZ3dMnGc43yUdWWF/kX6lQyk3+P84iprfWKU/8zFTrlkvtFm1ug==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/deep-is": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||
@@ -7341,6 +7359,28 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/graphql": {
|
||||
"version": "16.10.0",
|
||||
"resolved": "https://registry.npmjs.org/graphql/-/graphql-16.10.0.tgz",
|
||||
"integrity": "sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/graphql-request": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-7.1.2.tgz",
|
||||
"integrity": "sha512-+XE3iuC55C2di5ZUrB4pjgwe+nIQBuXVIK9J98wrVwojzDW3GMdSBZfxUk8l4j9TieIpjpggclxhNEU9ebGF8w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@graphql-typed-document-node/core": "^3.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"graphql": "14 - 16"
|
||||
}
|
||||
},
|
||||
"node_modules/has-bigints": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz",
|
||||
@@ -10755,6 +10795,15 @@
|
||||
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/redux-logger": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/redux-logger/-/redux-logger-3.0.6.tgz",
|
||||
"integrity": "sha512-JoCIok7bg/XpqA1JqCqXFypuqBbQzGQySrhFzewB7ThcnysTO30l4VCst86AuB9T9tuT03MAA56Jw2PNhRSNCg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"deep-diff": "^0.3.5"
|
||||
}
|
||||
},
|
||||
"node_modules/redux-thunk": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
|
||||
|
||||
@@ -29,12 +29,15 @@
|
||||
"electron-log": "^5.3.2",
|
||||
"electron-store": "^8.2.0",
|
||||
"electron-updater": "^6.3.9",
|
||||
"graphql-request": "^7.1.2",
|
||||
"i18next": "^24.2.2",
|
||||
"lodash": "^4.17.21",
|
||||
"playwright": "^1.51.0",
|
||||
"react-error-boundary": "^5.0.0",
|
||||
"react-i18next": "^15.4.1",
|
||||
"react-redux": "^9.2.0"
|
||||
"react-redux": "^9.2.0",
|
||||
"redux-logger": "^3.0.6",
|
||||
"redux-thunk": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ant-design/v5-patch-for-react-19": "^1.0.3",
|
||||
|
||||
@@ -19,5 +19,5 @@ export interface DecodedStlLine {
|
||||
ttl_amt?: number;
|
||||
}
|
||||
export interface DecodedStl {
|
||||
cieca_stl: DecodedStlLine[];
|
||||
cieca_stl: { data: DecodedStlLine[] };
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ const DecodeStl = async (
|
||||
//Apply business logic transfomrations.
|
||||
//We don't have an inspection date, we instead have `date_estimated`
|
||||
|
||||
return { cieca_stl: rawStlData };
|
||||
return { cieca_stl: { data: rawStlData } };
|
||||
};
|
||||
export default DecodeStl;
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface VehicleRecordInterface {
|
||||
impact2?: string;
|
||||
};
|
||||
// Paint code information
|
||||
paint_codes: {
|
||||
v_paint_codes: {
|
||||
paint_cd1: string;
|
||||
paint_cd2: string;
|
||||
paint_cd3: string;
|
||||
|
||||
@@ -77,7 +77,7 @@ const DecodeVeh = async (
|
||||
delete rawVehData.impact_2;
|
||||
|
||||
//Consolidate Paint Code information.
|
||||
rawVehData.paint_codes = {
|
||||
rawVehData.v_paint_codes = {
|
||||
paint_cd1: rawVehData.paint_cd1 ?? "",
|
||||
paint_cd2: rawVehData.paint_cd2 ?? "",
|
||||
paint_cd3: rawVehData.paint_cd3 ?? "",
|
||||
|
||||
@@ -34,4 +34,13 @@ export const { increment, decrement, incrementByAmount } = appSlice.actions;
|
||||
// Other code such as selectors can use the imported `RootState` type
|
||||
export const selectCount = (state: RootState): number => state.app.value;
|
||||
|
||||
//Async Functions - Thunks
|
||||
// Define a thunk that dispatches those action creators
|
||||
const fetchUsers = () => async (dispatch) => {
|
||||
dispatch(increment());
|
||||
//Some sort of async action.
|
||||
|
||||
dispatch(incrementByAmount(100));
|
||||
};
|
||||
|
||||
export default appSlice.reducer;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import logger from "redux-logger";
|
||||
import appReducer from "./app.slice";
|
||||
|
||||
const store = configureStore({
|
||||
reducer: { app: appReducer },
|
||||
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(logger),
|
||||
});
|
||||
|
||||
// Infer the `RootState` and `AppDispatch` types from the store itself
|
||||
|
||||
@@ -2,7 +2,8 @@ import type { TypedUseSelectorHook } from "react-redux";
|
||||
import { useDispatch, useSelector, useStore } from "react-redux";
|
||||
import type { AppDispatch, AppStore, RootState } from "./redux-store";
|
||||
|
||||
// Use throughout your app instead of plain `useDispatch` and `useSelector`
|
||||
|
||||
//Use these custom hooks to access the Redux store from your component with type safety.
|
||||
export const useAppDispatch: () => AppDispatch = useDispatch;
|
||||
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
||||
export const useAppStore: () => AppStore = useStore;
|
||||
|
||||
12
src/renderer/src/util/ipcRendererHandler.ts
Normal file
12
src/renderer/src/util/ipcRendererHandler.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
//Set up all of the IPC handlers.
|
||||
import ipcTypes from "../../../util/ipcTypes.json";
|
||||
|
||||
const ipcRenderer = window.electron.ipcRenderer;
|
||||
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.test,
|
||||
(event: Electron.IpcRendererEvent, arg) => {
|
||||
console.log("Received test message from main process");
|
||||
console.log(arg);
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user