Skip to content

Commit cbc9fb7

Browse files
committed
chore(react/settings): solve type errors
1 parent 1f479b2 commit cbc9fb7

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

apps/client/src/widgets/dialogs/bulk_actions.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ function AvailableActionsList() {
9494
<td>{ actionGroup.title }:</td>
9595
{actionGroup.actions.map(({ actionName, actionTitle }) =>
9696
<Button
97-
small text={actionTitle}
97+
size="small"
98+
text={actionTitle}
9899
onClick={() => bulk_action.addAction("_bulkAction", actionName)}
99100
/>
100101
)}

apps/client/src/widgets/dialogs/recent_changes.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ function RecentChangesDialogComponent() {
5757
header={
5858
<Button
5959
text={t("recent_changes.erase_notes_button")}
60-
small style={{ padding: "0 10px" }}
60+
size="small"
61+
style={{ padding: "0 10px" }}
6162
onClick={() => {
6263
server.post("notes/erase-deleted-notes-now").then(() => {
6364
setNeedsRefresh(true);

apps/client/src/widgets/dialogs/revisions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function RevisionsDialogComponent() {
5555
helpPageId="vZWERwf8U3nx"
5656
bodyStyle={{ display: "flex", height: "80vh" }}
5757
header={
58-
(!!revisions?.length && <Button text={t("revisions.delete_all_revisions")} small style={{ padding: "0 10px" }}
58+
(!!revisions?.length && <Button text={t("revisions.delete_all_revisions")} size="small" style={{ padding: "0 10px" }}
5959
onClick={async () => {
6060
const text = t("revisions.confirm_delete_all");
6161

apps/client/src/widgets/react/FormTextBox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { InputHTMLAttributes, RefObject } from "preact/compat";
22

3-
interface FormTextBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "value"> {
3+
interface FormTextBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "onBlur" | "value"> {
44
id?: string;
55
currentValue?: string;
66
onChange?(newValue: string, validity: ValidityState): void;

apps/client/src/widgets/type_widgets/options/shortcuts.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function ShortcutSettings() {
2727
return;
2828
}
2929

30-
let updatedShortcuts: KeyboardShortcut[] = null;
30+
let updatedShortcuts: (KeyboardShortcut[] | null) = null;
3131

3232
for (const optionName of optionNames) {
3333
if (!(optionName.startsWith("keyboardShortcuts"))) {
@@ -58,12 +58,13 @@ export default function ShortcutSettings() {
5858

5959
const optionsToSet: Record<string, string> = {};
6060
for (const keyboardShortcut of keyboardShortcuts) {
61-
if (!("effectiveShortcuts" in keyboardShortcut)) {
61+
if (!("effectiveShortcuts" in keyboardShortcut) || !keyboardShortcut.effectiveShortcuts) {
6262
continue;
6363
}
6464

65-
if (!arrayEqual(keyboardShortcut.effectiveShortcuts, keyboardShortcut.defaultShortcuts)) {
66-
optionsToSet[getOptionName(keyboardShortcut.actionName)] = JSON.stringify(keyboardShortcut.defaultShortcuts);
65+
const defaultShortcuts = keyboardShortcut.defaultShortcuts ?? [];
66+
if (!arrayEqual(keyboardShortcut.effectiveShortcuts, defaultShortcuts)) {
67+
optionsToSet[getOptionName(keyboardShortcut.actionName)] = JSON.stringify(defaultShortcuts);
6768
}
6869
}
6970
options.saveMany(optionsToSet);

apps/client/src/widgets/type_widgets/options/sync.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function SyncTest() {
8383
onClick={async () => {
8484
const result = await server.post<SyncTestResponse>("sync/test");
8585

86-
if (result.success) {
86+
if (result.success && result.message) {
8787
toast.showMessage(result.message);
8888
} else {
8989
toast.showError(t("sync_2.handshake_failed", { message: result.message }));

0 commit comments

Comments
 (0)