diff --git a/src/components/Clippy.tsx b/src/components/Clippy.tsx
index eacc560..2508ade 100644
--- a/src/components/Clippy.tsx
+++ b/src/components/Clippy.tsx
@@ -10,13 +10,13 @@ const className = 'clippy-wrapper'
export const ClippyClassName = className
export function Clippy({ codeSnippetElement }: Props) {
- const [status, setStatus] = React.useState<'normal' | 'success' | 'fail'>('normal')
+ const [state, setState] = React.useState<'normal' | 'success' | 'fail'>('normal')
React.useEffect(() => {
const timer = window.setTimeout(() => {
- setStatus('normal')
+ setState('normal')
}, 1000)
return () => window.clearTimeout(timer)
- }, [status])
+ }, [state])
// Temporary fix:
// React moved root node of event delegation since v17
@@ -26,7 +26,7 @@ export function Clippy({ codeSnippetElement }: Props) {
const element = elementRef.current
if (element) {
function onClippyClick() {
- setStatus(copyElementContent(codeSnippetElement) ? 'success' : 'fail')
+ setState(copyElementContent(codeSnippetElement) ? 'success' : 'fail')
}
element.addEventListener('click', onClippyClick)
return () => element.removeEventListener('click', onClippyClick)
@@ -36,7 +36,7 @@ export function Clippy({ codeSnippetElement }: Props) {
return (
)
diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx
index ab294b8..2e70fda 100644
--- a/src/components/SideBar.tsx
+++ b/src/components/SideBar.tsx
@@ -25,7 +25,7 @@ const RawGitako: React.FC = function RawGitako(props) {
const {
metaData,
treeData,
- status,
+ state,
defer,
error,
shouldShow,
@@ -59,7 +59,7 @@ const RawGitako: React.FC = function RawGitako(props) {
React.useEffect(
function attachKeyDown() {
- if (status === 'disabled' || !configContext.value.shortcut) return
+ if (state === 'disabled' || !configContext.value.shortcut) return
function onKeyDown(e: KeyboardEvent) {
const keys = keyHelper.parseEvent(e)
@@ -70,13 +70,13 @@ const RawGitako: React.FC = function RawGitako(props) {
window.addEventListener('keydown', onKeyDown)
return () => window.removeEventListener('keydown', onKeyDown)
},
- [toggleShowSideBar, status === 'disabled', configContext.value.shortcut],
+ [toggleShowSideBar, state === 'disabled', configContext.value.shortcut],
)
const intelligentToggle = configContext.value.intelligentToggle
// Hide sidebar when error due to auth but token is set #128
const hideSidebarOnInvalidToken: boolean =
- intelligentToggle === null && Boolean(status === 'error-due-to-auth' && accessToken)
+ intelligentToggle === null && Boolean(state === 'error-due-to-auth' && accessToken)
React.useEffect(() => {
if (hideSidebarOnInvalidToken) {
props.setShouldShow(false)
@@ -121,7 +121,7 @@ const RawGitako: React.FC = function RawGitako(props) {
{(() => {
- switch (status) {
+ switch (state) {
case 'loading-meta':
return
case 'loading-tree':
@@ -164,7 +164,7 @@ const RawGitako: React.FC
= function RawGitako(props) {
RawGitako.defaultProps = {
shouldShow: false,
showSettings: false,
- status: 'loading-meta',
+ state: 'loading-meta',
}
export const SideBar = connect(SideBarCore)(RawGitako)
diff --git a/src/driver/core/SideBar.ts b/src/driver/core/SideBar.ts
index 6417488..43b5c6d 100644
--- a/src/driver/core/SideBar.ts
+++ b/src/driver/core/SideBar.ts
@@ -19,7 +19,7 @@ export type ConnectorState = {
metaData?: MetaData
// file tree data
treeData?: TreeNode
- status: 'loading-meta' | 'loading-tree' | 'idle' | 'error-due-to-auth' | 'disabled'
+ state: 'loading-meta' | 'loading-tree' | 'idle' | 'error-due-to-auth' | 'disabled'
logoContainerElement: Element | null
defer?: boolean
} & {
@@ -37,10 +37,10 @@ export const init: BoundMethodCreator = dispatch => async () => {
const leave = await promiseQueue.enter()
try {
- dispatch.set({ status: 'loading-meta' })
+ dispatch.set({ state: 'loading-meta' })
const metaData = platform.resolveMeta()
if (!metaData) {
- dispatch.set({ status: 'disabled' })
+ dispatch.set({ state: 'disabled' })
return
}
const { userName, repoName, branchName } = metaData
@@ -113,9 +113,9 @@ export const init: BoundMethodCreator = dispatch => async () => {
}
}
- dispatch.set({ status: 'loading-tree' })
+ dispatch.set({ state: 'loading-tree' })
const { root: treeData, defer } = await getTreeData
- dispatch.set({ status: 'idle', treeData, defer })
+ dispatch.set({ state: 'idle', treeData, defer })
} catch (err) {
dispatch.call(handleError, err)
}
@@ -133,13 +133,13 @@ export const handleError: BoundMethodCreator<[Error]> = dispatch => async err =>
err.message === errors.BAD_CREDENTIALS ||
err.message === errors.API_RATE_LIMIT
) {
- dispatch.set({ status: 'error-due-to-auth' })
+ dispatch.set({ state: 'error-due-to-auth' })
} else if (err.message === errors.CONNECTION_BLOCKED) {
const { props } = dispatch.get()
if (props.configContext.value.accessToken) {
dispatch.call(setError, `Cannot connect to ${platformName}.`)
} else {
- dispatch.set({ status: 'error-due-to-auth' })
+ dispatch.set({ state: 'error-due-to-auth' })
}
} else if (err.message === errors.SERVER_FAULT) {
dispatch.call(setError, `${platformName} server went down.`)
diff --git a/src/utils/configHelper.ts b/src/utils/configHelper.ts
index 68ddd08..bbedd31 100644
--- a/src/utils/configHelper.ts
+++ b/src/utils/configHelper.ts
@@ -8,7 +8,7 @@ export type Config = {
compressSingletonFolder: boolean
copyFileButton: boolean
copySnippetButton: boolean
- intelligentToggle: boolean | null // `null` stands for intelligent, boolean for sidebar open status
+ intelligentToggle: boolean | null // `null` stands for intelligent, boolean for sidebar open state
icons: 'rich' | 'dim' | 'native'
toggleButtonVerticalDistance: number
toggleButtonContent: 'logo' | 'octoface'