mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
chore: useConfig().value
This commit is contained in:
parent
23c0b8118a
commit
a093a9d86d
4 changed files with 9 additions and 23 deletions
|
|
@ -5,8 +5,8 @@ import { GitHub } from 'platforms/GitHub'
|
|||
import * as React from 'react'
|
||||
|
||||
export function AccessDeniedDescription() {
|
||||
const configContext = useConfigs()
|
||||
const hasToken = Boolean(configContext.value.accessToken)
|
||||
const { accessToken } = useConfigs().value
|
||||
const hasToken = Boolean(accessToken)
|
||||
|
||||
return (
|
||||
<div className={'description-area'}>
|
||||
|
|
|
|||
|
|
@ -67,9 +67,7 @@ const NodeItemIcon = React.memo(function NodeItemIcon({
|
|||
open?: boolean
|
||||
loading?: boolean
|
||||
}) {
|
||||
const {
|
||||
value: { icons },
|
||||
} = useConfigs()
|
||||
const { icons } = useConfigs().value
|
||||
|
||||
const src = React.useMemo(
|
||||
() => (node.type === 'tree' ? getFolderIconURL(node, open) : getFileIconURL(node)),
|
||||
|
|
|
|||
|
|
@ -36,9 +36,7 @@ export type NodeRendererContext = {
|
|||
|
||||
function useSetupTree(setUpTree: ConnectorState['setUpTree'], metaData: MetaData) {
|
||||
const stateContext = useLoadedContext(SideBarStateContext)
|
||||
const {
|
||||
value: { accessToken, compressSingletonFolder },
|
||||
} = useConfigs()
|
||||
const { accessToken, compressSingletonFolder } = useConfigs().value
|
||||
|
||||
useSequentialEffect(
|
||||
checker => {
|
||||
|
|
@ -78,9 +76,7 @@ function useOnSearch(
|
|||
updateSearchKey: (searchKey: string) => void,
|
||||
visibleNodesGenerator: VisibleNodesGenerator | null,
|
||||
) {
|
||||
const {
|
||||
value: { restoreExpandedFolders },
|
||||
} = useConfigs()
|
||||
const { restoreExpandedFolders } = useConfigs().value
|
||||
return React.useCallback(
|
||||
(searchKey: string, searchMode: SearchMode) => {
|
||||
updateSearchKey(searchKey)
|
||||
|
|
@ -96,9 +92,7 @@ function useOnSearch(
|
|||
}
|
||||
|
||||
function useRenderLabelText(searchKey: string) {
|
||||
const {
|
||||
value: { searchMode },
|
||||
} = useConfigs()
|
||||
const { searchMode } = useConfigs().value
|
||||
return React.useCallback(
|
||||
(node: TreeNode) => searchModes[searchMode].renderNodeLabelText(node, searchKey),
|
||||
[searchKey, searchMode],
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@ export function useRenderFileStatus() {
|
|||
)
|
||||
)
|
||||
}
|
||||
const {
|
||||
value: { showDiffInText },
|
||||
} = useConfigs()
|
||||
const { showDiffInText } = useConfigs().value
|
||||
return React.useMemo(() => renderFileStatus, [])
|
||||
}
|
||||
|
||||
|
|
@ -50,9 +48,7 @@ export function useRenderFileCommentAmounts() {
|
|||
</span>
|
||||
) : null
|
||||
}
|
||||
const {
|
||||
value: { commentToggle },
|
||||
} = useConfigs()
|
||||
const { commentToggle } = useConfigs().value
|
||||
return React.useMemo(() => (commentToggle ? renderFileCommentAmounts : null), [])
|
||||
}
|
||||
|
||||
|
|
@ -74,9 +70,7 @@ export function useRenderFindInFolderButton(
|
|||
</button>
|
||||
) : null
|
||||
}
|
||||
const {
|
||||
value: { searchMode },
|
||||
} = useConfigs()
|
||||
const { searchMode } = useConfigs().value
|
||||
return React.useMemo(
|
||||
() => (searchMode === 'fuzzy' ? renderFindInFolderButton : null),
|
||||
[searchMode],
|
||||
|
|
|
|||
Loading…
Reference in a new issue