mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 04:12:23 +01:00
feat(commands): add hedgehog toggle command (#19019)
This commit is contained in:
parent
ffeddd9e55
commit
519415c42b
Binary file not shown.
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 144 KiB |
@ -45,6 +45,7 @@ import { actions, connect, events, kea, listeners, path, reducers, selectors } f
|
||||
import { router } from 'kea-router'
|
||||
import api from 'lib/api'
|
||||
import { FEATURE_FLAGS } from 'lib/constants'
|
||||
import { IconFlare } from 'lib/lemon-ui/icons'
|
||||
import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
|
||||
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
|
||||
import { isMobile, isURL, uniqueBy } from 'lib/utils'
|
||||
@ -63,6 +64,7 @@ import { dashboardsModel } from '~/models/dashboardsModel'
|
||||
import { DashboardType, InsightType } from '~/types'
|
||||
|
||||
import { personalAPIKeysLogic } from '../../../scenes/settings/user/personalAPIKeysLogic'
|
||||
import { hedgehogbuddyLogic } from '../HedgehogBuddy/hedgehogbuddyLogic'
|
||||
import type { commandPaletteLogicType } from './commandPaletteLogicType'
|
||||
import { openCHQueriesDebugModal } from './DebugCHQueries'
|
||||
|
||||
@ -134,8 +136,26 @@ function resolveCommand(source: Command | CommandFlow, argument?: string, prefix
|
||||
export const commandPaletteLogic = kea<commandPaletteLogicType>([
|
||||
path(['lib', 'components', 'CommandPalette', 'commandPaletteLogic']),
|
||||
connect({
|
||||
actions: [personalAPIKeysLogic, ['createKey'], router, ['push'], themeLogic, ['overrideTheme']],
|
||||
values: [teamLogic, ['currentTeam'], userLogic, ['user'], featureFlagLogic, ['featureFlags']],
|
||||
actions: [
|
||||
personalAPIKeysLogic,
|
||||
['createKey'],
|
||||
router,
|
||||
['push'],
|
||||
themeLogic,
|
||||
['overrideTheme'],
|
||||
hedgehogbuddyLogic,
|
||||
['setHedgehogModeEnabled'],
|
||||
],
|
||||
values: [
|
||||
teamLogic,
|
||||
['currentTeam'],
|
||||
userLogic,
|
||||
['user'],
|
||||
featureFlagLogic,
|
||||
['featureFlags'],
|
||||
hedgehogbuddyLogic,
|
||||
['hedgehogModeEnabled'],
|
||||
],
|
||||
logic: [preflightLogic],
|
||||
}),
|
||||
actions({
|
||||
@ -903,6 +923,19 @@ export const commandPaletteLogic = kea<commandPaletteLogicType>([
|
||||
},
|
||||
}
|
||||
|
||||
const toggleHedgehogMode: Command = {
|
||||
key: 'toggle-hedgehog-mode',
|
||||
scope: GLOBAL_COMMAND_SCOPE,
|
||||
resolver: {
|
||||
icon: IconFlare,
|
||||
display: `${values.hedgehogModeEnabled ? 'Disable' : 'Enable'} hedgehog mode`,
|
||||
synonyms: ['buddy', 'toggle', 'max'],
|
||||
executor: () => {
|
||||
actions.setHedgehogModeEnabled(!values.hedgehogModeEnabled)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
actions.registerCommand(goTo)
|
||||
actions.registerCommand(openUrls)
|
||||
actions.registerCommand(debugClickhouseQueries)
|
||||
@ -913,6 +946,7 @@ export const commandPaletteLogic = kea<commandPaletteLogicType>([
|
||||
actions.registerCommand(debugCopySessionRecordingURL)
|
||||
if (values.featureFlags[FEATURE_FLAGS.POSTHOG_3000]) {
|
||||
actions.registerCommand(toggleTheme)
|
||||
actions.registerCommand(toggleHedgehogMode)
|
||||
}
|
||||
},
|
||||
beforeUnmount: () => {
|
||||
@ -925,6 +959,7 @@ export const commandPaletteLogic = kea<commandPaletteLogicType>([
|
||||
actions.deregisterCommand('share-feedback')
|
||||
actions.deregisterCommand('debug-copy-session-recording-url')
|
||||
actions.deregisterCommand('toggle-theme')
|
||||
actions.deregisterCommand('toggle-hedgehog-mode')
|
||||
},
|
||||
})),
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user