Minor bug fixes and CI change.

This commit is contained in:
Patrick Fic
2025-04-01 10:16:24 -07:00
parent ab3de9a382
commit 88dd8adfa5
12 changed files with 150 additions and 38 deletions

View File

@@ -12,7 +12,7 @@ const ErrorBoundaryFallback: React.FC<FallbackProps> = ({
return (
<Result
status={"500"}
title={t("app.errors.errorboundary")}
title={t("errors.errorboundary")}
subTitle={error?.message}
extra={[
<Button key="try-again" onClick={resetErrorBoundary}>

View File

@@ -73,7 +73,7 @@ const SettingsWatcher: React.FC = () => {
return (
<Card title={t("settings.labels.watcherstatus")}>
<Space>
<Space wrap>
{isWatcherStarted ? (
<Button onClick={handleStop}>
{t("settings.actions.stopwatcher")}
@@ -100,7 +100,7 @@ const SettingsWatcher: React.FC = () => {
checkedChildren={t("settings.labels.watchermoderealtime")}
unCheckedChildren={t("settings.labels.watchermodepolling")}
/>
<Space size="small">
<Space size="small" wrap>
<span>{t("settings.labels.pollinginterval")}</span>
<InputNumber
title={t("settings.labels.pollinginterval")}

View File

@@ -1,11 +1,12 @@
import { auth } from "@renderer/util/firebase";
import type { FormProps } from "antd";
import { Alert, Button, Form, Input } from "antd";
import { Alert, Button, Form, Input, Space } from "antd";
import log from "electron-log/renderer";
import { signInWithEmailAndPassword } from "firebase/auth";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import errorTypeCheck from "../../../../util/errorTypeCheck";
import ipcTypes from "../../../../util/ipcTypes.json";
type FieldType = {
username: string;
@@ -15,15 +16,19 @@ type FieldType = {
const SignInForm: React.FC = () => {
const [error, setError] = useState<string | null>(null);
const [loading, setLoading] = useState<boolean>(false);
const { t } = useTranslation();
const onFinish: FormProps<FieldType>["onFinish"] = async (values) => {
const { username, password } = values;
setLoading(true);
try {
const result = await signInWithEmailAndPassword(auth, username, password);
log.debug("Login result", result);
} catch (error) {
log.error("Login error", errorTypeCheck(error));
setError(t("auth.login.error"));
} finally {
setLoading(false);
}
};
@@ -59,18 +64,27 @@ const SignInForm: React.FC = () => {
<Input.Password />
</Form.Item>
<Form.Item label={null}>
<Button type="primary" htmlType="submit">
{t("auth.login.login")}
</Button>
<Space>
<Button type="primary" loading={loading} htmlType="submit">
{t("auth.login.login")}
</Button>
<Button
onClick={(): void => {
window.electron.ipcRenderer.send(
ipcTypes.toMain.user.resetPassword,
);
}}
>
{t("auth.login.resetpassword")}
</Button>
</Space>
</Form.Item>
{error && (
<Form.Item label={null}>
<Alert message={error} type="error" />
</Form.Item>
)}
<Form.Item label={null}>
<Button>{t("auth.login.resetpassword")}</Button>
</Form.Item>
<Form.Item label={null}></Form.Item>
</Form>
);
};

View File

@@ -12,6 +12,8 @@ import {
import store from "@renderer/redux/redux-store";
import ipcTypes from "../../../util/ipcTypes.json";
import { auth } from "./firebase";
import { notification } from "antd";
import i18n from "./i18n";
const ipcRenderer = window.electron.ipcRenderer;
const dispatch = store.dispatch;
@@ -74,3 +76,13 @@ ipcRenderer.on(
);
},
);
ipcRenderer.on(
ipcTypes.toRenderer.general.showErrorMessage,
(_event: Electron.IpcRendererEvent, error) => {
notification.error({
message: i18n.t("errors.notificationtitle"),
description: error,
});
},
);