From bbc7b20183754f93a54be066b7a806626ec4aff1 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Thu, 27 Mar 2025 15:15:15 +0800 Subject: [PATCH] lint: fix code format --- src/main/ipc.ts | 2 +- .../src/components/DragableList/index.tsx | 2 +- .../src/context/SyntaxHighlighterProvider.tsx | 2 +- src/renderer/src/context/ThemeProvider.tsx | 6 +-- .../home/Messages/MessageGroupModelList.tsx | 4 +- .../mini/home/components/FeatureMenus.tsx | 11 ++-- .../windows/mini/home/components/InputBar.tsx | 53 ++++++++++--------- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/src/main/ipc.ts b/src/main/ipc.ts index b2cbfd2f..a4841f5c 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -17,8 +17,8 @@ import FileStorage from './services/FileStorage' import { GeminiService } from './services/GeminiService' import KnowledgeService from './services/KnowledgeService' import MCPService from './services/MCPService' -import ObsidianVaultService from './services/ObsidianVaultService' import * as NutstoreService from './services/NutstoreService' +import ObsidianVaultService from './services/ObsidianVaultService' import { ProxyConfig, proxyManager } from './services/ProxyManager' import { registerShortcuts, unregisterAllShortcuts } from './services/ShortcutService' import { TrayService } from './services/TrayService' diff --git a/src/renderer/src/components/DragableList/index.tsx b/src/renderer/src/components/DragableList/index.tsx index a5c2db91..cc281e7b 100644 --- a/src/renderer/src/components/DragableList/index.tsx +++ b/src/renderer/src/components/DragableList/index.tsx @@ -8,8 +8,8 @@ import { OnDragStartResponder, ResponderProvided } from '@hello-pangea/dnd' -import VirtualList from 'rc-virtual-list' import { droppableReorder } from '@renderer/utils' +import VirtualList from 'rc-virtual-list' import { FC } from 'react' interface Props { diff --git a/src/renderer/src/context/SyntaxHighlighterProvider.tsx b/src/renderer/src/context/SyntaxHighlighterProvider.tsx index bbb4624d..3933b786 100644 --- a/src/renderer/src/context/SyntaxHighlighterProvider.tsx +++ b/src/renderer/src/context/SyntaxHighlighterProvider.tsx @@ -82,7 +82,7 @@ export const SyntaxHighlighterProvider: React.FC = ({ childre [highlighter, highlighterTheme] ) - return {children} + return {children} } export const useSyntaxHighlighter = () => { diff --git a/src/renderer/src/context/ThemeProvider.tsx b/src/renderer/src/context/ThemeProvider.tsx index 113898f4..24c6bce1 100644 --- a/src/renderer/src/context/ThemeProvider.tsx +++ b/src/renderer/src/context/ThemeProvider.tsx @@ -57,11 +57,7 @@ export const ThemeProvider: React.FC = ({ children, defaultT } }) - return ( - - {children} - - ) + return {children} } export const useTheme = () => use(ThemeContext) diff --git a/src/renderer/src/pages/home/Messages/MessageGroupModelList.tsx b/src/renderer/src/pages/home/Messages/MessageGroupModelList.tsx index c81d9adc..695d3a05 100644 --- a/src/renderer/src/pages/home/Messages/MessageGroupModelList.tsx +++ b/src/renderer/src/pages/home/Messages/MessageGroupModelList.tsx @@ -25,7 +25,9 @@ const MessageGroupModelList: FC = ({ messages, setSe return ( - dispatch(setFoldDisplayMode(isCompact ? 'expanded' : 'compact'))}> + dispatch(setFoldDisplayMode(isCompact ? 'expanded' : 'compact'))}> void } -const FeatureMenus = forwardRef(({ text, setRoute, onSendMessage }, ref) => { +const FeatureMenus = ({ + ref, + text, + setRoute, + onSendMessage +}: FeatureMenusProps & { ref?: React.RefObject }) => { const { t } = useTranslation() const [selectedIndex, setSelectedIndex] = useState(0) @@ -94,7 +99,7 @@ const FeatureMenus = forwardRef(({ text, set ) -}) +} FeatureMenus.displayName = 'FeatureMenus' const FeatureList = styled(Scrollbar)` diff --git a/src/renderer/src/windows/mini/home/components/InputBar.tsx b/src/renderer/src/windows/mini/home/components/InputBar.tsx index cb29c6af..3a800616 100644 --- a/src/renderer/src/windows/mini/home/components/InputBar.tsx +++ b/src/renderer/src/windows/mini/home/components/InputBar.tsx @@ -2,7 +2,7 @@ import ModelAvatar from '@renderer/components/Avatar/ModelAvatar' import { useRuntime } from '@renderer/hooks/useRuntime' import { Input as AntdInput } from 'antd' import { InputRef } from 'rc-input/lib/interface' -import React, { forwardRef, useRef } from 'react' +import React, { useRef } from 'react' import styled from 'styled-components' interface InputBarProps { @@ -14,30 +14,35 @@ interface InputBarProps { handleChange: (e: React.ChangeEvent) => void } -const InputBar = forwardRef( - ({ text, model, placeholder, handleKeyDown, handleChange }, ref) => { - const { generating } = useRuntime() - const inputRef = useRef(null) - if (!generating) { - setTimeout(() => inputRef.current?.input?.focus(), 0) - } - return ( - - - - - ) +const InputBar = ({ + ref, + text, + model, + placeholder, + handleKeyDown, + handleChange +}: InputBarProps & { ref?: React.RefObject }) => { + const { generating } = useRuntime() + const inputRef = useRef(null) + if (!generating) { + setTimeout(() => inputRef.current?.input?.focus(), 0) } -) + return ( + + + + + ) +} InputBar.displayName = 'InputBar' const InputWrapper = styled.div`