Minor cleanup and add sentry.

This commit is contained in:
Patrick Fic
2025-03-31 13:03:31 -07:00
parent 38cdb1e04c
commit eeaeba2252
12 changed files with 3921 additions and 131 deletions

View File

@@ -15,6 +15,11 @@ import LocalServer from "./http-server/http-server";
import { TestQB } from "./quickbooks-desktop/quickbooks-desktop";
import store from "./store/store";
import fs from "fs";
import Sentry from "@sentry/electron/main";
Sentry.init({
dsn: "https://ba41d22656999a8c1fd63bcb7df98650@o492140.ingest.us.sentry.io/4509074139447296",
});
log.initialize();
const isMac = process.platform === "darwin";

View File

@@ -1,8 +1,10 @@
import { app, ipcMain } from "electron";
import log from "electron-log/main";
import { autoUpdater } from "electron-updater";
import path from "path";
import ipcTypes from "../../util/ipcTypes.json";
import ImportJob from "../decoder/decoder";
import store from "../store/store";
import { StartWatcher, StopWatcher } from "../watcher/watcher";
import {
SettingsWatchedFilePathsAdd,
@@ -12,7 +14,6 @@ import {
SettingsWatcherPollingSet,
} from "./ipcMainHandler.settings";
import { ipcMainHandleAuthStateChanged } from "./ipcMainHandler.user";
import { autoUpdater } from "electron-updater";
// Log all IPC messages and their payloads
const logIpcMessages = (): void => {
@@ -88,6 +89,9 @@ ipcMain.handle(
ipcTypes.toMain.settings.watcher.setpolling,
SettingsWatcherPollingSet,
);
ipcMain.handle(ipcTypes.toMain.user.getActiveShop, () => {
return store.get("app.bodyshop.shopname");
});
//Watcher Handlers
ipcMain.on(ipcTypes.toMain.watcher.start, () => {

View File

@@ -100,13 +100,16 @@ const SettingsWatcher: React.FC = () => {
checkedChildren={t("settings.labels.watchermoderealtime")}
unCheckedChildren={t("settings.labels.watchermodepolling")}
/>
<InputNumber
title={t("settings.labels.pollinginterval")}
disabled={!pollingState.enabled}
min={1000}
value={pollingState.interval}
onChange={handlePollingIntervalChange}
/>
<Space size="small">
<span>{t("settings.labels.pollinginterval")}</span>
<InputNumber
title={t("settings.labels.pollinginterval")}
disabled={!pollingState.enabled}
min={1000}
value={pollingState.interval}
onChange={handlePollingIntervalChange}
/>
</Space>
{watcherError && <Alert message={watcherError} />}
</Space>
</Card>

View File

@@ -1,10 +1,14 @@
import { Col, Row } from "antd";
import SettingsWatchedPaths from "./Settings.WatchedPaths";
import SettingsWatcher from "./Settings.Watcher";
import Welcome from "../Welcome/Welcome";
const Settings: React.FC = () => {
return (
<Row gutter={[32, 32]}>
<Col span={24}>
<Welcome />
</Col>
<Col span={24}>
<SettingsWatchedPaths />
</Col>

View File

@@ -0,0 +1,31 @@
import { auth } from "@renderer/util/firebase";
import { Card, Typography } from "antd";
import { JSX, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import ipcTypes from "../../../../util/ipcTypes.json";
const Welcome = (): JSX.Element => {
const { t } = useTranslation();
const [shopName, setShopName] = useState<string | null>(null);
useEffect(() => {
window.electron.ipcRenderer
.invoke(ipcTypes.toMain.user.getActiveShop)
.then((shopName: string) => {
console.log("Active shop name:", shopName);
setShopName(shopName);
});
}, []);
return (
<>
<Card>
<Typography.Title level={3}>
{t("auth.labels.welcome", { name: auth.currentUser?.displayName })}
</Typography.Title>
<Typography.Paragraph>{shopName || ""}</Typography.Paragraph>
</Card>
</>
);
};
export default Welcome;

View File

@@ -3,6 +3,11 @@ import ReactDOM from "react-dom/client";
import App from "./App";
import "./util/i18n";
import "./util/ipcRendererHandler";
import * as Sentry from "@sentry/electron/renderer";
Sentry.init({
dsn: "https://ba41d22656999a8c1fd63bcb7df98650@o492140.ingest.us.sentry.io/4509074139447296",
});
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>

View File

@@ -26,7 +26,8 @@
}
},
"user": {
"getTokenResponse": "toMain_user_getTokenResponse"
"getTokenResponse": "toMain_user_getTokenResponse",
"getActiveShop": "toMain_user_getActiveShopify"
}
},
"toRenderer": {

View File

@@ -1,6 +1,9 @@
{
"translation": {
"auth": {
"labels": {
"welcome": "Welcome {{name}}"
},
"login": {
"error": "The username and password combination provided is not valid.",
"login": "Log In",
@@ -19,6 +22,7 @@
"stopwatcher": "Stop Watcher\n"
},
"labels": {
"pollinginterval": "Polling Interval (ms)",
"started": "Started",
"stopped": "Stopped",
"watchedpaths": "Watched Paths",