mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-31 08:29:07 +08:00
* feat: ui switch * chore: update migration version to 122 and adjust settings topic position * refactor: replace PinnedApps component with SidebarPinnedApps and SidebarOpenedMinappTabs for improved structure * feat(i18n): add launchpad apps and minapps translations for multiple languages * style: update MinAppIcon and IconContainer dimensions for improved UI consistency * refactor: remove unused SidebarContainer component from AppsPage * refactor: adjust Navbar padding and enhance search functionality in AgentsPage * feat(minapps): implement MinApps page and enhance mini app management features - Added MinAppsPage for managing mini applications. - Introduced NewAppButton for adding custom mini apps. - Created MiniAppSettings for configuring mini app settings. - Enhanced mini app icon management with MiniAppIconsManager. - Updated Router to include MinAppsPage and replaced AppsPage with MinAppsPage. - Added translations for new mini app features in multiple languages. * wip * refactor: rename App component to MinApp and streamline LaunchpadPage logic - Renamed App component to MinApp for clarity. - Removed unnecessary state management in LaunchpadPage. - Simplified minapp sorting logic by directly using openedKeepAliveMinapps. * feat(i18n): update translations for multiple languages and restructure title entries - Added missing title entries for various sections in English, Japanese, Russian, Chinese (Simplified and Traditional). - Restructured the launchpad and minapp translations for better organization. - Enhanced navbar display settings translations across all supported languages. * feat: add header prop to DraggableVirtualList and implement Add Topic button in TopicsTab - Introduced a new `header` prop in the DraggableVirtualList component to allow custom header content. - Added an Add Topic button in the TopicsTab with a corresponding styled component and translation support for multiple languages. - Updated styles in AssistantsTab and adjusted overflow behavior in Tabs index for better UI experience. * style: adjust margins and max-width for improved layout in various components - Updated margin-top in HtmlArtifactsCard for consistent spacing. - Set max-width in MessageGroup to enhance responsiveness based on navbar position. - Modified Add Topic button in TopicsTab to emit an event for better functionality. * fix: correct state property name in migration for navbar position - Updated the migration logic to set the correct state property from `topicPosition` to `navbarPosition` for proper configuration handling. * fix: adjust traffic light position and navbar height for improved UI consistency - Updated traffic light position in WindowService to enhance layout. - Adjusted navbar height in color.scss for better alignment across components. - Modified TabContainer to track last settings path and improve navigation handling. * style: update AddTopicButton styling for improved hover effect in TopicsTab - Changed AddTopicButton from a button to a div for better styling flexibility. - Removed dashed border and added background color on hover for enhanced user experience. - Retained border-radius for consistent design across components. * feat: add TextBadge component and integrate into Display and Memory settings - Introduced a new TextBadge component for displaying styled badges. - Integrated TextBadge into DisplaySettings to highlight the navbar title as "New". - Replaced inline badge implementation in MemorySettings with the new TextBadge component for consistency and improved maintainability. * fix: adjust tab and navbar styling for improved UI consistency - Increased height of title bar overlays for better visual balance. - Updated tab creation logic to prevent duplicate tabs for specific paths. - Modified tab icon and close button sizes for a more compact design. - Enhanced tab spacing and padding for improved layout across components. * style: update PinnedMinapps component for improved UI consistency - Increased icon size and adjusted border radius for better visual appeal. - Modified TopNavContainer padding and margin for enhanced layout. - Reduced dimensions of TopNavIcon for a more compact design. * refactor: enhance TabsContainer logic and styling for improved tab management - Introduced a new `removeSpecialTabs` function to manage special tab removal more effectively. - Updated tab filtering logic to utilize a dedicated `specialTabs` array for better maintainability. - Adjusted styling in PinnedMinapps for consistent icon sizing and background color improvements. * style: adjust layout and padding for improved UI consistency in Chat and Inputbar components - Updated main height calculation in Chat component to account for additional spacing. - Modified padding in Inputbar component for better alignment when navbar is positioned at the top. - Ensured consistent minimum height in Tabs component to match updated navbar height calculations. * refactor: update app menu item text keys for improved localization - Changed text keys in the app menu items from specific titles to a more generalized 'title' namespace for better consistency and maintainability. - Ensured that the visual representation of the menu items remains unchanged while enhancing the localization structure. * refactor: simplify sidebar toggle logic in ChatNavbar and Navbar components - Removed unnecessary cooldown logic when toggling the visibility of assistants and topics. - Updated HomePage to conditionally render the Navbar based on the sidebar state for improved UI responsiveness. * refactor: streamline Chat component and introduce useChatMaxWidth hook - Consolidated max width calculation logic into a new `useChatMaxWidth` hook for better reusability. - Removed unused variables and simplified state management in the Chat component. - Updated MessageGroup to utilize the new `useChatMaxWidth` hook for consistent layout handling. * refactor: remove FloatingSidebar component and integrate AssistantsDrawer for improved UI management - Deleted the FloatingSidebar component to streamline the codebase. - Introduced AssistantsDrawer for managing assistant interactions, enhancing user experience. - Updated Navbar and ChatNavbar components to utilize AssistantsDrawer instead of FloatingSidebar for better responsiveness and maintainability. * refactor: implement TabsService for improved tab management functionality - Introduced TabsService to centralize tab operations, including closing and setting active tabs. - Updated TabsContainer and LaunchpadPage components to utilize TabsService for closing tabs, enhancing code maintainability. - Made minor UI adjustments in PinnedMinapps for consistent icon sizing and layout improvements. * fix: prevent default event behavior when not in fullscreen mode - Updated WindowService to conditionally call event.preventDefault() only when the main window is not in fullscreen, improving event handling logic.
217 lines
6.9 KiB
TypeScript
217 lines
6.9 KiB
TypeScript
import { Navbar, NavbarCenter } from '@renderer/components/app/Navbar'
|
|
import ModelSettings from '@renderer/pages/settings/ModelSettings/ModelSettings'
|
|
import {
|
|
Brain,
|
|
Cloud,
|
|
Command,
|
|
HardDrive,
|
|
Info,
|
|
MonitorCog,
|
|
Package,
|
|
PencilRuler,
|
|
Rocket,
|
|
Settings2,
|
|
SquareTerminal,
|
|
TextCursorInput,
|
|
Zap
|
|
} from 'lucide-react'
|
|
// 导入useAppSelector
|
|
import { FC } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { Link, Route, Routes, useLocation } from 'react-router-dom'
|
|
import styled from 'styled-components'
|
|
|
|
import AboutSettings from './AboutSettings'
|
|
import DataSettings from './DataSettings/DataSettings'
|
|
import DisplaySettings from './DisplaySettings/DisplaySettings'
|
|
import GeneralSettings from './GeneralSettings'
|
|
import MCPSettings from './MCPSettings'
|
|
import MemorySettings from './MemorySettings'
|
|
import ProvidersList from './ProviderSettings'
|
|
import QuickAssistantSettings from './QuickAssistantSettings'
|
|
import QuickPhraseSettings from './QuickPhraseSettings'
|
|
import SelectionAssistantSettings from './SelectionAssistantSettings/SelectionAssistantSettings'
|
|
import ShortcutSettings from './ShortcutSettings'
|
|
import ToolSettings from './ToolSettings'
|
|
|
|
const SettingsPage: FC = () => {
|
|
const { pathname } = useLocation()
|
|
const { t } = useTranslation()
|
|
|
|
const isRoute = (path: string): string => (pathname.startsWith(path) ? 'active' : '')
|
|
|
|
return (
|
|
<Container>
|
|
<Navbar>
|
|
<NavbarCenter style={{ borderRight: 'none' }}>{t('settings.title')}</NavbarCenter>
|
|
</Navbar>
|
|
<ContentContainer id="content-container">
|
|
<SettingMenus>
|
|
<MenuItemLink to="/settings/provider">
|
|
<MenuItem className={isRoute('/settings/provider')}>
|
|
<Cloud size={18} />
|
|
{t('settings.provider.title')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/model">
|
|
<MenuItem className={isRoute('/settings/model')}>
|
|
<Package size={18} />
|
|
{t('settings.model')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/general">
|
|
<MenuItem className={isRoute('/settings/general')}>
|
|
<Settings2 size={18} />
|
|
{t('settings.general')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/display">
|
|
<MenuItem className={isRoute('/settings/display')}>
|
|
<MonitorCog size={18} />
|
|
{t('settings.display.title')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/mcp">
|
|
<MenuItem className={isRoute('/settings/mcp')}>
|
|
<SquareTerminal size={18} />
|
|
{t('settings.mcp.title')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/memory">
|
|
<MenuItem className={isRoute('/settings/memory')}>
|
|
<Brain size={18} />
|
|
{t('memory.title')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/tool">
|
|
<MenuItem className={isRoute('/settings/tool')}>
|
|
<PencilRuler size={18} />
|
|
{t('settings.tool.title')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/shortcut">
|
|
<MenuItem className={isRoute('/settings/shortcut')}>
|
|
<Command size={18} />
|
|
{t('settings.shortcuts.title')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/quickAssistant">
|
|
<MenuItem className={isRoute('/settings/quickAssistant')}>
|
|
<Rocket size={18} />
|
|
{t('settings.quickAssistant.title')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/selectionAssistant">
|
|
<MenuItem className={isRoute('/settings/selectionAssistant')}>
|
|
<TextCursorInput size={18} />
|
|
{t('selection.name')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/quickPhrase">
|
|
<MenuItem className={isRoute('/settings/quickPhrase')}>
|
|
<Zap size={18} />
|
|
{t('settings.quickPhrase.title')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/data">
|
|
<MenuItem className={isRoute('/settings/data')}>
|
|
<HardDrive size={18} />
|
|
{t('settings.data.title')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
<MenuItemLink to="/settings/about">
|
|
<MenuItem className={isRoute('/settings/about')}>
|
|
<Info size={18} />
|
|
{t('settings.about')}
|
|
</MenuItem>
|
|
</MenuItemLink>
|
|
</SettingMenus>
|
|
<SettingContent>
|
|
<Routes>
|
|
<Route path="provider" element={<ProvidersList />} />
|
|
<Route path="model" element={<ModelSettings />} />
|
|
<Route path="tool/*" element={<ToolSettings />} />
|
|
<Route path="mcp/*" element={<MCPSettings />} />
|
|
<Route path="memory" element={<MemorySettings />} />
|
|
<Route path="general/*" element={<GeneralSettings />} />
|
|
<Route path="display" element={<DisplaySettings />} />
|
|
<Route path="shortcut" element={<ShortcutSettings />} />
|
|
<Route path="quickAssistant" element={<QuickAssistantSettings />} />
|
|
<Route path="selectionAssistant" element={<SelectionAssistantSettings />} />
|
|
<Route path="data" element={<DataSettings />} />
|
|
<Route path="about" element={<AboutSettings />} />
|
|
<Route path="quickPhrase" element={<QuickPhraseSettings />} />
|
|
</Routes>
|
|
</SettingContent>
|
|
</ContentContainer>
|
|
</Container>
|
|
)
|
|
}
|
|
|
|
const Container = styled.div`
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
`
|
|
|
|
const ContentContainer = styled.div`
|
|
display: flex;
|
|
flex: 1;
|
|
flex-direction: row;
|
|
`
|
|
|
|
const SettingMenus = styled.ul`
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-width: var(--settings-width);
|
|
border-right: 0.5px solid var(--color-border);
|
|
padding: 10px;
|
|
user-select: none;
|
|
`
|
|
|
|
const MenuItemLink = styled(Link)`
|
|
text-decoration: none;
|
|
color: var(--color-text-1);
|
|
margin-bottom: 5px;
|
|
`
|
|
|
|
const MenuItem = styled.li`
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 6px 10px;
|
|
width: 100%;
|
|
cursor: pointer;
|
|
border-radius: var(--list-item-border-radius);
|
|
font-weight: 500;
|
|
transition: all 0.2s ease-in-out;
|
|
border: 0.5px solid transparent;
|
|
.anticon {
|
|
font-size: 16px;
|
|
opacity: 0.8;
|
|
}
|
|
.iconfont {
|
|
font-size: 18px;
|
|
line-height: 18px;
|
|
opacity: 0.7;
|
|
margin-left: -1px;
|
|
}
|
|
&:hover {
|
|
background: var(--color-background-soft);
|
|
}
|
|
&.active {
|
|
background: var(--color-background-soft);
|
|
border: 0.5px solid var(--color-border);
|
|
}
|
|
`
|
|
|
|
const SettingContent = styled.div`
|
|
display: flex;
|
|
height: 100%;
|
|
flex: 1;
|
|
border-right: 0.5px solid var(--color-border);
|
|
`
|
|
|
|
export default SettingsPage
|