chore(react/settings): solve type errors

This commit is contained in:
Elian Doran 2025-08-19 21:41:05 +03:00
parent 1f479b20be
commit cbc9fb7d08
No known key found for this signature in database
6 changed files with 12 additions and 9 deletions

View File

@ -94,7 +94,8 @@ function AvailableActionsList() {
<td>{ actionGroup.title }:</td>
{actionGroup.actions.map(({ actionName, actionTitle }) =>
<Button
small text={actionTitle}
size="small"
text={actionTitle}
onClick={() => bulk_action.addAction("_bulkAction", actionName)}
/>
)}

View File

@ -57,7 +57,8 @@ function RecentChangesDialogComponent() {
header={
<Button
text={t("recent_changes.erase_notes_button")}
small style={{ padding: "0 10px" }}
size="small"
style={{ padding: "0 10px" }}
onClick={() => {
server.post("notes/erase-deleted-notes-now").then(() => {
setNeedsRefresh(true);

View File

@ -55,7 +55,7 @@ function RevisionsDialogComponent() {
helpPageId="vZWERwf8U3nx"
bodyStyle={{ display: "flex", height: "80vh" }}
header={
(!!revisions?.length && <Button text={t("revisions.delete_all_revisions")} small style={{ padding: "0 10px" }}
(!!revisions?.length && <Button text={t("revisions.delete_all_revisions")} size="small" style={{ padding: "0 10px" }}
onClick={async () => {
const text = t("revisions.confirm_delete_all");

View File

@ -1,6 +1,6 @@
import type { InputHTMLAttributes, RefObject } from "preact/compat";
interface FormTextBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "value"> {
interface FormTextBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "onBlur" | "value"> {
id?: string;
currentValue?: string;
onChange?(newValue: string, validity: ValidityState): void;

View File

@ -27,7 +27,7 @@ export default function ShortcutSettings() {
return;
}
let updatedShortcuts: KeyboardShortcut[] = null;
let updatedShortcuts: (KeyboardShortcut[] | null) = null;
for (const optionName of optionNames) {
if (!(optionName.startsWith("keyboardShortcuts"))) {
@ -58,12 +58,13 @@ export default function ShortcutSettings() {
const optionsToSet: Record<string, string> = {};
for (const keyboardShortcut of keyboardShortcuts) {
if (!("effectiveShortcuts" in keyboardShortcut)) {
if (!("effectiveShortcuts" in keyboardShortcut) || !keyboardShortcut.effectiveShortcuts) {
continue;
}
if (!arrayEqual(keyboardShortcut.effectiveShortcuts, keyboardShortcut.defaultShortcuts)) {
optionsToSet[getOptionName(keyboardShortcut.actionName)] = JSON.stringify(keyboardShortcut.defaultShortcuts);
const defaultShortcuts = keyboardShortcut.defaultShortcuts ?? [];
if (!arrayEqual(keyboardShortcut.effectiveShortcuts, defaultShortcuts)) {
optionsToSet[getOptionName(keyboardShortcut.actionName)] = JSON.stringify(defaultShortcuts);
}
}
options.saveMany(optionsToSet);

View File

@ -83,7 +83,7 @@ export function SyncTest() {
onClick={async () => {
const result = await server.post<SyncTestResponse>("sync/test");
if (result.success) {
if (result.success && result.message) {
toast.showMessage(result.message);
} else {
toast.showError(t("sync_2.handshake_failed", { message: result.message }));