mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: align sidebar trigger with nav bar
This commit is contained in:
parent
609b7b9b3f
commit
0c9acf7a18
2 changed files with 40 additions and 1 deletions
|
|
@ -64,7 +64,7 @@ export const getDefaultConfigs: () => Config = () => ({
|
|||
copySnippetButton: !isInGitHub, // disable on github.com
|
||||
intelligentToggle: null,
|
||||
icons: 'rich',
|
||||
toggleButtonVerticalDistance: 124, // align with GitHub's navbar items
|
||||
toggleButtonVerticalDistance: 64, // align with GitHub's navbar items
|
||||
recursiveToggleFolder: 'shift',
|
||||
searchMode: 'fuzzy',
|
||||
sidebarToggleMode: 'float',
|
||||
|
|
|
|||
39
src/utils/config/migrations/3.13.1.ts
Normal file
39
src/utils/config/migrations/3.13.1.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { storageHelper } from 'utils/storageHelper'
|
||||
import { Migration, onConfigOutdated } from '.'
|
||||
|
||||
export const migration: Migration = {
|
||||
version: '3.13.1',
|
||||
async migrate(version) {
|
||||
// disable copy snippet button for github.com
|
||||
type ConfigBeforeMigrate = {
|
||||
toggleButtonVerticalDistance: number
|
||||
}
|
||||
type ConfigAfterMigrate = {
|
||||
toggleButtonVerticalDistance: number
|
||||
}
|
||||
|
||||
await onConfigOutdated(version, async configs => {
|
||||
const key = 'platform_github.com'
|
||||
const config = configs[key]
|
||||
if (
|
||||
typeof config === 'object' &&
|
||||
config !== null &&
|
||||
'toggleButtonVerticalDistance' in config
|
||||
) {
|
||||
const configBeforeMigrate = config as ConfigBeforeMigrate
|
||||
const { toggleButtonVerticalDistance, ...rest } = configBeforeMigrate
|
||||
const previousDefaultToggleButtonVerticalDistance = 124
|
||||
const newDefaultToggleButtonVerticalDistance = 64
|
||||
if (toggleButtonVerticalDistance === previousDefaultToggleButtonVerticalDistance) {
|
||||
const configAfterMigrate: ConfigAfterMigrate = {
|
||||
...rest,
|
||||
toggleButtonVerticalDistance: newDefaultToggleButtonVerticalDistance,
|
||||
}
|
||||
await storageHelper.set({
|
||||
[key]: configAfterMigrate,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
Loading…
Reference in a new issue