Skip to content

Commit 38ee7bc

Browse files
committed
refactor: introduce UserSettings type and update constants
- Added UserSettings interface in a new types.ts file to define user settings structure. - Introduced DEFAULT_SETTINGS constant in constants.ts for default user settings. - Updated imports in SettingsDialog and canvas files to reference the new constants and types, enhancing code organization and type safety.
1 parent 7b387fc commit 38ee7bc

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/frontend/src/constants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { UserSettings } from "./ui/types";
2+
13
// Default app values
24
export const INITIAL_APP_DATA = {
35
appState: {
@@ -24,3 +26,8 @@ export const HIDDEN_UI_ELEMENTS = {
2426
export const POINTER_MOVE_THROTTLE_MS = 30; // Throttle pointer move events to reduce the number of updates sent to the server
2527
export const ENABLE_PERIODIC_FULL_SYNC = false; // Set to false to disable periodic scene_update full sync
2628
export const PERIODIC_FULL_SYNC_INTERVAL_MS = 60000; // Sync scene_update every 60 seconds if ENABLE_PERIODIC_FULL_SYNC is true
29+
30+
// Pad constants
31+
export const DEFAULT_SETTINGS: UserSettings = {
32+
embedLockDebounceTime: 350,
33+
};

src/frontend/src/lib/canvas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DEFAULT_SETTINGS } from '../types/settings';
1+
import { DEFAULT_SETTINGS } from '../constants';
22

33
/**
44
*

src/frontend/src/ui/SettingsDialog.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { useState, useCallback, useEffect } from "react";
22
import { Dialog } from "@atyrode/excalidraw";
33
import { Range } from "./Range";
4-
import { UserSettings, DEFAULT_SETTINGS } from "../types/settings";
5-
// import { capture } from "../lib/posthog";
4+
import { UserSettings } from "./types";
5+
import { DEFAULT_SETTINGS } from "../constants";
6+
67
import "./SettingsDialog.scss";
78

89
interface SettingsDialogProps {

src/frontend/src/types/settings.ts renamed to src/frontend/src/ui/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@ export interface UserSettings {
1010
*/
1111
embedLockDebounceTime?: number;
1212
}
13-
14-
export const DEFAULT_SETTINGS: UserSettings = {
15-
embedLockDebounceTime: 350, // Default value from CustomEmbeddableRenderer.tsx
16-
};

0 commit comments

Comments
 (0)