Minor cleanup.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
VITE_FIREBASE_CONFIG={"apiKey":"AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU","authDomain":"imex-prod.firebaseapp.com","databaseURL":"https://imex-prod.firebaseio.com","projectId":"imex-prod","storageBucket":"imex-prod.appspot.com","messagingSenderId":"253497221485","appId":"1:253497221485:web:3c81c483b94db84b227a64","measurementId":"G-NTWBKG2L0M"}
|
||||
VITE_GRAPHQL_ENDPOINT=https://db.imex.online/v1/graphql
|
||||
VITE_FIREBASE_CONFIG_TEST={ "apiKey":"AIzaSyBw7_GTy7GtQyfkIRPVrWHEGKfcqeyXw0c", "authDomain":"imex-test.firebaseapp.com", "projectId":"imex-test", "storageBucket":"imex-test.appspot.com", "messagingSenderId":"991923618608", "appId":"1:991923618608:web:633437569cdad78299bef5", "measurementId":"G-TW0XLZEH18"}
|
||||
VITE_GRAPHQL_ENDPOINT_TEST=https://db.test.bodyshop.app/v1/graphql
|
||||
VITE_GRAPHQL_ENDPOINT_TEST=https://db.test.bodyshop.app/v1/graphql
|
||||
VITE_COMPANY=IMEX
|
||||
@@ -1,4 +1,5 @@
|
||||
VITE_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"}
|
||||
VITE_GRAPHQL_ENDPOINT=https://db.dev.imex.online/v1/graphql
|
||||
VITE_FIREBASE_CONFIG_TEST={ "apiKey":"AIzaSyBw7_GTy7GtQyfkIRPVrWHEGKfcqeyXw0c", "authDomain":"imex-test.firebaseapp.com", "projectId":"imex-test", "storageBucket":"imex-test.appspot.com", "messagingSenderId":"991923618608", "appId":"1:991923618608:web:633437569cdad78299bef5", "measurementId":"G-TW0XLZEH18"}
|
||||
VITE_GRAPHQL_ENDPOINT_TEST=https://db.test.bodyshop.app/v1/graphql
|
||||
VITE_GRAPHQL_ENDPOINT_TEST=https://db.test.bodyshop.app/v1/graphql
|
||||
VITE_COMPANY=IMEX
|
||||
@@ -1,4 +1,5 @@
|
||||
VITE_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"}
|
||||
VITE_GRAPHQL_ENDPOINT=https://db.romeonline.io/v1/graphql
|
||||
VITE_FIREBASE_CONFIG_TEST={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"}
|
||||
VITE_GRAPHQL_ENDPOINT_TEST=https://db.test.romeonline.io/v1/graphql
|
||||
VITE_GRAPHQL_ENDPOINT_TEST=https://db.test.romeonline.io/v1/graphql
|
||||
VITE_COMPANY=ROME
|
||||
|
Before Width: | Height: | Size: 320 KiB After Width: | Height: | Size: 320 KiB |
@@ -13,8 +13,8 @@
|
||||
"typecheck": "npm run typecheck:node && npm run typecheck:web",
|
||||
"start": "electron-vite preview",
|
||||
"dev": "electron-vite dev",
|
||||
"build:mac:imex": "electron-vite build --mode imex && electron-builder --config electron-builder.imex.yml",
|
||||
"build:mac:rome": "electron-vite build --mode rome && electron-builder --config electron-builder.rome.yml",
|
||||
"build:imex": "electron-vite build --mode imex && electron-builder --config electron-builder.imex.yml",
|
||||
"build:rome": "electron-vite build --mode rome && electron-builder --config electron-builder.rome.yml",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"build:unpack": "npm run build && electron-builder --dir",
|
||||
"build:win": "npm run build && electron-builder --win",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 320 KiB |
@@ -8,6 +8,7 @@ import {
|
||||
} from "../util/ems-util";
|
||||
import uppercaseObjectKeys from "../util/uppercaseObjectKeys";
|
||||
import { EmsPartsOrder } from "./ems-parts-order-interfaces";
|
||||
import _ from "lodash";
|
||||
|
||||
const EmsPartsOrderGeneratePflFile = async (
|
||||
partsOrder: EmsPartsOrder,
|
||||
@@ -15,7 +16,7 @@ const EmsPartsOrderGeneratePflFile = async (
|
||||
try {
|
||||
let records;
|
||||
|
||||
if (partsOrder.job.cieca_pfl) {
|
||||
if (partsOrder.job.cieca_pfl && !_.isEmpty(partsOrder.job.cieca_pfl)) {
|
||||
Object.keys(partsOrder.job.cieca_pfl).map((key) => {
|
||||
const record: DecodedPflLine = partsOrder.job.cieca_pfl[key];
|
||||
return uppercaseObjectKeys(record);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DBFFile } from "dbffile";
|
||||
import _ from "lodash";
|
||||
import errorTypeCheck from "../../util/errorTypeCheck";
|
||||
import { DecodedPfmLine } from "../decoder/decode-pfm.interface";
|
||||
import { pfmFieldLineDescriptors } from "../util/ems-interface/fielddescriptors/pfm-field-descriptors";
|
||||
@@ -14,7 +15,7 @@ const EmsPartsOrderGeneratePfmFile = async (
|
||||
): Promise<boolean> => {
|
||||
try {
|
||||
let records;
|
||||
if (partsOrder.job.materials) {
|
||||
if (partsOrder.job.materials && !_.isEmpty(partsOrder.job.materials)) {
|
||||
records = Object.keys(partsOrder.job.materials).map((key) => {
|
||||
const record: DecodedPfmLine = partsOrder.job.materials[key];
|
||||
return uppercaseObjectKeys(record);
|
||||
|
||||
@@ -13,7 +13,6 @@ import log from "electron-log/main";
|
||||
import { autoUpdater } from "electron-updater";
|
||||
import path, { join } from "path";
|
||||
import appIcon from "../../resources/diamond.png?asset";
|
||||
import icon from "../../resources/icon.png?asset";
|
||||
import {
|
||||
default as ErrorTypeCheck,
|
||||
default as errorTypeCheck,
|
||||
@@ -54,7 +53,7 @@ function createWindow(): void {
|
||||
minWidth: 600,
|
||||
minHeight: 400,
|
||||
//autoHideMenuBar: true,
|
||||
...(process.platform === "linux" ? { icon } : {}),
|
||||
...(process.platform === "linux" ? { icon: appIcon } : {}),
|
||||
title: "Shop Partner",
|
||||
webPreferences: {
|
||||
preload: join(__dirname, "../preload/index.js"),
|
||||
|
||||
@@ -64,7 +64,11 @@ const ipcMainHandleAuthStateChanged = async (
|
||||
};
|
||||
|
||||
const ipMainHandleResetPassword = async (): Promise<void> => {
|
||||
shell.openExternal("https://imex.online/resetpassword");
|
||||
shell.openExternal(
|
||||
import.meta.env.VITE_COMPANY === "IMEX"
|
||||
? "https://imex.online/resetpassword"
|
||||
: "https://romeonline.io/resetpassword",
|
||||
);
|
||||
};
|
||||
|
||||
export { ipcMainHandleAuthStateChanged, ipMainHandleResetPassword };
|
||||
|
||||
@@ -32,7 +32,6 @@ const store = new Store({
|
||||
});
|
||||
|
||||
// store.onDidAnyChange((newValue, oldValue) => {
|
||||
// console.log("Settings changed", newValue, oldValue);
|
||||
// const mainWindow = BrowserWindow.getAllWindows()[0];
|
||||
// mainWindow?.webContents.send(ipcTypes.toRenderer.store.didChange, newValue);
|
||||
// });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import "@ant-design/v5-patch-for-react-19";
|
||||
import { Layout, Skeleton } from "antd";
|
||||
import { Layout, Skeleton, ConfigProvider, Badge } from "antd";
|
||||
import { User } from "firebase/auth";
|
||||
import { useEffect, useState } from "react";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
@@ -40,35 +40,49 @@ const App: React.FC = () => {
|
||||
// Clean up the listener when component unmounts
|
||||
return (): void => unsubscribe();
|
||||
}, []);
|
||||
const isTest = window.api.isTest();
|
||||
|
||||
return (
|
||||
<Provider store={reduxStore}>
|
||||
<HashRouter>
|
||||
<ErrorBoundary FallbackComponent={ErrorBoundaryFallback}>
|
||||
<NotificationProvider>
|
||||
<Skeleton loading={user === false} active>
|
||||
<Layout style={{ minHeight: "100vh" }}>
|
||||
{!user ? (
|
||||
<SignInForm />
|
||||
) : (
|
||||
<>
|
||||
<Layout.Header>
|
||||
<NavigationHeader />
|
||||
</Layout.Header>
|
||||
<Layout.Content style={{ padding: "0 24px" }}>
|
||||
<UpdateAvailable />
|
||||
<Routes>
|
||||
<Route path="/" element={<Settings />} />
|
||||
</Routes>
|
||||
</Layout.Content>
|
||||
</>
|
||||
)}
|
||||
</Layout>
|
||||
</Skeleton>
|
||||
</NotificationProvider>
|
||||
</ErrorBoundary>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
<ConfigProvider
|
||||
theme={{
|
||||
token: {},
|
||||
components: {
|
||||
Card: {
|
||||
borderRadius: 8,
|
||||
colorBgBase: "#ffaacc",
|
||||
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Provider store={reduxStore}>
|
||||
<HashRouter>
|
||||
<ErrorBoundary FallbackComponent={ErrorBoundaryFallback}>
|
||||
<NotificationProvider>
|
||||
<Skeleton loading={user === false} active>
|
||||
<Layout style={{ minHeight: "100vh" }}>
|
||||
{!user ? (
|
||||
<SignInForm />
|
||||
) : (
|
||||
<Badge.Ribbon
|
||||
text={isTest && "Connected to Test"}
|
||||
color={isTest && "red"}
|
||||
>
|
||||
<Layout.Content style={{ padding: "0 24px" }}>
|
||||
<UpdateAvailable />
|
||||
<Routes>
|
||||
<Route path="/" element={<Settings />} />
|
||||
</Routes>
|
||||
</Layout.Content>
|
||||
</Badge.Ribbon>
|
||||
)}
|
||||
</Layout>
|
||||
</Skeleton>
|
||||
</NotificationProvider>
|
||||
</ErrorBoundary>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
</ConfigProvider>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import { is } from "@electron-toolkit/utils";
|
||||
import { auth } from "@renderer/util/firebase";
|
||||
import { Badge, Layout, Menu } from "antd";
|
||||
import { MenuItemType } from "antd/es/menu/interface";
|
||||
import { signOut } from "firebase/auth";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { NavLink } from "react-router";
|
||||
|
||||
const NavigationHeader: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
//const isWatcherStarted = useAppSelector(selectWatcherStatus);
|
||||
const menuItems: MenuItemType[] = [
|
||||
{ label: <NavLink to="/">{t("navigation.home")}</NavLink>, key: "home" },
|
||||
{
|
||||
label: t("navigation.signout"),
|
||||
key: "watchlist",
|
||||
onClick: (): void => {
|
||||
signOut(auth);
|
||||
},
|
||||
},
|
||||
];
|
||||
const isTest = window.api.isTest();
|
||||
return (
|
||||
<Badge.Ribbon text={isTest && "TEST ENV"} color={isTest && "red"}>
|
||||
<Layout.Header style={{ display: "flex", alignItems: "center" }}>
|
||||
<Menu
|
||||
theme="dark"
|
||||
mode="horizontal"
|
||||
defaultSelectedKeys={["2"]}
|
||||
items={menuItems}
|
||||
style={{ flex: 1, minWidth: 0 }}
|
||||
/>
|
||||
</Layout.Header>
|
||||
</Badge.Ribbon>
|
||||
);
|
||||
};
|
||||
|
||||
export default NavigationHeader;
|
||||
@@ -19,6 +19,11 @@ import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ipcTypes from "../../../../util/ipcTypes.json";
|
||||
|
||||
const colSpans = {
|
||||
md: 12,
|
||||
sm: 24,
|
||||
};
|
||||
|
||||
const SettingsWatcher: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
const isWatcherStarted = useAppSelector(selectWatcherStatus);
|
||||
@@ -96,8 +101,8 @@ const SettingsWatcher: React.FC = () => {
|
||||
color={isWatcherStarted ? "green" : "red"}
|
||||
>
|
||||
<Card title={t("settings.labels.watcherstatus")}>
|
||||
<Row>
|
||||
<Col md={12} xs={24}>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col {...colSpans}>
|
||||
{isWatcherStarted ? (
|
||||
<Button onClick={handleStop}>
|
||||
{t("settings.actions.stopwatcher")}
|
||||
@@ -108,7 +113,7 @@ const SettingsWatcher: React.FC = () => {
|
||||
</Button>
|
||||
)}
|
||||
</Col>
|
||||
<Col md={12} xs={24}>
|
||||
<Col {...colSpans}>
|
||||
<Space direction="vertical" wrap>
|
||||
<Switch
|
||||
checked={!pollingState.enabled}
|
||||
|
||||
@@ -5,23 +5,26 @@ import Welcome from "../Welcome/Welcome";
|
||||
import SettingsPpcFilepath from "./Settings.PpcFilePath";
|
||||
import SettingsEmsOutFilePath from "./Settings.EmsOutFilePath";
|
||||
|
||||
const colSpans = {
|
||||
md: 12,
|
||||
sm: 24,
|
||||
};
|
||||
const Settings: React.FC = () => {
|
||||
console.log("is test?", window.api.isTest());
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
<Welcome />
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col {...colSpans}>
|
||||
<SettingsWatchedPaths />
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col {...colSpans}>
|
||||
<SettingsWatcher />
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col {...colSpans}>
|
||||
<SettingsPpcFilepath />
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col {...colSpans}>
|
||||
<SettingsEmsOutFilePath />
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { auth } from "@renderer/util/firebase";
|
||||
import type { FormProps } from "antd";
|
||||
import { Alert, Button, Form, Input, Space } from "antd";
|
||||
import { Alert, Button, Form, Input, Space, Card, Typography } from "antd";
|
||||
import log from "electron-log/renderer";
|
||||
import { signInWithEmailAndPassword } from "firebase/auth";
|
||||
import { useState } from "react";
|
||||
@@ -8,6 +8,8 @@ import { useTranslation } from "react-i18next";
|
||||
import errorTypeCheck from "../../../../util/errorTypeCheck";
|
||||
import ipcTypes from "../../../../util/ipcTypes.json";
|
||||
|
||||
const { Title } = Typography;
|
||||
|
||||
type FieldType = {
|
||||
username: string;
|
||||
password: string;
|
||||
@@ -39,36 +41,90 @@ const SignInForm: React.FC = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<Form
|
||||
name="desktop-sign-in"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
style={{ maxWidth: 600 }}
|
||||
initialValues={{ remember: true }}
|
||||
onFinish={onFinish}
|
||||
onFinishFailed={onFinishFailed}
|
||||
autoComplete="off"
|
||||
<Card
|
||||
style={{
|
||||
maxWidth: 600,
|
||||
margin: "auto auto",
|
||||
borderRadius: 8,
|
||||
paddingLeft: 48,
|
||||
paddingRight: 48,
|
||||
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
||||
}}
|
||||
>
|
||||
<Form.Item<FieldType>
|
||||
label="Username"
|
||||
name="username"
|
||||
rules={[{ required: true }]}
|
||||
<div style={{ textAlign: "center", marginBottom: 24 }}>
|
||||
<Title level={2}>
|
||||
{import.meta.env.VITE_COMPANY === "IMEX"
|
||||
? t("title.imex")
|
||||
: t("title.rome")}
|
||||
</Title>
|
||||
</div>
|
||||
|
||||
<Form
|
||||
name="desktop-sign-in"
|
||||
layout="vertical"
|
||||
onFinish={onFinish}
|
||||
onFinishFailed={onFinishFailed}
|
||||
autoComplete="off"
|
||||
requiredMark={false}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item<FieldType>
|
||||
label="Password"
|
||||
name="password"
|
||||
rules={[{ required: true }]}
|
||||
>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item label={null}>
|
||||
<Space>
|
||||
<Button type="primary" loading={loading} htmlType="submit">
|
||||
{error && (
|
||||
<Form.Item>
|
||||
<Alert
|
||||
message={error}
|
||||
type="error"
|
||||
showIcon
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
<Form.Item<FieldType>
|
||||
label="Username"
|
||||
name="username"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t(
|
||||
"auth.login.usernameRequired",
|
||||
"Please enter your username",
|
||||
),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input size="large" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item<FieldType>
|
||||
label="Password"
|
||||
name="password"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t(
|
||||
"auth.login.passwordRequired",
|
||||
"Please enter your password",
|
||||
),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input.Password size="large" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
loading={loading}
|
||||
htmlType="submit"
|
||||
size="large"
|
||||
block
|
||||
>
|
||||
{t("auth.login.login")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item style={{ marginBottom: 0, textAlign: "center" }}>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={(): void => {
|
||||
window.electron.ipcRenderer.send(
|
||||
ipcTypes.toMain.user.resetPassword,
|
||||
@@ -77,15 +133,10 @@ const SignInForm: React.FC = () => {
|
||||
>
|
||||
{t("auth.login.resetpassword")}
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
{error && (
|
||||
<Form.Item label={null}>
|
||||
<Alert message={error} type="error" />
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item label={null}></Form.Item>
|
||||
</Form>
|
||||
</Form>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default SignInForm;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"stopwatcher": "Stop Watcher\n"
|
||||
},
|
||||
"labels": {
|
||||
"emsOutFilePath": "EMS Out File Path (Parts Order, etc.)",
|
||||
"pollinginterval": "Polling Interval (ms)",
|
||||
"ppcfilepath": "Parts Price Change File Path",
|
||||
"started": "Started",
|
||||
@@ -36,6 +37,10 @@
|
||||
"watcherstatus": "Watcher Status"
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"imex": "ImEX Online",
|
||||
"rome": "Rome Online"
|
||||
},
|
||||
"updates": {
|
||||
"apply": "Apply Update",
|
||||
"available": "An update is available.",
|
||||
|
||||
@@ -237,6 +237,19 @@
|
||||
<folder_node>
|
||||
<name>labels</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>emsOutFilePath</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>pollinginterval</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -345,6 +358,37 @@
|
||||
</folder_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>title</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>imex</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>rome</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>updates</name>
|
||||
<children>
|
||||
|
||||
Reference in New Issue
Block a user