mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 15:44:21 +00:00
Run npm lint:fix
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
import { apiCall } from './api';
|
import { apiCall } from './api';
|
||||||
import { API_BASE_URL, isUser, User } from '../types/authApi';
|
import type { User } from '../types/authApi';
|
||||||
import {
|
import { API_BASE_URL, isUser } from '../types/authApi';
|
||||||
|
import type {
|
||||||
CreateUserRequest,
|
CreateUserRequest,
|
||||||
isSystemStats,
|
|
||||||
SystemStats,
|
SystemStats,
|
||||||
UpdateUserRequest,
|
UpdateUserRequest} from '@/types/adminApi';
|
||||||
|
import {
|
||||||
|
isSystemStats
|
||||||
} from '@/types/adminApi';
|
} from '@/types/adminApi';
|
||||||
import { isWorkspace, Workspace } from '@/types/workspace';
|
import type { Workspace } from '@/types/workspace';
|
||||||
|
import { isWorkspace } from '@/types/workspace';
|
||||||
|
|
||||||
const ADMIN_BASE_URL = `${API_BASE_URL}/admin`;
|
const ADMIN_BASE_URL = `${API_BASE_URL}/admin`;
|
||||||
|
|
||||||
@@ -28,7 +31,7 @@ export const getUsers = async (): Promise<User[]> => {
|
|||||||
if (!isUser(user)) {
|
if (!isUser(user)) {
|
||||||
throw new Error('Invalid user object received from API');
|
throw new Error('Invalid user object received from API');
|
||||||
}
|
}
|
||||||
return user as User;
|
return user;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -50,7 +53,7 @@ export const createUser = async (
|
|||||||
if (!isUser(data)) {
|
if (!isUser(data)) {
|
||||||
throw new Error('Invalid user object received from API');
|
throw new Error('Invalid user object received from API');
|
||||||
}
|
}
|
||||||
return data as User;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,7 +92,7 @@ export const updateUser = async (
|
|||||||
if (!isUser(data)) {
|
if (!isUser(data)) {
|
||||||
throw new Error('Invalid user object received from API');
|
throw new Error('Invalid user object received from API');
|
||||||
}
|
}
|
||||||
return data as User;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Workspace Management
|
// Workspace Management
|
||||||
@@ -109,7 +112,7 @@ export const getWorkspaces = async (): Promise<Workspace[]> => {
|
|||||||
if (!isWorkspace(workspace)) {
|
if (!isWorkspace(workspace)) {
|
||||||
throw new Error('Invalid workspace object received from API');
|
throw new Error('Invalid workspace object received from API');
|
||||||
}
|
}
|
||||||
return workspace as Workspace;
|
return workspace;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -126,5 +129,5 @@ export const getSystemStats = async (): Promise<SystemStats> => {
|
|||||||
if (!isSystemStats(data)) {
|
if (!isSystemStats(data)) {
|
||||||
throw new Error('Invalid system stats response received from API');
|
throw new Error('Invalid system stats response received from API');
|
||||||
}
|
}
|
||||||
return data as SystemStats;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { API_BASE_URL, User, LoginRequest, isUser } from '../types/authApi';
|
import type { User, LoginRequest} from '../types/authApi';
|
||||||
|
import { API_BASE_URL, isUser } from '../types/authApi';
|
||||||
import { apiCall } from './api';
|
import { apiCall } from './api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import { API_BASE_URL } from '@/types/authApi';
|
import { API_BASE_URL } from '@/types/authApi';
|
||||||
import { apiCall } from './api';
|
import { apiCall } from './api';
|
||||||
import {
|
import type {
|
||||||
FileNode,
|
FileNode,
|
||||||
|
LookupResponse,
|
||||||
|
SaveFileResponse} from '@/types/fileApi';
|
||||||
|
import {
|
||||||
isFileNode,
|
isFileNode,
|
||||||
isLookupResponse,
|
isLookupResponse,
|
||||||
isSaveFileResponse,
|
isSaveFileResponse
|
||||||
LookupResponse,
|
|
||||||
SaveFileResponse,
|
|
||||||
} from '@/types/fileApi';
|
} from '@/types/fileApi';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,7 +28,7 @@ export const listFiles = async (workspaceName: string): Promise<FileNode[]> => {
|
|||||||
if (!isFileNode(file)) {
|
if (!isFileNode(file)) {
|
||||||
throw new Error('Invalid file object received from API');
|
throw new Error('Invalid file object received from API');
|
||||||
}
|
}
|
||||||
return file as FileNode;
|
return file;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ export const lookupFileByName = async (
|
|||||||
if (!isLookupResponse(data)) {
|
if (!isLookupResponse(data)) {
|
||||||
throw new Error('Invalid lookup response received from API');
|
throw new Error('Invalid lookup response received from API');
|
||||||
}
|
}
|
||||||
const lookupResponse = data as LookupResponse;
|
const lookupResponse = data;
|
||||||
return lookupResponse.paths;
|
return lookupResponse.paths;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -103,7 +104,7 @@ export const saveFile = async (
|
|||||||
if (!isSaveFileResponse(data)) {
|
if (!isSaveFileResponse(data)) {
|
||||||
throw new Error('Invalid save file response received from API');
|
throw new Error('Invalid save file response received from API');
|
||||||
}
|
}
|
||||||
return data as SaveFileResponse;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { API_BASE_URL } from '@/types/authApi';
|
import { API_BASE_URL } from '@/types/authApi';
|
||||||
import { apiCall } from './api';
|
import { apiCall } from './api';
|
||||||
import { CommitHash } from '@/types/git';
|
import type { CommitHash } from '@/types/git';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pullChanges fetches the latest changes from the remote repository
|
* pullChanges fetches the latest changes from the remote repository
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { API_BASE_URL, isUser, User } from '@/types/authApi';
|
import type { User } from '@/types/authApi';
|
||||||
|
import { API_BASE_URL, isUser } from '@/types/authApi';
|
||||||
import { apiCall } from './api';
|
import { apiCall } from './api';
|
||||||
import { UpdateProfileRequest } from '@/types/userApi';
|
import type { UpdateProfileRequest } from '@/types/userApi';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updateProfile updates the user's profile information.
|
* updateProfile updates the user's profile information.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { API_BASE_URL } from '@/types/authApi';
|
import { API_BASE_URL } from '@/types/authApi';
|
||||||
import { apiCall } from './api';
|
import { apiCall } from './api';
|
||||||
import { isWorkspace, Workspace } from '@/types/workspace';
|
import type { Workspace } from '@/types/workspace';
|
||||||
|
import { isWorkspace } from '@/types/workspace';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* listWorkspaces fetches the list of workspaces
|
* listWorkspaces fetches the list of workspaces
|
||||||
@@ -17,7 +18,7 @@ export const listWorkspaces = async (): Promise<Workspace[]> => {
|
|||||||
if (!isWorkspace(workspace)) {
|
if (!isWorkspace(workspace)) {
|
||||||
throw new Error('Invalid workspace object received from API');
|
throw new Error('Invalid workspace object received from API');
|
||||||
}
|
}
|
||||||
return workspace as Workspace;
|
return workspace;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ export const createWorkspace = async (name: string): Promise<Workspace> => {
|
|||||||
if (!isWorkspace(data)) {
|
if (!isWorkspace(data)) {
|
||||||
throw new Error('Invalid workspace object received from API');
|
throw new Error('Invalid workspace object received from API');
|
||||||
}
|
}
|
||||||
return data as Workspace;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React, { FormEvent, useState } from 'react';
|
import type { FormEvent} from 'react';
|
||||||
|
import React, { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
TextInput,
|
TextInput,
|
||||||
PasswordInput,
|
PasswordInput,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React, { useState, useEffect, useMemo, ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
import React, { useState, useEffect, useMemo } from 'react';
|
||||||
import { unified } from 'unified';
|
import { unified } from 'unified';
|
||||||
import remarkParse from 'remark-parse';
|
import remarkParse from 'remark-parse';
|
||||||
import remarkMath from 'remark-math';
|
import remarkMath from 'remark-math';
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import React, { useRef, useState, useLayoutEffect } from 'react';
|
import React, { useRef, useState, useLayoutEffect } from 'react';
|
||||||
import { Tree, NodeApi } from 'react-arborist';
|
import type { NodeApi } from 'react-arborist';
|
||||||
|
import { Tree } from 'react-arborist';
|
||||||
import { IconFile, IconFolder, IconFolderOpen } from '@tabler/icons-react';
|
import { IconFile, IconFolder, IconFolderOpen } from '@tabler/icons-react';
|
||||||
import { Tooltip } from '@mantine/core';
|
import { Tooltip } from '@mantine/core';
|
||||||
import useResizeObserver from '@react-hook/resize-observer';
|
import useResizeObserver from '@react-hook/resize-observer';
|
||||||
import { FileNode } from '../../types/fileApi';
|
import type { FileNode } from '../../types/fileApi';
|
||||||
|
|
||||||
interface Size {
|
interface Size {
|
||||||
width: number;
|
width: number;
|
||||||
@@ -48,7 +49,7 @@ function Node(props: any) {
|
|||||||
if (node.isInternal) {
|
if (node.isInternal) {
|
||||||
node.toggle();
|
node.toggle();
|
||||||
} else {
|
} else {
|
||||||
const treeProps = node.tree.props as any;
|
const treeProps = node.tree.props;
|
||||||
if (typeof treeProps.onNodeClick === 'function') {
|
if (typeof treeProps.onNodeClick === 'function') {
|
||||||
treeProps.onNodeClick(node);
|
treeProps.onNodeClick(node);
|
||||||
}
|
}
|
||||||
@@ -124,7 +125,7 @@ const FileTree: React.FC<FileTreeProps> = ({
|
|||||||
{...({
|
{...({
|
||||||
// Use a spread with type assertion to add onNodeClick
|
// Use a spread with type assertion to add onNodeClick
|
||||||
onNodeClick: (node: NodeApi<FileNode>) => {
|
onNodeClick: (node: NodeApi<FileNode>) => {
|
||||||
const fileNode = node.data as FileNode;
|
const fileNode = node.data;
|
||||||
if (!node.isInternal) {
|
if (!node.isInternal) {
|
||||||
handleFileSelect(fileNode.path);
|
handleFileSelect(fileNode.path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const MainContent: React.FC<MainContentProps> = ({
|
|||||||
|
|
||||||
const handleSaveFile = useCallback(
|
const handleSaveFile = useCallback(
|
||||||
async (filePath: string, fileContent: string): Promise<boolean> => {
|
async (filePath: string, fileContent: string): Promise<boolean> => {
|
||||||
let success = await handleSave(filePath, fileContent);
|
const success = await handleSave(filePath, fileContent);
|
||||||
if (success) {
|
if (success) {
|
||||||
setHasUnsavedChanges(false);
|
setHasUnsavedChanges(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import FileActions from '../files/FileActions';
|
|||||||
import FileTree from '../files/FileTree';
|
import FileTree from '../files/FileTree';
|
||||||
import { useGitOperations } from '../../hooks/useGitOperations';
|
import { useGitOperations } from '../../hooks/useGitOperations';
|
||||||
import { useWorkspace } from '../../contexts/WorkspaceContext';
|
import { useWorkspace } from '../../contexts/WorkspaceContext';
|
||||||
import { FileNode } from '@/types/fileApi';
|
import type { FileNode } from '@/types/fileApi';
|
||||||
|
|
||||||
interface SidebarProps {
|
interface SidebarProps {
|
||||||
selectedFile: string | null;
|
selectedFile: string | null;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Group,
|
Group,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { CreateUserRequest } from '@/types/adminApi';
|
import type { CreateUserRequest } from '@/types/adminApi';
|
||||||
import { UserRole } from '@/types/authApi';
|
import { UserRole } from '@/types/authApi';
|
||||||
|
|
||||||
interface CreateUserModalProps {
|
interface CreateUserModalProps {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Modal, Text, Button, Group, Stack } from '@mantine/core';
|
import { Modal, Text, Button, Group, Stack } from '@mantine/core';
|
||||||
import { User } from '@/types/authApi';
|
import type { User } from '@/types/authApi';
|
||||||
|
|
||||||
interface DeleteUserModalProps {
|
interface DeleteUserModalProps {
|
||||||
opened: boolean;
|
opened: boolean;
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ import {
|
|||||||
PasswordInput,
|
PasswordInput,
|
||||||
Text,
|
Text,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { UpdateUserRequest } from '@/types/adminApi';
|
import type { UpdateUserRequest } from '@/types/adminApi';
|
||||||
import { User, UserRole } from '@/types/authApi';
|
import type { User} from '@/types/authApi';
|
||||||
|
import { UserRole } from '@/types/authApi';
|
||||||
|
|
||||||
interface EditUserModalProps {
|
interface EditUserModalProps {
|
||||||
opened: boolean;
|
opened: boolean;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|||||||
import { Modal, TextInput, Button, Group, Box } from '@mantine/core';
|
import { Modal, TextInput, Button, Group, Box } from '@mantine/core';
|
||||||
import { useModalContext } from '../../../contexts/ModalContext';
|
import { useModalContext } from '../../../contexts/ModalContext';
|
||||||
import { notifications } from '@mantine/notifications';
|
import { notifications } from '@mantine/notifications';
|
||||||
import { Workspace } from '@/types/workspace';
|
import type { Workspace } from '@/types/workspace';
|
||||||
import { createWorkspace } from '@/api/workspace';
|
import { createWorkspace } from '@/api/workspace';
|
||||||
|
|
||||||
interface CreateWorkspaceModalProps {
|
interface CreateWorkspaceModalProps {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { useWorkspace } from '../../contexts/WorkspaceContext';
|
|||||||
import { useModalContext } from '../../contexts/ModalContext';
|
import { useModalContext } from '../../contexts/ModalContext';
|
||||||
import { listWorkspaces } from '../../api/workspace';
|
import { listWorkspaces } from '../../api/workspace';
|
||||||
import CreateWorkspaceModal from '../modals/workspace/CreateWorkspaceModal';
|
import CreateWorkspaceModal from '../modals/workspace/CreateWorkspaceModal';
|
||||||
import { Workspace } from '../../types/workspace';
|
import type { Workspace } from '../../types/workspace';
|
||||||
|
|
||||||
const WorkspaceSwitcher: React.FC = () => {
|
const WorkspaceSwitcher: React.FC = () => {
|
||||||
const { currentWorkspace, switchWorkspace } = useWorkspace();
|
const { currentWorkspace, switchWorkspace } = useWorkspace();
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ import SecuritySettings from './SecuritySettings';
|
|||||||
import ProfileSettings from './ProfileSettings';
|
import ProfileSettings from './ProfileSettings';
|
||||||
import DangerZoneSettings from './DangerZoneSettings';
|
import DangerZoneSettings from './DangerZoneSettings';
|
||||||
import AccordionControl from '../AccordionControl';
|
import AccordionControl from '../AccordionControl';
|
||||||
import {
|
import type {
|
||||||
SettingsActionType,
|
|
||||||
UserProfileSettings,
|
UserProfileSettings,
|
||||||
ProfileSettingsState,
|
ProfileSettingsState,
|
||||||
SettingsAction,
|
SettingsAction} from '../../../types/settings';
|
||||||
|
import {
|
||||||
|
SettingsActionType
|
||||||
} from '../../../types/settings';
|
} from '../../../types/settings';
|
||||||
|
|
||||||
interface AccountSettingsProps {
|
interface AccountSettingsProps {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Box, Stack, TextInput } from '@mantine/core';
|
import { Box, Stack, TextInput } from '@mantine/core';
|
||||||
import { UserProfileSettings } from '../../../types/settings';
|
import type { UserProfileSettings } from '../../../types/settings';
|
||||||
|
|
||||||
interface ProfileSettingsProps {
|
interface ProfileSettingsProps {
|
||||||
settings: UserProfileSettings;
|
settings: UserProfileSettings;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Box, PasswordInput, Stack, Text } from '@mantine/core';
|
import { Box, PasswordInput, Stack, Text } from '@mantine/core';
|
||||||
import { UserProfileSettings } from '@/types/settings';
|
import type { UserProfileSettings } from '@/types/settings';
|
||||||
|
|
||||||
interface SecuritySettingsProps {
|
interface SecuritySettingsProps {
|
||||||
settings: UserProfileSettings;
|
settings: UserProfileSettings;
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import { useUserAdmin } from '../../../hooks/useUserAdmin';
|
|||||||
import CreateUserModal from '../../modals/user/CreateUserModal';
|
import CreateUserModal from '../../modals/user/CreateUserModal';
|
||||||
import EditUserModal from '../../modals/user/EditUserModal';
|
import EditUserModal from '../../modals/user/EditUserModal';
|
||||||
import DeleteUserModal from '../../modals/user/DeleteUserModal';
|
import DeleteUserModal from '../../modals/user/DeleteUserModal';
|
||||||
import { User } from '../../../types/authApi';
|
import type { User } from '../../../types/authApi';
|
||||||
import { CreateUserRequest, UpdateUserRequest } from '../../../types/adminApi';
|
import type { CreateUserRequest, UpdateUserRequest } from '../../../types/adminApi';
|
||||||
|
|
||||||
interface AdminUsersTabProps {
|
interface AdminUsersTabProps {
|
||||||
currentUser: User;
|
currentUser: User;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Table, Group, Text, Box, LoadingOverlay, Alert } from '@mantine/core';
|
|||||||
import { IconAlertCircle } from '@tabler/icons-react';
|
import { IconAlertCircle } from '@tabler/icons-react';
|
||||||
import { useAdminData } from '../../../hooks/useAdminData';
|
import { useAdminData } from '../../../hooks/useAdminData';
|
||||||
import { formatBytes } from '../../../utils/formatBytes';
|
import { formatBytes } from '../../../utils/formatBytes';
|
||||||
import { FileCountStats, WorkspaceStats } from '../../../types/adminApi';
|
import type { FileCountStats, WorkspaceStats } from '../../../types/adminApi';
|
||||||
|
|
||||||
const AdminWorkspacesTab: React.FC = () => {
|
const AdminWorkspacesTab: React.FC = () => {
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Box, TextInput, Text, Grid } from '@mantine/core';
|
import { Box, TextInput, Text, Grid } from '@mantine/core';
|
||||||
import { Workspace } from '@/types/workspace';
|
import type { Workspace } from '@/types/workspace';
|
||||||
|
|
||||||
interface GeneralSettingsProps {
|
interface GeneralSettingsProps {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
Group,
|
Group,
|
||||||
Grid,
|
Grid,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { Workspace } from '@/types/workspace';
|
import type { Workspace } from '@/types/workspace';
|
||||||
|
|
||||||
interface GitSettingsProps {
|
interface GitSettingsProps {
|
||||||
gitEnabled: boolean;
|
gitEnabled: boolean;
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ import GeneralSettings from './GeneralSettings';
|
|||||||
import { useModalContext } from '../../../contexts/ModalContext';
|
import { useModalContext } from '../../../contexts/ModalContext';
|
||||||
import DangerZoneSettings from './DangerZoneSettings';
|
import DangerZoneSettings from './DangerZoneSettings';
|
||||||
import AccordionControl from '../AccordionControl';
|
import AccordionControl from '../AccordionControl';
|
||||||
import { SettingsActionType, SettingsAction } from '../../../types/settings';
|
import type { SettingsAction } from '../../../types/settings';
|
||||||
import { Workspace } from '../../../types/workspace';
|
import { SettingsActionType } from '../../../types/settings';
|
||||||
|
import type { Workspace } from '../../../types/workspace';
|
||||||
|
|
||||||
// State and reducer for workspace settings
|
// State and reducer for workspace settings
|
||||||
interface WorkspaceSettingsState {
|
interface WorkspaceSettingsState {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
refreshToken as apiRefreshToken,
|
refreshToken as apiRefreshToken,
|
||||||
getCurrentUser,
|
getCurrentUser,
|
||||||
} from '@/api/auth';
|
} from '@/api/auth';
|
||||||
import { User } from '@/types/authApi';
|
import type { User } from '@/types/authApi';
|
||||||
|
|
||||||
interface AuthContextType {
|
interface AuthContextType {
|
||||||
user: User | null;
|
user: User | null;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React, { createContext, useContext, useState, ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
import React, { createContext, useContext, useState } from 'react';
|
||||||
|
|
||||||
interface ModalContextType {
|
interface ModalContextType {
|
||||||
newFileModalVisible: boolean;
|
newFileModalVisible: boolean;
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
|
import type {
|
||||||
|
ReactNode} from 'react';
|
||||||
import React, {
|
import React, {
|
||||||
createContext,
|
createContext,
|
||||||
useContext,
|
useContext,
|
||||||
useState,
|
useState,
|
||||||
useEffect,
|
useEffect,
|
||||||
useCallback,
|
useCallback
|
||||||
ReactNode,
|
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { MantineColorScheme, useMantineColorScheme } from '@mantine/core';
|
import type { MantineColorScheme} from '@mantine/core';
|
||||||
|
import { useMantineColorScheme } from '@mantine/core';
|
||||||
import { notifications } from '@mantine/notifications';
|
import { notifications } from '@mantine/notifications';
|
||||||
import {
|
import {
|
||||||
getLastWorkspaceName,
|
getLastWorkspaceName,
|
||||||
@@ -16,7 +18,8 @@ import {
|
|||||||
deleteWorkspace,
|
deleteWorkspace,
|
||||||
listWorkspaces,
|
listWorkspaces,
|
||||||
} from '@/api/workspace';
|
} from '@/api/workspace';
|
||||||
import { Workspace, DEFAULT_WORKSPACE_SETTINGS } from '@/types/workspace';
|
import type { Workspace} from '@/types/workspace';
|
||||||
|
import { DEFAULT_WORKSPACE_SETTINGS } from '@/types/workspace';
|
||||||
|
|
||||||
interface WorkspaceContextType {
|
interface WorkspaceContextType {
|
||||||
currentWorkspace: Workspace | null;
|
currentWorkspace: Workspace | null;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { notifications } from '@mantine/notifications';
|
import { notifications } from '@mantine/notifications';
|
||||||
import { getUsers, getWorkspaces, getSystemStats } from '@/api/admin';
|
import { getUsers, getWorkspaces, getSystemStats } from '@/api/admin';
|
||||||
import { SystemStats, WorkspaceStats } from '@/types/adminApi';
|
import type { SystemStats, WorkspaceStats } from '@/types/adminApi';
|
||||||
import { User } from '@/types/authApi';
|
import type { User } from '@/types/authApi';
|
||||||
|
|
||||||
// Possible types of admin data
|
// Possible types of admin data
|
||||||
type AdminDataType = 'stats' | 'workspaces' | 'users';
|
type AdminDataType = 'stats' | 'workspaces' | 'users';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useCallback } from 'react';
|
import { useState, useCallback } from 'react';
|
||||||
import { listFiles } from '../api/file';
|
import { listFiles } from '../api/file';
|
||||||
import { useWorkspace } from '../contexts/WorkspaceContext';
|
import { useWorkspace } from '../contexts/WorkspaceContext';
|
||||||
import { FileNode } from '../types/fileApi';
|
import type { FileNode } from '../types/fileApi';
|
||||||
|
|
||||||
interface UseFileListResult {
|
interface UseFileListResult {
|
||||||
files: FileNode[];
|
files: FileNode[];
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useCallback } from 'react';
|
|||||||
import { notifications } from '@mantine/notifications';
|
import { notifications } from '@mantine/notifications';
|
||||||
import { pullChanges, commitAndPush } from '../api/git';
|
import { pullChanges, commitAndPush } from '../api/git';
|
||||||
import { useWorkspace } from '../contexts/WorkspaceContext';
|
import { useWorkspace } from '../contexts/WorkspaceContext';
|
||||||
import { CommitHash } from '@/types/git';
|
import type { CommitHash } from '@/types/git';
|
||||||
|
|
||||||
interface UseGitOperationsResult {
|
interface UseGitOperationsResult {
|
||||||
handlePull: () => Promise<boolean>;
|
handlePull: () => Promise<boolean>;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useState, useCallback } from 'react';
|
import { useState, useCallback } from 'react';
|
||||||
import { notifications } from '@mantine/notifications';
|
import { notifications } from '@mantine/notifications';
|
||||||
import { updateProfile, deleteUser } from '../api/user';
|
import { updateProfile, deleteUser } from '../api/user';
|
||||||
import { User } from '../types/authApi';
|
import type { User } from '../types/authApi';
|
||||||
import { UpdateProfileRequest } from '../types/userApi';
|
import type { UpdateProfileRequest } from '../types/userApi';
|
||||||
|
|
||||||
interface UseProfileSettingsResult {
|
interface UseProfileSettingsResult {
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import {
|
|||||||
deleteUser as adminDeleteUser,
|
deleteUser as adminDeleteUser,
|
||||||
} from '../api/admin';
|
} from '../api/admin';
|
||||||
import { notifications } from '@mantine/notifications';
|
import { notifications } from '@mantine/notifications';
|
||||||
import { User } from '../types/authApi';
|
import type { User } from '../types/authApi';
|
||||||
import { CreateUserRequest, UpdateUserRequest } from '../types/adminApi';
|
import type { CreateUserRequest, UpdateUserRequest } from '../types/adminApi';
|
||||||
|
|
||||||
interface UseUserAdminResult {
|
interface UseUserAdminResult {
|
||||||
users: User[];
|
users: User[];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { UserRole } from './authApi';
|
import type { UserRole } from './authApi';
|
||||||
|
|
||||||
// CreateUserRequest holds the request fields for creating a new user
|
// CreateUserRequest holds the request fields for creating a new user
|
||||||
export interface CreateUserRequest {
|
export interface CreateUserRequest {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { visit } from 'unist-util-visit';
|
import { visit } from 'unist-util-visit';
|
||||||
import { InlineContainerType, MARKDOWN_REGEX } from '../types/markdown';
|
import { InlineContainerType, MARKDOWN_REGEX } from '../types/markdown';
|
||||||
import { Node } from 'unist';
|
import type { Node } from 'unist';
|
||||||
import { Parent } from 'unist';
|
import type { Parent } from 'unist';
|
||||||
import { Text } from 'mdast';
|
import type { Text } from 'mdast';
|
||||||
import { lookupFileByName } from '@/api/file';
|
import { lookupFileByName } from '@/api/file';
|
||||||
import { getFileUrl } from './fileHelpers';
|
import { getFileUrl } from './fileHelpers';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user