cherry-studio/src/renderer/src/hooks/useStore.ts
neko engineer 5b199aa736
feat: 调整分组的效果 (#6561)
1,未分组标签改为未分组
2,列表展示效果持久化
3,增加一个管理列表展示效过的store

Co-authored-by: linshuhao <nmnm1996>
2025-05-29 15:40:32 +08:00

42 lines
1.2 KiB
TypeScript

import { useAppDispatch, useAppSelector } from '@renderer/store'
import {
setAssistantsTabSortType,
setShowAssistants,
setShowTopics,
toggleShowAssistants,
toggleShowTopics
} from '@renderer/store/settings'
import { AssistantsSortType } from '@renderer/types'
export function useShowAssistants() {
const showAssistants = useAppSelector((state) => state.settings.showAssistants)
const dispatch = useAppDispatch()
return {
showAssistants,
setShowAssistants: (show: boolean) => dispatch(setShowAssistants(show)),
toggleShowAssistants: () => dispatch(toggleShowAssistants())
}
}
export function useShowTopics() {
const showTopics = useAppSelector((state) => state.settings.showTopics)
const dispatch = useAppDispatch()
return {
showTopics,
setShowTopics: (show: boolean) => dispatch(setShowTopics(show)),
toggleShowTopics: () => dispatch(toggleShowTopics())
}
}
export function useAssistantsTabSortType() {
const AssistantsTabSortType = useAppSelector((state) => state.settings.assistantsTabSortType)
const dispatch = useAppDispatch()
return {
AssistantsTabSortType,
setAssistantsTabSortType: (sortType: AssistantsSortType) => dispatch(setAssistantsTabSortType(sortType))
}
}