Working ANTD5 and major updates without DayJS

This commit is contained in:
Patrick Fic
2024-04-18 09:29:00 -07:00
parent e1e29f8a4d
commit 79a0881f5a
45 changed files with 5519 additions and 13202 deletions

View File

@@ -1,3 +1,3 @@
REACT_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyCXg148Ma82Qa7dK-2EL4sE0tJhKVnh1rY", "authDomain": "rps-prod-b53c8.firebaseapp.com", "databaseURL": "https://rps-prod-b53c8.firebaseio.com", "projectId": "rps-prod-b53c8", "storageBucket": "rps-prod-b53c8.appspot.com", "messagingSenderId": "361220226954", "appId": "1:361220226954:web:bf3a38d196e4fd8c921273", "measurementId": "G-W3BHH420EC"}
REACT_APP_GRAPHQL_ENDPOINT=https://rps.bodyshop.app/v1/graphql
REACT_APP_GRAPHQL_ENDPOINT_WS=wss://rps.bodyshop.app/v1/graphql
VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyCXg148Ma82Qa7dK-2EL4sE0tJhKVnh1rY", "authDomain": "rps-prod-b53c8.firebaseapp.com", "databaseURL": "https://rps-prod-b53c8.firebaseio.com", "projectId": "rps-prod-b53c8", "storageBucket": "rps-prod-b53c8.appspot.com", "messagingSenderId": "361220226954", "appId": "1:361220226954:web:bf3a38d196e4fd8c921273", "measurementId": "G-W3BHH420EC"}
VITE_APP_GRAPHQL_ENDPOINT=https://rps.bodyshop.app/v1/graphql
VITE_APP_GRAPHQL_ENDPOINT_WS=wss://rps.bodyshop.app/v1/graphql

View File

@@ -1,3 +1,3 @@
REACT_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyCXg148Ma82Qa7dK-2EL4sE0tJhKVnh1rY", "authDomain": "rps-prod-b53c8.firebaseapp.com", "databaseURL": "https://rps-prod-b53c8.firebaseio.com", "projectId": "rps-prod-b53c8", "storageBucket": "rps-prod-b53c8.appspot.com", "messagingSenderId": "361220226954", "appId": "1:361220226954:web:bf3a38d196e4fd8c921273", "measurementId": "G-W3BHH420EC"}
REACT_APP_GRAPHQL_ENDPOINT=https://db.rps.imex.online/v1/graphql
REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.rps.imex.online/v1/graphql
VITE_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyCXg148Ma82Qa7dK-2EL4sE0tJhKVnh1rY", "authDomain": "rps-prod-b53c8.firebaseapp.com", "databaseURL": "https://rps-prod-b53c8.firebaseio.com", "projectId": "rps-prod-b53c8", "storageBucket": "rps-prod-b53c8.appspot.com", "messagingSenderId": "361220226954", "appId": "1:361220226954:web:bf3a38d196e4fd8c921273", "measurementId": "G-W3BHH420EC"}
VITE_APP_GRAPHQL_ENDPOINT=https://db.rps.imex.online/v1/graphql
VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.rps.imex.online/v1/graphql

19
.eslintrc.json Normal file
View File

@@ -0,0 +1,19 @@
{
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-console": "off"
},
"settings": {}
}

18
.prettierrc.js Normal file
View File

@@ -0,0 +1,18 @@
const config = {
printWidth: 120,
useTabs: false,
tabWidth: 2,
trailingComma: "none",
semi: true,
singleQuote: false,
bracketSpacing: true,
arrowParens: "always",
jsxSingleQuote: false,
bracketSameLine: false,
endOfLine: "lf"
// importOrder: ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
// importOrderSeparation: true,
// importOrderSortSpecifiers: true
};
module.exports = config;

