-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into stylelint
- Loading branch information
Showing
115 changed files
with
2,489 additions
and
578 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+9 Bytes
(100%)
frontend/__snapshots__/lemon-ui-lemon-segmented-button--default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+9 Bytes
(100%)
frontend/__snapshots__/lemon-ui-lemon-segmented-button--full-width.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-25 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-historical-trends.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-104 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-time-to-convert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+460 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+481 Bytes
(100%)
...d/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-27 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+157 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15.5 KB
(120%)
frontend/__snapshots__/scenes-app-insights--retention--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+193 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--stickiness--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-266 Bytes
(100%)
frontend/__snapshots__/scenes-app-notebooks--recordings-playlist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.75 KB
(96%)
frontend/__snapshots__/scenes-app-surveys--new-survey-customisation-section.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.55 KB
(100%)
frontend/__snapshots__/scenes-app-surveys--survey-templates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useValues } from 'kea' | ||
|
||
import { actionBarLogic } from './actionBarLogic' | ||
|
||
import ActionInput from './ActionInput' | ||
import ActionResults from './ActionResults' | ||
|
||
const ActionBar = (): JSX.Element => { | ||
const { activeFlow } = useValues(actionBarLogic) | ||
|
||
return ( | ||
<div className="flex flex-col h-full"> | ||
{(!activeFlow || activeFlow.instruction) && <ActionInput />} | ||
{<ActionResults />} | ||
</div> | ||
) | ||
} | ||
|
||
export default ActionBar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react' | ||
import { useActions, useValues } from 'kea' | ||
|
||
import { LemonInput } from '@posthog/lemon-ui' | ||
import { KeyboardShortcut } from '~/layout/navigation-3000/components/KeyboardShortcut' | ||
|
||
import { actionBarLogic } from './actionBarLogic' | ||
import { IconChevronRight, IconEdit } from 'lib/lemon-ui/icons' | ||
import { CommandFlow } from 'lib/components/CommandPalette/commandPaletteLogic' | ||
|
||
type PrefixIconProps = { | ||
activeFlow: CommandFlow | null | ||
} | ||
const PrefixIcon = ({ activeFlow }: PrefixIconProps): React.ReactElement | null => { | ||
if (activeFlow) { | ||
return <activeFlow.icon className="palette__icon" /> ?? <IconEdit className="palette__icon" /> | ||
} else { | ||
return <IconChevronRight className="palette__icon" /> | ||
} | ||
} | ||
|
||
const ActionInput = (): JSX.Element => { | ||
const { input, activeFlow } = useValues(actionBarLogic) | ||
const { setInput } = useActions(actionBarLogic) | ||
|
||
return ( | ||
<div className="border-b"> | ||
<LemonInput | ||
size="small" | ||
className="CommandBar__input" | ||
fullWidth | ||
prefix={<PrefixIcon activeFlow={activeFlow} />} | ||
suffix={<KeyboardShortcut escape muted />} | ||
placeholder={activeFlow?.instruction ?? 'What would you like to do? Try some suggestions…'} | ||
autoFocus | ||
value={input} | ||
onChange={setInput} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export default ActionInput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { useEffect, useRef } from 'react' | ||
import { useActions } from 'kea' | ||
|
||
import { actionBarLogic } from './actionBarLogic' | ||
import { getNameFromActionScope } from './utils' | ||
import { CommandResultDisplayable } from '../CommandPalette/commandPaletteLogic' | ||
|
||
type SearchResultProps = { | ||
result: CommandResultDisplayable | ||
focused: boolean | ||
} | ||
|
||
const ActionResult = ({ result, focused }: SearchResultProps): JSX.Element => { | ||
const { executeResult, onMouseEnterResult, onMouseLeaveResult } = useActions(actionBarLogic) | ||
|
||
const ref = useRef<HTMLDivElement | null>(null) | ||
const isExecutable = !!result.executor | ||
|
||
useEffect(() => { | ||
if (focused) { | ||
ref.current?.scrollIntoView() | ||
} | ||
}, [focused]) | ||
|
||
return ( | ||
<div className={`border-l-4 ${isExecutable ? 'border-primary' : ''}`}> | ||
<div | ||
className={`w-full pl-3 pr-2 ${ | ||
focused ? 'bg-secondary-3000-hover' : 'bg-secondary-3000' | ||
} border-b cursor-pointer`} | ||
onMouseEnter={() => { | ||
onMouseEnterResult(result.index) | ||
}} | ||
onMouseLeave={() => { | ||
onMouseLeaveResult() | ||
}} | ||
onClick={() => { | ||
if (isExecutable) { | ||
executeResult(result) | ||
} | ||
}} | ||
ref={ref} | ||
> | ||
<div className="px-2 py-3 w-full space-y-0.5 flex flex-col items-start"> | ||
{result.source.scope && ( | ||
<span className="text-muted-3000 text-xs">{getNameFromActionScope(result.source.scope)}</span> | ||
)} | ||
<span className="text-text-3000">{result.display}</span> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default ActionResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { useValues } from 'kea' | ||
|
||
import { CommandResultDisplayable } from '../CommandPalette/commandPaletteLogic' | ||
|
||
import { actionBarLogic } from './actionBarLogic' | ||
import ActionResult from './ActionResult' | ||
import { getNameFromActionScope } from 'lib/components/CommandBar/utils' | ||
|
||
type ResultsGroupProps = { | ||
scope: string | ||
results: CommandResultDisplayable[] | ||
activeResultIndex: number | ||
} | ||
|
||
const ResultsGroup = ({ scope, results, activeResultIndex }: ResultsGroupProps): JSX.Element => { | ||
return ( | ||
<> | ||
<div className="border-b pl-3 pr-2 pt-1 pb-1 bg-bg-3000-light">{getNameFromActionScope(scope)}</div> | ||
{results.map((result) => ( | ||
<ActionResult | ||
key={`command_result_${result.index}`} | ||
result={result} | ||
focused={result.index === activeResultIndex} | ||
/> | ||
))} | ||
</> | ||
) | ||
} | ||
|
||
const ActionResults = (): JSX.Element => { | ||
const { commandSearchResultsGrouped, activeResultIndex } = useValues(actionBarLogic) | ||
|
||
return ( | ||
<div className="grow overscroll-none overflow-y-auto"> | ||
{commandSearchResultsGrouped.map(([scope, results]) => ( | ||
<ResultsGroup key={scope} scope={scope} results={results} activeResultIndex={activeResultIndex} /> | ||
))} | ||
</div> | ||
) | ||
} | ||
|
||
export default ActionResults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useRef } from 'react' | ||
import { useActions, useValues } from 'kea' | ||
|
||
import { useOutsideClickHandler } from 'lib/hooks/useOutsideClickHandler' | ||
|
||
import { commandBarLogic } from './commandBarLogic' | ||
import { BarStatus } from './types' | ||
|
||
import './index.scss' | ||
import SearchBar from './SearchBar' | ||
import { LemonModal } from '@posthog/lemon-ui' | ||
import ActionBar from './ActionBar' | ||
|
||
function CommandBar(): JSX.Element | null { | ||
const containerRef = useRef<HTMLDivElement | null>(null) | ||
const { barStatus } = useValues(commandBarLogic) | ||
const { hideCommandBar } = useActions(commandBarLogic) | ||
|
||
useOutsideClickHandler(containerRef, hideCommandBar, []) | ||
|
||
return ( | ||
<LemonModal isOpen={barStatus !== BarStatus.HIDDEN} simple closable={false} width={800}> | ||
<div className="w-full h-160 max-w-lg bg-bg-3000 rounded overflow-hidden flex flex-col" ref={containerRef}> | ||
{barStatus === BarStatus.SHOW_SEARCH ? <SearchBar /> : <ActionBar />} | ||
</div> | ||
</LemonModal> | ||
) | ||
} | ||
|
||
export default CommandBar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useMountedLogic } from 'kea' | ||
|
||
import { searchBarLogic } from './searchBarLogic' | ||
|
||
import SearchInput from './SearchInput' | ||
import SearchResults from './SearchResults' | ||
import SearchTabs from './SearchTabs' | ||
|
||
const SearchBar = (): JSX.Element => { | ||
useMountedLogic(searchBarLogic) // load initial results | ||
|
||
return ( | ||
<div className="flex flex-col h-full"> | ||
<SearchInput /> | ||
<SearchResults /> | ||
<SearchTabs /> | ||
</div> | ||
) | ||
} | ||
|
||
export default SearchBar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useActions } from 'kea' | ||
|
||
import { resultTypeToName } from './constants' | ||
import { searchBarLogic } from './searchBarLogic' | ||
import { ResultTypeWithAll } from './types' | ||
|
||
type SearchBarTabProps = { | ||
type: ResultTypeWithAll | ||
active: boolean | ||
count?: number | null | ||
} | ||
|
||
const SearchBarTab = ({ type, active, count }: SearchBarTabProps): JSX.Element => { | ||
const { setActiveTab } = useActions(searchBarLogic) | ||
return ( | ||
<div className={`px-3 py-2 cursor-pointer text-xs ${active && 'font-bold'}`} onClick={() => setActiveTab(type)}> | ||
{resultTypeToName[type]} | ||
{count != null && <span className="ml-1 text-xxs text-muted-3000">{count}</span>} | ||
</div> | ||
) | ||
} | ||
|
||
export default SearchBarTab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useActions, useValues } from 'kea' | ||
|
||
import { LemonInput } from '@posthog/lemon-ui' | ||
import { KeyboardShortcut } from '~/layout/navigation-3000/components/KeyboardShortcut' | ||
|
||
import { searchBarLogic } from './searchBarLogic' | ||
|
||
const SearchInput = (): JSX.Element => { | ||
const { searchQuery } = useValues(searchBarLogic) | ||
const { setSearchQuery } = useActions(searchBarLogic) | ||
|
||
return ( | ||
<div className="border-b"> | ||
<LemonInput | ||
type="search" | ||
size="small" | ||
className="CommandBar__input" | ||
fullWidth | ||
suffix={<KeyboardShortcut escape muted />} | ||
autoFocus | ||
value={searchQuery} | ||
onChange={setSearchQuery} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export default SearchInput |
Oops, something went wrong.