mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 07:54:22 +00:00
Fix various eslint issues
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Text, Switch, Group, Box } from '@mantine/core';
|
||||
import { useWorkspace } from '../../../contexts/WorkspaceContext';
|
||||
import { Theme } from '@/types/theme';
|
||||
import { Theme } from '@/types/models';
|
||||
|
||||
interface AppearanceSettingsProps {
|
||||
onThemeChange: (newTheme: Theme) => void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, TextInput, Text, Grid } from '@mantine/core';
|
||||
import type { Workspace } from '@/types/workspace';
|
||||
import type { Workspace } from '@/types/models';
|
||||
|
||||
interface GeneralSettingsProps {
|
||||
name: string;
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Group,
|
||||
Grid,
|
||||
} from '@mantine/core';
|
||||
import type { Workspace } from '@/types/workspace';
|
||||
import type { Workspace } from '@/types/models';
|
||||
|
||||
interface GitSettingsProps {
|
||||
gitEnabled: boolean;
|
||||
@@ -19,7 +19,7 @@ interface GitSettingsProps {
|
||||
gitCommitMsgTemplate: string;
|
||||
gitCommitName: string;
|
||||
gitCommitEmail: string;
|
||||
onInputChange: (key: keyof Workspace, value: any) => void;
|
||||
onInputChange: (key: keyof Workspace, value: string | boolean) => void;
|
||||
}
|
||||
|
||||
const GitSettings: React.FC<GitSettingsProps> = ({
|
||||
|
||||
@@ -17,10 +17,12 @@ import GeneralSettings from './GeneralSettings';
|
||||
import { useModalContext } from '../../../contexts/ModalContext';
|
||||
import DangerZoneSettings from './DangerZoneSettings';
|
||||
import AccordionControl from '../AccordionControl';
|
||||
import type { SettingsAction } from '../../../types/settings';
|
||||
import { SettingsActionType } from '../../../types/settings';
|
||||
import type { Workspace } from '../../../types/workspace';
|
||||
|
||||
import {
|
||||
type Theme,
|
||||
type Workspace,
|
||||
type SettingsAction,
|
||||
SettingsActionType,
|
||||
} from '@/types/models';
|
||||
// State and reducer for workspace settings
|
||||
interface WorkspaceSettingsState {
|
||||
localSettings: Partial<Workspace>;
|
||||
@@ -46,7 +48,7 @@ function settingsReducer(
|
||||
initialSettings: action.payload || {},
|
||||
hasUnsavedChanges: false,
|
||||
};
|
||||
case SettingsActionType.UPDATE_LOCAL_SETTINGS:
|
||||
case SettingsActionType.UPDATE_LOCAL_SETTINGS: {
|
||||
const newLocalSettings = { ...state.localSettings, ...action.payload };
|
||||
const hasChanges =
|
||||
JSON.stringify(newLocalSettings) !==
|
||||
@@ -56,6 +58,7 @@ function settingsReducer(
|
||||
localSettings: newLocalSettings,
|
||||
hasUnsavedChanges: hasChanges,
|
||||
};
|
||||
}
|
||||
case SettingsActionType.MARK_SAVED:
|
||||
return {
|
||||
...state,
|
||||
@@ -95,7 +98,7 @@ const WorkspaceSettings: React.FC = () => {
|
||||
}, [currentWorkspace]);
|
||||
|
||||
const handleInputChange = useCallback(
|
||||
(key: keyof Workspace, value: any): void => {
|
||||
<K extends keyof Workspace>(key: K, value: Workspace[K]): void => {
|
||||
dispatch({
|
||||
type: SettingsActionType.UPDATE_LOCAL_SETTINGS,
|
||||
payload: { [key]: value } as Partial<Workspace>,
|
||||
@@ -194,7 +197,7 @@ const WorkspaceSettings: React.FC = () => {
|
||||
<Accordion.Panel>
|
||||
<AppearanceSettings
|
||||
onThemeChange={(newTheme: string) =>
|
||||
handleInputChange('theme', newTheme)
|
||||
handleInputChange('theme', newTheme as Theme)
|
||||
}
|
||||
/>
|
||||
</Accordion.Panel>
|
||||
@@ -247,7 +250,7 @@ const WorkspaceSettings: React.FC = () => {
|
||||
<Button variant="default" onClick={handleClose}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={handleSubmit}>Save Changes</Button>
|
||||
<Button onClick={() => void handleSubmit}>Save Changes</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user