mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-02 10:29:02 +08:00
42 lines
1.2 KiB
TypeScript
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))
|
|
}
|
|
}
|