47
index.html Normal file
View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<script type="text/javascript">
window.$crisp = [];
window.CRISP_WEBSITE_ID = "36724f62-2eb0-4b29-9cdd-9905fb99913e";
(function () {
d = document;
s = d.createElement("script");
s.src = "https://client.crisp.chat/l.js";
s.async = 1;
d.getElementsByTagName("head")[0].appendChild(s);
})();
</script>
<!--
<script data-jsd-embedded data-key="51adb36e-ee16-46b1-a4c6-4b6d5fcd8530" data-base-url="https://jsd-widget.atlassian.com" src="https://jsd-widget.atlassian.com/assets/embed.js"></script>
-->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#002366" />
<meta name="description" content="Web site created using create-react-app" />
<!-- <link rel="apple-touch-icon" href="logo192.png" /> -->
<link rel="apple-touch-icon" href="logo240.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>ImEX RPS</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
</body>
</html>

18344
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,8 +7,10 @@
"main": "electron/main.js",
"homepage": "./",
"dependencies": {
"@ant-design/pro-layout": "^7.19.0",
"@apollo/client": "^3.9.11",
"@sentry/electron": "^4.22.0",
"@vitejs/plugin-react": "^4.2.1",
"antd": "^5.16.2",
"apollo-link-logger": "^2.0.1",
"apollo-link-sentry": "^3.3.0",
@@ -16,7 +18,7 @@
"dbffile": "^1.9.3",
"dinero.js": "^1.9.1",
"electron-context-menu": "^3.6.1",
"electron-is-dev": "^3.0.1",
"electron-is-dev": "^2.0.0",
"electron-log": "^5.1.2",
"electron-reload": "^2.0.0-alpha.1",
"electron-store": "^8.2.0",
@@ -33,7 +35,6 @@
"react-infinite-scroller": "^1.2.6",
"react-redux": "^9.1.1",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"recharts": "^2.12.5",
"redux": "^5.0.1",
"redux-logger": "^3.0.6",
@@ -41,13 +42,12 @@
"redux-saga": "^1.3.0",
"reselect": "^5.1.0",
"sass": "^1.75.0",
"subscriptions-transport-ws": "^0.9.19"
"subscriptions-transport-ws": "^0.9.19",
"vite-plugin-ejs": "^1.7.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"start": "vite",
"build": "vite build",
"dev": "concurrently -k \"npm start\" \"npm:electron\"",
"electron": "electron .",
"pack": "electron-builder --dir",
@@ -77,7 +77,12 @@
"electron": "^30.0.0",
"electron-builder": "^24.13.3",
"electron-devtools-installer": "^3.2.0",
"enzyme": "^3.11.0"
"vite": "^5.0.11",
"vite-plugin-babel": "^1.2.0",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-legacy": "^2.1.0",
"vite-plugin-node-polyfills": "^0.19.0",
"vite-plugin-style-import": "^2.0.0"
},
"build": {
"extends": null,

8
src/.eslintrc Normal file
View File

@@ -0,0 +1,8 @@
{
"extends": [
"react-app"
],
"rules": {
"no-useless-rename": "off"
}
}

View File

@@ -30,7 +30,7 @@ export function App({ currentUser, checkUserSession }) {
useEffect(() => {
//
return () => {
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.stop);
ipcRenderer.send(ipcTypes.fileWatcher.toMain.stop);
};
}, []);

View File

@@ -8,7 +8,7 @@ export default function DeleteAllEmsAtom() {
<Popconfirm
title="Are you sure you want to delete all EMS files? This cannot be undone."
onConfirm={() =>
ipcRenderer.send(ipcTypes.default.fileScan.toMain.deleteAllEms)
ipcRenderer.send(ipcTypes.fileScan.toMain.deleteAllEms)
}
>
<Button>Delete All EMS</Button>

View File

@@ -20,7 +20,7 @@ export function DeleteJobAtom({ setSelectedJobId, jobId }) {
const [loading, setLoading] = useState(false);
const handleDelete = async () => {
setLoading(true);
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "DELETE_JOB",
});
const result = await deleteJob({

View File

@@ -8,7 +8,7 @@ export default function ErrorResultAtom({
errorMessage,
tryAgainCallback,
}) {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "ERROR_RESULT_ATOM_DISPLAYED",
title,
errorMessage,

View File

@@ -11,7 +11,7 @@ export default function IgnoreJobLineAtom({ ignore, lineId, line_desc }) {
const handleChange = async (checked) => {
console.log("handleChange -> checked", checked);
setLoading(true);
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "TOGGLE_IGNORE_LINE",
line_desc: line_desc,
ignore: !checked,

View File

@@ -17,12 +17,12 @@ const mapDispatchToProps = (dispatch) => ({
export function NotificationsToggleAtom({ appSettings }) {
const handleChange = (val) => {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "TOGGLE_NOTIFICATION",
enabled: val,
});
ipcRenderer.send(ipcTypes.default.store.set, {
ipcRenderer.send(ipcTypes.store.set, {
enableNotifications: val,
});
};

View File

@@ -17,12 +17,12 @@ const mapDispatchToProps = (dispatch) => ({
export function WatcherStartupAtom({ appSettings }) {
const handleChange = (val) => {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "TOGGLE_WATCHER_ON_STARTUP",
enabled: val,
});
ipcRenderer.send(ipcTypes.default.store.set, {
ipcRenderer.send(ipcTypes.store.set, {
runWatcherOnStartup: val,
});
};

View File

@@ -15,7 +15,7 @@ export default function CloseDateDisplayMolecule({ job, jobId, close_date }) {
const [updateJob] = useMutation(UPDATE_JOB);
const handleChange = async (newDate) => {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "SET_CLOSED_DATE",
});
setLoading(true);

View File

@@ -5,7 +5,7 @@ const { ipcRenderer } = window;
export default function FilepathAddMolecule() {
const handleClick = () => {
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.addPath);
ipcRenderer.send(ipcTypes.fileWatcher.toMain.addPath);
};
return <Button onClick={handleClick}>Add Path</Button>;
}

View File

@@ -6,7 +6,7 @@ const { ipcRenderer } = window;
export default function FilePathMolecule(item, index) {
const handleClick = () => {
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.removePath, item);
ipcRenderer.send(ipcTypes.fileWatcher.toMain.removePath, item);
};
return (

View File

@@ -25,7 +25,7 @@ export function JobGroupMolecule({ bodyshop, jobId, group, job }) {
const [updateJob] = useMutation(UPDATE_JOB);
const handleMenuClick = async (value) => {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "CHANGE_VEHICLE_GROUP",
vehicle: `${job.v_model_yr} ${job.v_makedesc} ${job.v_model} (${job.v_type})`,
oldGroup: group,

View File

@@ -1,4 +1,4 @@
import { Alert, Descriptions, PageHeader, Skeleton, Tooltip } from "antd";
import { Alert, Descriptions, Skeleton, Tooltip } from "antd";
import React from "react";
import CurrencyFormatterAtom from "../../atoms/currency-formatter/currency-formatter.atom";
import ErrorResultAtom from "../../atoms/error-result/error-result.atom";
@@ -9,16 +9,14 @@ import DeleteJobAtom from "../../atoms/delete-job/delete-job.atom";
import VehicleGroupAlertAtom from "../../atoms/vehicle-group-alert/vehicle-group-alert.atom";
import { DateFormat } from "../../../util/constants";
import moment from "moment";
import { PageHeader } from "@ant-design/pro-layout";
export default function JobsDetailDescriptionMolecule({ loading, job }) {
if (loading) return <Skeleton active />;
if (!job)
return (
<ErrorResultAtom
title="Error displaying job header data."
errorMessage="It looks like this job doesn't exist."
/>
<ErrorResultAtom title="Error displaying job header data." errorMessage="It looks like this job doesn't exist." />
);
return (
@@ -40,7 +38,7 @@ export default function JobsDetailDescriptionMolecule({ loading, job }) {
/>
</Tooltip>
),
<DeleteJobAtom key="delete" jobId={job.id} />,
<DeleteJobAtom key="delete" jobId={job.id} />
]}
>
<Descriptions column={{ xxl: 5, xl: 4, lg: 3, md: 3, sm: 2, xs: 1 }}>
@@ -62,24 +60,16 @@ export default function JobsDetailDescriptionMolecule({ loading, job }) {
</Tooltip>
}
>
<CloseDateDisplayMolecule
job={job}
jobId={job.id}
close_date={job.close_date}
/>
<CloseDateDisplayMolecule job={job} jobId={job.id} close_date={job.close_date} />
</Descriptions.Item>
<Descriptions.Item label="Last Updated">
<TimeAgoFormatter>{job.updated_at}</TimeAgoFormatter>
</Descriptions.Item>
<Descriptions.Item label="# RPS Eligible Parts">
{job &&
job.joblines.filter((i) => !i.ignore && i.db_ref !== "900511")
.length}
{job && job.joblines.filter((i) => !i.ignore && i.db_ref !== "900511").length}
</Descriptions.Item>
<Descriptions.Item label="Loss Date">
{job.loss_date
? moment(job.loss_date).format(DateFormat)
: "No Loss Date"}
{job.loss_date ? moment(job.loss_date).format(DateFormat) : "No Loss Date"}
</Descriptions.Item>
</Descriptions>
</PageHeader>

View File

@@ -148,7 +148,7 @@ export default function JobLinesTableMolecule({ loading, job }) {
<Input.Search
placeholder="Search"
onSearch={(val) => {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "JOB_LINES_SEARCH",
query: val,
});

View File

@@ -8,7 +8,7 @@ export default function JobsSearchFieldsMolecule({ callSearchQuery }) {
const [form] = Form.useForm();
const handleFinish = (values) => {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "SEARCH_JOBS",
query: values.search,
datesIncluded: !!values.dateRange,

View File

@@ -18,11 +18,11 @@ export function ReleaseNotes({ releaseNotes, setReleaseNotes }) {
console.log("ReleaseNotes -> releaseNotes", releaseNotes);
useEffect(() => {
ipcRenderer.send(ipcTypes.default.app.toMain.getReleaseNotes);
ipcRenderer.send(ipcTypes.app.toMain.getReleaseNotes);
}, []);
const handleOk = () => {
ipcRenderer.send(ipcTypes.default.store.set, { showChangeLog: false });
ipcRenderer.send(ipcTypes.store.set, { showChangeLog: false });
setReleaseNotes(null);
};

View File

@@ -175,7 +175,7 @@ export function ReportingJobsListMolecule({
<Input.Search
placeholder="Search"
onSearch={(val) => {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "REPORTS_LIST_SEARCH",
query: val,
});

View File

@@ -70,7 +70,7 @@ export function ScanEstimateListMolecule({ scanLoading, estimates }) {
onClick={() => {
message.info("Attempting to import job...");
ipcRenderer.send(
ipcTypes.default.fileScan.toMain.importJob,
ipcTypes.fileScan.toMain.importJob,
record.filepath
);
}}

View File

@@ -17,10 +17,10 @@ const mapDispatchToProps = (dispatch) => ({
export function WatcherPollingMolecule({ appSettings }) {
const handlePollingToggle = (val) => {
ipcRenderer.send(ipcTypes.default.store.set, { "polling.enabled": val });
ipcRenderer.send(ipcTypes.store.set, { "polling.enabled": val });
};
const handleIntervalChange = (val) => {
ipcRenderer.send(ipcTypes.default.store.set, {
ipcRenderer.send(ipcTypes.store.set, {
"polling.pollingInterval": val,
});
};

View File

@@ -5,7 +5,7 @@ const { ipcRenderer } = window;
export default function WatcherStartMolecule() {
const handleClick = () => {
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.start);
ipcRenderer.send(ipcTypes.fileWatcher.toMain.start);
};
return (

View File

@@ -5,7 +5,7 @@ const { ipcRenderer } = window;
export default function WatcherStopMolecule() {
const handleClick = () => {
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.stop);
ipcRenderer.send(ipcTypes.fileWatcher.toMain.stop);
};
return (

View File

@@ -18,7 +18,7 @@ const mapDispatchToProps = (dispatch) => ({
export function FilePathsList({ watchedPaths }) {
//On Rdner, send request to get file paths to main.
useEffect(() => {
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.filepathsGet);
ipcRenderer.send(ipcTypes.fileWatcher.toMain.filepathsGet);
}, []);
return (

View File

@@ -23,7 +23,7 @@ export default function JobsTableOrganism() {
const handleInfiniteOnLoad = async (page) => {
if (fetchMore) {
// ipcRenderer.send(ipcTypes.default.app.toMain.track, {
// ipcRenderer.send(ipcTypes.app.toMain.track, {
// event: "FETCH_MORE_JOBS",
// });
await fetchMore({

View File

@@ -29,7 +29,7 @@ export function ShopSettingsOrganism({ setBodyshop }) {
const handleFinish = async (values) => {
setSaveLoading(true);
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "UPDATE_SHOP_DETAILS",
});

View File

@@ -55,7 +55,7 @@ export default function SiderMenuOrganism() {
label: (
<span
onClick={() => {
ipcRenderer.send(ipcTypes.default.quit);
ipcRenderer.send(ipcTypes.quit);
}}
>
Quit

View File

@@ -46,7 +46,7 @@ export function UpdateManagerOrganism({ updateAvailable, updateProgress }) {
type="primary"
style={{ margin: "0rem .5rem" }}
onClick={() =>
ipcRenderer.send(ipcTypes.default.app.toMain.downloadUpdates)
ipcRenderer.send(ipcTypes.app.toMain.downloadUpdates)
}
>
Download
@@ -75,7 +75,7 @@ export function UpdateManagerOrganism({ updateAvailable, updateProgress }) {
type="primary"
style={{ margin: "0rem .5rem" }}
onClick={() =>
ipcRenderer.send(ipcTypes.default.app.toMain.installUpdates)
ipcRenderer.send(ipcTypes.app.toMain.installUpdates)
}
>
Install

View File

@@ -11,7 +11,7 @@ const { ipcRenderer } = window;
export default function SettingsPage() {
useEffect(() => {
ipcRenderer.send(ipcTypes.default.store.getAll);
ipcRenderer.send(ipcTypes.store.getAll);
}, []);
return (

View File

@@ -1,15 +1,15 @@
import "firebase/analytics";
import "firebase/auth";
import "firebase/database";
import "firebase/messaging";
import firebase from "firebase/app";
import { getAnalytics } from "firebase/analytics";
import { initializeApp } from "firebase/app";
import { getAuth, updateProfile } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
const config = JSON.parse(process.env.REACT_APP_FIREBASE_CONFIG);
firebase.initializeApp(config);
const config = JSON.parse(import.meta.env.VITE_APP_FIREBASE_CONFIG);
initializeApp(config);
export const auth = getAuth();
export const firestore = getFirestore();
export const analytics = getAnalytics();
export const auth = firebase.auth();
export const analytics = firebase.analytics();
export default firebase;
export const getCurrentUser = () => {
return new Promise((resolve, reject) => {
@@ -23,10 +23,10 @@ export const getCurrentUser = () => {
export const updateCurrentUser = (userDetails) => {
return new Promise((resolve, reject) => {
const unsubscribe = auth.onAuthStateChanged((userAuth) => {
userAuth.updateProfile(userDetails).then((r) => {
updateProfile(userAuth, userDetails).then((r) => {
unsubscribe();
resolve(userAuth);
});
}, reject);
});
};
};

View File

@@ -24,11 +24,11 @@ const errorLink = onError(
);
const httpLink = new HttpLink({
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT,
uri: import.meta.env.VITE_APP_GRAPHQL_ENDPOINT,
});
const wsLink = new WebSocketLink({
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT_WS,
uri: import.meta.env.VITE_APP_GRAPHQL_ENDPOINT_WS,
options: {
lazy: true,
reconnect: true,

View File

@@ -1,4 +1,3 @@
import "antd/dist/antd.min.css";
//import LogRocket from "logrocket";
import React from "react";
import { createRoot } from "react-dom/client";
@@ -8,6 +7,7 @@ import { PersistGate } from "redux-persist/integration/react";
import App from "./App/App";
import "./index.css";
import { persistor, store } from "./redux/store";
import ReactDOM from "react-dom/client";
import * as Sentry from "@sentry/electron";
@@ -20,14 +20,12 @@ Sentry.init({
ignoreErrors: [
"SimpleURLLoaderWrapper",
"Cannot read properties of null (reading 'webContents')",
"EBUSY: resource busy or locked",
],
"EBUSY: resource busy or locked"
]
});
//if (process.env.NODE_ENV === "production") LogRocket.init("imex/rps");
const container = document.getElementById("root");
const root = createRoot(container); // createRoot(container!) if you use TypeScript
root.render(
ReactDOM.createRoot(document.getElementById("root")).render(
<Provider store={store}>
<MemoryRouter>
<PersistGate persistor={persistor}>
@@ -36,4 +34,4 @@ root.render(
</MemoryRouter>
</Provider>
);
console.log("Connecting to endpoint: ", process.env.REACT_APP_GRAPHQL_ENDPOINT);
console.log("Connecting to endpoint: ", process.env.VITE_APP_GRAPHQL_ENDPOINT);

View File

@@ -1,8 +1,8 @@
exports.default = {
export default {
webcontent: "webcontent-send",
quit: "quit-app",
test: {
start: "test-start",
start: "test-start"
},
app: {
toMain: {
@@ -20,32 +20,32 @@ exports.default = {
debug: "app_logDebug",
warn: "app_logWarn",
error: "app_logError",
silly: "app_logSilly",
},
silly: "app_logSilly"
}
},
toRenderer: {
updateAvailable: "app_updateAvailable",
downloadProgress: "app_downloadProgress",
signOut: "app_signOut",
setReleaseNotes: "app_setReleaseNotes",
appVersion: "app_appVersion",
},
appVersion: "app_appVersion"
}
},
store: {
get: "store__get",
getAll: "store_getAll",
set: "store_set",
response: "store_response",
response: "store_response"
},
fileScan: {
toMain: {
scanFilePaths: "fileScan__scanFilePaths",
importJob: "fileScan__importJob",
deleteAllEms: "filescan_deleteAllEms",
deleteAllEms: "filescan_deleteAllEms"
},
toRenderer: {
scanFilePathsResponse: "fileScan__scanFilePathsResponse",
},
scanFilePathsResponse: "fileScan__scanFilePathsResponse"
}
},
fileWatcher: {
toMain: {
@@ -54,7 +54,7 @@ exports.default = {
stop: "filewatcher__stop",
addPath: "filewatcher__addPath",
removePath: "filewatcher__removePath",
setPolling: "filewatcher__setPolling",
setPolling: "filewatcher__setPolling"
},
toRenderer: {
filepathsList: "filewatcher__filepathslist",
@@ -62,15 +62,15 @@ exports.default = {
startFailure: "filewatcher__start-failure",
stopSuccess: "filewatcher__stop-success",
error: "filewatcher__error",
getPolling: "filewatcher__getPolling",
},
getPolling: "filewatcher__getPolling"
}
},
estimate: {
toRenderer: {
estimateDecodeStart: "estimatedecode__start",
estimateDecodeSuccess: "estimatedecode__success",
estimateDecodeFailure: "estimatedecode__failure",
getCloseDate: "getclosedate",
},
},
getCloseDate: "getclosedate"
}
}
};

View File

@@ -31,7 +31,7 @@ export function CalculateVehicleAge(job) {
if (closeDate.isSameOrAfter(moment("2023-04-01"))) {
//Post April 2023 rules where the age is calculated based on loss date.
ipcRenderer.send(
ipcTypes.default.app.toMain.log.debug,
ipcTypes.app.toMain.log.debug,
"Using post 0423 ruleset to calculate vehicle age for job.",
job
);
@@ -39,7 +39,7 @@ export function CalculateVehicleAge(job) {
} else {
//Pre-April 2023 rules where the age was calculated based on model year, not loss date.
ipcRenderer.send(
ipcTypes.default.app.toMain.log.debug,
ipcTypes.app.toMain.log.debug,
"Using pre 0423 ruleset to calculate vehicle age for job.",
job
);
@@ -62,7 +62,7 @@ export async function UpsertEstimate(job) {
//logger.info("Beginning Upserting job from Renderer.");
console.log("WINDOW IPCS", ipcRenderer);
ipcRenderer.send(
ipcTypes.default.app.toMain.log.info,
ipcTypes.app.toMain.log.info,
"Beginning Upserting job from Renderer."
);
const existingJobs = await client.query({

View File

@@ -19,7 +19,7 @@ ipcRenderer.on("test-toRenderer", (event, obj) => {
});
ipcRenderer.on(
ipcTypes.default.fileWatcher.toRenderer.filepathsList,
ipcTypes.fileWatcher.toRenderer.filepathsList,
(event, obj) => {
store.dispatch(setWatchedPaths(obj));
}
@@ -27,27 +27,27 @@ ipcRenderer.on(
//Filewatcher Status Section
ipcRenderer.on(
ipcTypes.default.fileWatcher.toRenderer.startSuccess,
ipcTypes.fileWatcher.toRenderer.startSuccess,
(event, obj) => {
store.dispatch(setWatcherStatus("Started"));
}
);
ipcRenderer.on(
ipcTypes.default.fileWatcher.toRenderer.stopSuccess,
ipcTypes.fileWatcher.toRenderer.stopSuccess,
(event, obj) => {
store.dispatch(setWatcherStatus("Stopped"));
}
);
ipcRenderer.on(ipcTypes.default.fileWatcher.toRenderer.error, (event, obj) => {
ipcRenderer.on(ipcTypes.fileWatcher.toRenderer.error, (event, obj) => {
store.dispatch(setWatcherStatus(obj));
});
//Estimate Section
ipcRenderer.on(
ipcTypes.default.estimate.toRenderer.getCloseDate,
ipcTypes.estimate.toRenderer.getCloseDate,
async (event, { filepath, clm_no }) => {
const close_date = await GetR4PDateWithClaim(clm_no);
ipcRenderer.send(ipcTypes.default.app.toMain.importJob, {
ipcRenderer.send(ipcTypes.app.toMain.importJob, {
filepath,
close_date,
});
@@ -55,54 +55,54 @@ ipcRenderer.on(
);
ipcRenderer.on(
ipcTypes.default.estimate.toRenderer.estimateDecodeSuccess,
ipcTypes.estimate.toRenderer.estimateDecodeSuccess,
async (event, obj) => {
await UpsertEstimate(obj);
}
);
ipcRenderer.on(ipcTypes.default.store.response, (event, obj) => {
ipcRenderer.on(ipcTypes.store.response, (event, obj) => {
store.dispatch(setSettings(obj));
});
//FileScan Section
ipcRenderer.on(
ipcTypes.default.fileScan.toRenderer.scanFilePathsResponse,
ipcTypes.fileScan.toRenderer.scanFilePathsResponse,
async (event, listOfEstimates) => {
store.dispatch(setScanEstimateList(listOfEstimates));
}
);
ipcRenderer.on(
ipcTypes.default.app.toRenderer.updateAvailable,
ipcTypes.app.toRenderer.updateAvailable,
async (event, updateInfo) => {
store.dispatch(setUpdateAvailable(updateInfo));
}
);
ipcRenderer.on(
ipcTypes.default.app.toRenderer.downloadProgress,
ipcTypes.app.toRenderer.downloadProgress,
async (event, progress) => {
store.dispatch(setUpdateProgress(progress));
}
);
ipcRenderer.on(
ipcTypes.default.app.toRenderer.signOut,
ipcTypes.app.toRenderer.signOut,
async (event, progress) => {
store.dispatch(signOutStart());
}
);
ipcRenderer.on(
ipcTypes.default.app.toRenderer.setReleaseNotes,
ipcTypes.app.toRenderer.setReleaseNotes,
async (event, releaseNotes) => {
store.dispatch(setReleaseNotes(releaseNotes));
}
);
ipcRenderer.on(
ipcTypes.default.app.toRenderer.appVersion,
ipcTypes.app.toRenderer.appVersion,
async (event, appversion) => {
window.$crisp.push([
"set",

View File

@@ -22,7 +22,7 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
watchedPaths: action.payload,
};
case ApplicationActionTypes.ADD_WATCHED_PATH:
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "ADD_WATCHED_PATH",
});
return {
@@ -30,7 +30,7 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
watchedPaths: [...state.watchedPaths, action.payload],
};
case ApplicationActionTypes.REMOVE_WATCHED_PATH:
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "REMOVE_WATCHED_PATH",
});
return {
@@ -43,7 +43,7 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
watcherStatus: action.payload,
};
case ApplicationActionTypes.SET_WATCHER_ERROR:
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "WATCHER_ERROR",
error: action.payload,
});
@@ -57,7 +57,7 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
selectedJobTargetPc: action.payload,
};
case ApplicationActionTypes.SET_SELECTED_JOB_ID:
// ipcRenderer.send(ipcTypes.default.app.toMain.track, {
// ipcRenderer.send(ipcTypes.app.toMain.track, {
// event: "SET_SELECTED_JOB",
// });
return { ...state, selectedJobId: action.payload };

View File

@@ -59,7 +59,7 @@ export function* onCalculateScoreCard() {
}
export function* handleCalculateScoreCard({ payload: jobs }) {
try {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "CALCULATE_SCORECARD",
});
@@ -169,7 +169,7 @@ export function* handleCalculateScoreCard({ payload: jobs }) {
yield put(setScoreCard(scoreCard));
yield put(setReportingData(jobs));
} catch (error) {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "CALCULATE_SCORE_CARD_ERROR",
error: error,
});

View File

@@ -10,7 +10,7 @@ export function* onScanStart() {
// eslint-disable-next-line require-yield
export function* handleScanStart() {
ipcRenderer.send(ipcTypes.default.fileScan.toMain.scanFilePaths);
ipcRenderer.send(ipcTypes.fileScan.toMain.scanFilePaths);
}
export function* scanSagas() {

View File

@@ -38,7 +38,7 @@ export function* onEmailSignInStart() {
}
export function* signInWithEmail({ payload: { email, password } }) {
try {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "SIGN_IN_ATTEMPT",
email: email,
});
@@ -100,10 +100,10 @@ export function* onSignOutStart() {
export function* signOutStart() {
try {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "SIGN_OUT",
});
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.stop);
ipcRenderer.send(ipcTypes.fileWatcher.toMain.stop);
yield auth.signOut();
yield put(signOutSuccess());
localStorage.removeItem("token");
@@ -132,13 +132,13 @@ export function* onSignInSuccess() {
export function* signInSuccessSaga({ payload }) {
//Query for the Correct Bodyshop
ipcRenderer.send(ipcTypes.default.app.toMain.setUserName, payload.email);
ipcRenderer.send(ipcTypes.app.toMain.setUserName, payload.email);
// LogRocket.identify(payload.email, {
// email: payload.email,
// });
ipcRenderer.send(ipcTypes.default.app.toMain.checkForUpdates);
ipcRenderer.send(ipcTypes.app.toMain.checkForUpdates);
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "SIGN_IN_SUCCESS",
email: payload.email,
});
@@ -146,10 +146,10 @@ export function* signInSuccessSaga({ payload }) {
if (shop.data.bodyshops.length > 0) {
yield put(setBodyshop(shop.data.bodyshops[0]));
ipcRenderer.send(
ipcTypes.default.app.toMain.setAcceptableInsCoNm,
ipcTypes.app.toMain.setAcceptableInsCoNm,
shop.data.bodyshops[0].accepted_ins_co
);
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.start, {
ipcRenderer.send(ipcTypes.fileWatcher.toMain.start, {
startup: true,
});
yield put(checkForNotification());
@@ -166,7 +166,7 @@ export function* signInSuccessSaga({ payload }) {
]);
window.$crisp.push(["set", "user:email", [payload.email]]);
window.$crisp.push(["set", "session:segments", [["rps-user"]]]);
ipcRenderer.send(ipcTypes.default.app.toMain.getAppVersion);
ipcRenderer.send(ipcTypes.app.toMain.getAppVersion);
Sentry.setUser({
email: payload.email,
@@ -216,7 +216,7 @@ export function* onSendPasswordResetStart() {
}
export function* sendPasswordResetEmail({ payload }) {
try {
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "RESET_PASSWORD",
email: payload,
});

28
vite.config.js Normal file
View File

@@ -0,0 +1,28 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import { ViteEjsPlugin } from "vite-plugin-ejs";
import eslint from "vite-plugin-eslint";
export default defineConfig({
base: "/",
plugins: [
ViteEjsPlugin((viteConfig) => {
// viteConfig is the current Vite resolved config
return { env: viteConfig.env };
}),
react(),
//eslint()
// CompressionPlugin(), //Cloudfront already compresses assets, so not needed.
],
define: {
APP_VERSION: JSON.stringify(process.env.npm_package_version)
},
server: {
host: true,
port: 3000,
open: true
},
build: {
outDir: "build"
}
});