mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 16:34:26 +00:00
Fix various eslint issues
This commit is contained in:
@@ -16,13 +16,12 @@ import SecuritySettings from './SecuritySettings';
|
||||
import ProfileSettings from './ProfileSettings';
|
||||
import DangerZoneSettings from './DangerZoneSettings';
|
||||
import AccordionControl from '../AccordionControl';
|
||||
import type {
|
||||
UserProfileSettings,
|
||||
ProfileSettingsState,
|
||||
SettingsAction} from '../../../types/settings';
|
||||
import {
|
||||
SettingsActionType
|
||||
} from '../../../types/settings';
|
||||
type UserProfileSettings,
|
||||
type ProfileSettingsState,
|
||||
type SettingsAction,
|
||||
SettingsActionType,
|
||||
} from '@/types/models';
|
||||
|
||||
interface AccountSettingsProps {
|
||||
opened: boolean;
|
||||
|
||||
@@ -13,7 +13,7 @@ const DangerZoneSettings: React.FC = () => {
|
||||
const success = await deleteAccount(password);
|
||||
if (success) {
|
||||
setDeleteModalOpened(false);
|
||||
logout();
|
||||
await logout();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, Stack, TextInput } from '@mantine/core';
|
||||
import type { UserProfileSettings } from '../../../types/settings';
|
||||
import type { UserProfileSettings } from '@/types/models';
|
||||
|
||||
interface ProfileSettingsProps {
|
||||
settings: UserProfileSettings;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Box, PasswordInput, Stack, Text } from '@mantine/core';
|
||||
import type { UserProfileSettings } from '@/types/settings';
|
||||
import type { UserProfileSettings } from '@/types/models';
|
||||
|
||||
interface SecuritySettingsProps {
|
||||
settings: UserProfileSettings;
|
||||
@@ -66,7 +66,7 @@ const SecuritySettings: React.FC<SecuritySettingsProps> = ({
|
||||
/>
|
||||
<Text size="xs" c="dimmed">
|
||||
Password must be at least 8 characters long. Leave password fields
|
||||
empty if you don't want to change it.
|
||||
empty if you don't want to change it.
|
||||
</Text>
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
@@ -20,8 +20,8 @@ import { useUserAdmin } from '../../../hooks/useUserAdmin';
|
||||
import CreateUserModal from '../../modals/user/CreateUserModal';
|
||||
import EditUserModal from '../../modals/user/EditUserModal';
|
||||
import DeleteUserModal from '../../modals/user/DeleteUserModal';
|
||||
import type { User } from '../../../types/authApi';
|
||||
import type { CreateUserRequest, UpdateUserRequest } from '../../../types/adminApi';
|
||||
import type { User } from '@/types/models';
|
||||
import type { CreateUserRequest, UpdateUserRequest } from '@/types/api';
|
||||
|
||||
interface AdminUsersTabProps {
|
||||
currentUser: User;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Table, Group, Text, Box, LoadingOverlay, Alert } from '@mantine/core';
|
||||
import { IconAlertCircle } from '@tabler/icons-react';
|
||||
import { useAdminData } from '../../../hooks/useAdminData';
|
||||
import { formatBytes } from '../../../utils/formatBytes';
|
||||
import type { FileCountStats, WorkspaceStats } from '../../../types/adminApi';
|
||||
import type { FileCountStats, WorkspaceStats } from '@/types/models';
|
||||
|
||||
const AdminWorkspacesTab: React.FC = () => {
|
||||
const {
|
||||
|
||||
@@ -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