mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
refactor: move Props
This commit is contained in:
parent
8ed78e2a98
commit
570ab3915e
6 changed files with 24 additions and 21 deletions
|
|
@ -3,25 +3,15 @@ import { Node } from 'components/Node'
|
|||
import { SearchBar } from 'components/SearchBar'
|
||||
import { connect } from 'driver/connect'
|
||||
import { FileExplorerCore } from 'driver/core'
|
||||
import { ConnectorState } from 'driver/core/FileExplorer'
|
||||
import { ConnectorState, Props } from 'driver/core/FileExplorer'
|
||||
import * as React from 'react'
|
||||
import { FixedSizeList as List, ListChildComponentProps } from 'react-window'
|
||||
import { cx } from 'utils/cx'
|
||||
import { MetaData, TreeData } from 'utils/GitHubHelper'
|
||||
import { usePrevious } from 'utils/hooks'
|
||||
import { TreeNode, VisibleNodes } from 'utils/VisibleNodesGenerator'
|
||||
import { Icon } from './Icon'
|
||||
import { SizeObserver } from './SizeObserver'
|
||||
|
||||
export type Props = {
|
||||
treeData?: TreeData
|
||||
metaData: MetaData
|
||||
freeze: boolean
|
||||
compressSingletonFolder: boolean
|
||||
accessToken: string | undefined
|
||||
toggleShowSettings: React.MouseEventHandler
|
||||
}
|
||||
|
||||
class RawFileExplorer extends React.Component<Props & ConnectorState> {
|
||||
static defaultProps: Partial<Props & ConnectorState> = {
|
||||
freeze: false,
|
||||
|
|
@ -183,4 +173,4 @@ class RawFileExplorer extends React.Component<Props & ConnectorState> {
|
|||
}
|
||||
}
|
||||
|
||||
export const FileExplorer = connect<Props, ConnectorState>(FileExplorerCore)(RawFileExplorer)
|
||||
export const FileExplorer = connect(FileExplorerCore)(RawFileExplorer)
|
||||
|
|
|
|||
|
|
@ -6,12 +6,10 @@ import { SettingsBar } from 'components/SettingsBar'
|
|||
import { ToggleShowButton } from 'components/ToggleShowButton'
|
||||
import { connect } from 'driver/connect'
|
||||
import { SideBarCore } from 'driver/core'
|
||||
import { ConnectorState } from 'driver/core/SideBar'
|
||||
import { ConnectorState, Props } from 'driver/core/SideBar'
|
||||
import * as React from 'react'
|
||||
import { cx } from 'utils/cx'
|
||||
|
||||
export type Props = {}
|
||||
|
||||
class RawGitako extends React.PureComponent<Props & ConnectorState> {
|
||||
static defaultProps: Partial<Props & ConnectorState> = {
|
||||
baseSize: 260,
|
||||
|
|
@ -147,4 +145,4 @@ class RawGitako extends React.PureComponent<Props & ConnectorState> {
|
|||
}
|
||||
}
|
||||
|
||||
export const SideBar = connect<Props, ConnectorState>(SideBarCore)(RawGitako)
|
||||
export const SideBar = connect(SideBarCore)(RawGitako)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export type MethodCreator<Props, State, Args extends any[] = []> = (
|
|||
dispatch: Dispatch<Props, State>,
|
||||
) => Method<Args>
|
||||
|
||||
type Sources<P, S> = {
|
||||
export type Sources<P, S> = {
|
||||
[key: string]: MethodCreator<P, S, any>
|
||||
}
|
||||
type WrappedMethods = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { Props } from 'components/FileExplorer'
|
||||
import { GetCreatedMethod, MethodCreator } from 'driver/connect'
|
||||
import * as ini from 'ini'
|
||||
import { Base64 } from 'js-base64'
|
||||
|
|
@ -10,6 +9,15 @@ import * as treeParser from 'utils/treeParser'
|
|||
import * as URLHelper from 'utils/URLHelper'
|
||||
import { TreeNode, VisibleNodes, VisibleNodesGenerator } from 'utils/VisibleNodesGenerator'
|
||||
|
||||
export type Props = {
|
||||
treeData?: GitHubHelper.TreeData
|
||||
metaData: GitHubHelper.MetaData
|
||||
freeze: boolean
|
||||
compressSingletonFolder: boolean
|
||||
accessToken: string | undefined
|
||||
toggleShowSettings: React.MouseEventHandler
|
||||
}
|
||||
|
||||
export type ConnectorState = {
|
||||
stateText: string
|
||||
visibleNodes: VisibleNodes | null
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { Props } from 'components/SideBar'
|
||||
import { GetCreatedMethod, MethodCreator } from 'driver/connect'
|
||||
import * as configHelper from 'utils/configHelper'
|
||||
import { Config } from 'utils/configHelper'
|
||||
|
|
@ -8,6 +7,8 @@ import { MetaData, TreeData } from 'utils/GitHubHelper'
|
|||
import * as keyHelper from 'utils/keyHelper'
|
||||
import * as URLHelper from 'utils/URLHelper'
|
||||
|
||||
export type Props = {}
|
||||
|
||||
export type ConnectorState = {
|
||||
// error message
|
||||
error?: string
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
import { Sources } from 'driver/connect'
|
||||
import * as FileExplorer from './FileExplorer'
|
||||
import {
|
||||
ConnectorState as FileExplorerConnectorState,
|
||||
Props as FileExplorerProps,
|
||||
} from './FileExplorer'
|
||||
import * as SideBar from './SideBar'
|
||||
import { ConnectorState as SideBarConnectorState, Props as SideBarProps } from './SideBar'
|
||||
|
||||
export const SideBarCore = SideBar
|
||||
export const FileExplorerCore = FileExplorer
|
||||
export const FileExplorerCore: Sources<FileExplorerProps, FileExplorerConnectorState> = FileExplorer
|
||||
export const SideBarCore: Sources<SideBarProps, SideBarConnectorState> = SideBar
|
||||
|
|
|
|||
Loading…
Reference in a new issue