mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
refactor: drop shrink GitHub header
This commit is contained in:
parent
f38d093147
commit
1588a903c2
3 changed files with 1 additions and 27 deletions
|
|
@ -9,11 +9,7 @@ import { connect } from 'driver/connect'
|
|||
import { SideBarCore } from 'driver/core'
|
||||
import { ConnectorState, Props } from 'driver/core/SideBar'
|
||||
import { platform } from 'platforms'
|
||||
import {
|
||||
GitHub,
|
||||
useGitHubAttachCopyFileButton,
|
||||
useGitHubAttachCopySnippetButton,
|
||||
} from 'platforms/GitHub'
|
||||
import { useGitHubAttachCopyFileButton, useGitHubAttachCopySnippetButton } from 'platforms/GitHub'
|
||||
import * as React from 'react'
|
||||
import { cx } from 'utils/cx'
|
||||
import { parseURLSearch, run } from 'utils/general'
|
||||
|
|
@ -42,8 +38,6 @@ const RawGitako: React.FC<Props & ConnectorState> = function RawGitako(props) {
|
|||
const accessToken = configContext.value.accessToken || ''
|
||||
const [baseSize] = React.useState(() => configContext.value.sideBarWidth)
|
||||
|
||||
useShrinkGitHubHeader(configContext.value.shrinkGitHubHeader)
|
||||
|
||||
React.useEffect(() => {
|
||||
run(async function () {
|
||||
if (!accessToken) {
|
||||
|
|
@ -156,19 +150,6 @@ RawGitako.defaultProps = {
|
|||
|
||||
export const SideBar = connect(SideBarCore)(RawGitako)
|
||||
|
||||
function useShrinkGitHubHeader(shrinkGitHubHeader: boolean) {
|
||||
React.useEffect(() => {
|
||||
if (platform === GitHub) {
|
||||
const target = document.body
|
||||
if (shrinkGitHubHeader) {
|
||||
target.classList.add('shrink-github-header')
|
||||
} else {
|
||||
target.classList.remove('shrink-github-header')
|
||||
}
|
||||
}
|
||||
}, [shrinkGitHubHeader])
|
||||
}
|
||||
|
||||
async function trySetUpAccessTokenWithCode() {
|
||||
const search = parseURLSearch()
|
||||
if ('code' in search) {
|
||||
|
|
|
|||
|
|
@ -45,10 +45,6 @@ function SettingsBarContent() {
|
|||
wikiLink: wikiLinks.copySnippet,
|
||||
tooltip: `Read more in Gitako's Wiki`,
|
||||
},
|
||||
{
|
||||
key: 'shrinkGitHubHeader',
|
||||
label: 'Shrink GitHub header(experimental)',
|
||||
},
|
||||
]
|
||||
: []
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ export type Config = {
|
|||
toggleButtonVerticalDistance: number
|
||||
toggleButtonContent: 'logo' | 'octoface'
|
||||
recursiveToggleFolder: 'shift' | 'alt'
|
||||
shrinkGitHubHeader: boolean
|
||||
searchMode: SearchMode
|
||||
}
|
||||
|
||||
|
|
@ -29,7 +28,6 @@ enum configKeys {
|
|||
toggleButtonVerticalDistance = 'toggleButtonVerticalDistance',
|
||||
toggleButtonContent = 'toggleButtonContent',
|
||||
recursiveToggleFolder = 'recursiveToggleFolder',
|
||||
shrinkGitHubHeader = 'shrinkGitHubHeader',
|
||||
searchMode = 'searchMode',
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +43,6 @@ const defaultConfigs: Config = {
|
|||
toggleButtonVerticalDistance: 124, // align with GitHub's navbar items
|
||||
toggleButtonContent: 'logo',
|
||||
recursiveToggleFolder: 'shift',
|
||||
shrinkGitHubHeader: false,
|
||||
searchMode: 'fuzzy',
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue