mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
parent
b908d7d29c
commit
fc3e19650d
3 changed files with 26 additions and 0 deletions
|
|
@ -264,3 +264,7 @@ export function getPath() {
|
|||
export function isNativePRFileTreeShown() {
|
||||
return $('file-tree[data-target="diff-layout.fileTree"]')
|
||||
}
|
||||
|
||||
export function selectEnterpriseStatHeader() {
|
||||
return $('.stats-ui-enabled .server-stats')
|
||||
}
|
||||
|
|
|
|||
20
src/platforms/GitHub/hooks/useEnterpriseStatBarStyleFix.ts
Normal file
20
src/platforms/GitHub/hooks/useEnterpriseStatBarStyleFix.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { useEffect } from 'react'
|
||||
import { $ } from 'utils/DOMHelper'
|
||||
import * as DOMHelper from '../DOMHelper'
|
||||
import { GitHub } from '../index'
|
||||
|
||||
// A dirty fix for putting Gitako components over GHE stat bar.
|
||||
// In normal cases the styles should be set via react render function return value,
|
||||
// but adding the logic for such uncommon case is not worth the maintenance cost.
|
||||
export function useEnterpriseStatBarStyleFix() {
|
||||
useEffect(() => {
|
||||
if (GitHub.isEnterprise()) {
|
||||
const enterpriseStatHeaderElement = DOMHelper.selectEnterpriseStatHeader()
|
||||
const zIndex = parseInt(enterpriseStatHeaderElement?.style.zIndex || '0', 10)
|
||||
if (!isNaN(zIndex) && zIndex) {
|
||||
$('.gitako-toggle-show-button-wrapper', e => (e.style.zIndex = `${zIndex + 1}`))
|
||||
$('.gitako-side-bar-body-wrapper', e => (e.style.zIndex = `${zIndex + 1}`))
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import { resolveGitModules } from 'utils/gitSubmodule'
|
|||
import { sortFoldersToFront } from 'utils/treeParser'
|
||||
import * as API from './API'
|
||||
import * as DOMHelper from './DOMHelper'
|
||||
import { useEnterpriseStatBarStyleFix } from './hooks/useEnterpriseStatBarStyleFix'
|
||||
import { useGitHubAttachCopyFileButton } from './hooks/useGitHubAttachCopyFileButton'
|
||||
import { useGitHubAttachCopySnippetButton } from './hooks/useGitHubAttachCopySnippetButton'
|
||||
import { useGitHubCodeFold } from './hooks/useGitHubCodeFold'
|
||||
|
|
@ -202,6 +203,7 @@ export const GitHub: Platform = {
|
|||
useGitHubAttachCopyFileButton(copyFileButton)
|
||||
useGitHubAttachCopySnippetButton(copySnippetButton)
|
||||
useGitHubCodeFold(codeFolding)
|
||||
useEnterpriseStatBarStyleFix()
|
||||
},
|
||||
delegatePJAXProps(options) {
|
||||
if (!options?.node || options.node.type === 'blob')
|
||||
|
|
|
|||
Loading…
Reference in a new issue