-
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 update-preview
- Loading branch information
Showing
36 changed files
with
448 additions
and
200 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
Binary file modified
BIN
+2.62 KB
(100%)
frontend/__snapshots__/scenes-app-events--event-explorer--dark.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.51 KB
(100%)
frontend/__snapshots__/scenes-app-events--event-explorer--light.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
+19 Bytes
(100%)
...insights-error-empty-states--estimated-query-execution-time-too-long--light.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
-1.07 KB
(99%)
frontend/__snapshots__/scenes-app-sidepanels--side-panel-activation--dark.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
-122 Bytes
(100%)
frontend/__snapshots__/scenes-app-sidepanels--side-panel-activation--light.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
58 changes: 0 additions & 58 deletions
58
frontend/src/layout/navigation-3000/sidepanel/panels/SidePanelActivation.tsx
This file was deleted.
Oops, something went wrong.
123 changes: 123 additions & 0 deletions
123
frontend/src/layout/navigation-3000/sidepanel/panels/activation/SidePanelActivation.tsx
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,123 @@ | ||
import { LemonButton, LemonButtonWithSideActionProps } from '@posthog/lemon-ui' | ||
import { useActions, useValues } from 'kea' | ||
import { ProfessorHog } from 'lib/components/hedgehogs' | ||
import { IconCheckmark, IconClose, LemonIconProps } from 'lib/lemon-ui/icons' | ||
import { LemonProgressCircle } from 'lib/lemon-ui/LemonProgressCircle' | ||
import { eventUsageLogic } from 'lib/utils/eventUsageLogic' | ||
|
||
import { | ||
activationLogic, | ||
ActivationTaskType, | ||
} from '~/layout/navigation-3000/sidepanel/panels/activation/activationLogic' | ||
|
||
import { SidePanelPaneHeader } from '../../components/SidePanelPaneHeader' | ||
|
||
export const SidePanelActivation = (): JSX.Element => { | ||
const { activeTasks, completionPercent, completedTasks } = useValues(activationLogic) | ||
|
||
return ( | ||
<> | ||
<SidePanelPaneHeader title="Quick start" /> | ||
<div className="p-4 space-y-2 overflow-y-auto"> | ||
<p>Use our Quick Start guide to learn about everything PostHog can do for you and your product.</p> | ||
<div className="flex items-center justify-center"> | ||
<div className="flex flex-col items-center"> | ||
<LemonProgressCircle progress={completionPercent / 100} size={100} className="text-primary"> | ||
<span className="text-2xl">{activeTasks.length}</span> | ||
</LemonProgressCircle> | ||
<p className="text-muted mt-2 ">still to go</p> | ||
</div> | ||
<div className="h-60"> | ||
<ProfessorHog className="max-h-full w-auto object-contain" /> | ||
</div> | ||
</div> | ||
{activeTasks.length > 0 && ( | ||
<div> | ||
<h4>What's next?</h4> | ||
<ul className="space-y-2"> | ||
{activeTasks.map((task: ActivationTaskType) => ( | ||
<ActivationTask key={task.id} {...task} /> | ||
))} | ||
</ul> | ||
</div> | ||
)} | ||
{completedTasks.length > 0 && ( | ||
<div> | ||
<h4>Completed</h4> | ||
<ul className="space-y-2"> | ||
{completedTasks.map((task: ActivationTaskType) => ( | ||
<ActivationTask key={task.id} {...task} /> | ||
))} | ||
</ul> | ||
</div> | ||
)} | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export const SidePanelActivationIcon = ({ className }: { className: LemonIconProps['className'] }): JSX.Element => { | ||
const { activeTasks, completionPercent } = useValues(activationLogic) | ||
|
||
return ( | ||
<LemonProgressCircle progress={completionPercent / 100} strokePercentage={0.15} size={20} className={className}> | ||
<span className="text-xs font-semibold">{activeTasks.length}</span> | ||
</LemonProgressCircle> | ||
) | ||
} | ||
|
||
const ActivationTask = ({ | ||
id, | ||
name, | ||
description, | ||
completed, | ||
canSkip, | ||
skipped, | ||
url, | ||
}: ActivationTaskType): JSX.Element => { | ||
const displaySideAction = !completed && !skipped && canSkip | ||
const { runTask, skipTask } = useActions(activationLogic) | ||
const { reportActivationSideBarTaskClicked } = useActions(eventUsageLogic) | ||
|
||
const content = ( | ||
<div className="my-4 mx-2"> | ||
<p className="m-0">{name}</p> | ||
{!completed && !skipped && <p className="font-normal text-xs mt-2 mb-0 mx-0">{description}</p>} | ||
</div> | ||
) | ||
|
||
const params: Partial<LemonButtonWithSideActionProps> = { | ||
id, | ||
fullWidth: true, | ||
type: 'secondary', | ||
icon: completed ? <IconCheckmark /> : skipped ? <IconClose /> : null, | ||
tooltip: name, | ||
} | ||
if (url) { | ||
params.to = url | ||
params.targetBlank = true | ||
} else { | ||
params.onClick = () => { | ||
runTask(id) | ||
reportActivationSideBarTaskClicked(id) | ||
} | ||
} | ||
return ( | ||
<li> | ||
{displaySideAction ? ( | ||
<LemonButton | ||
{...params} | ||
sideAction={{ | ||
icon: <IconClose />, | ||
tooltip: 'Skip task', | ||
onClick: () => skipTask(id), | ||
}} | ||
> | ||
{content} | ||
</LemonButton> | ||
) : ( | ||
<LemonButton {...params}>{content}</LemonButton> | ||
)} | ||
</li> | ||
) | ||
} |
File renamed without changes.
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
2 changes: 1 addition & 1 deletion
2
frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx
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
62 changes: 0 additions & 62 deletions
62
frontend/src/lib/components/ActivationSidebar/ActivationSidebar.tsx
This file was deleted.
Oops, something went wrong.
77 changes: 77 additions & 0 deletions
77
frontend/src/queries/nodes/DataNode/TestAccountFilters.tsx
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,77 @@ | ||
import { useActions, useValues } from 'kea' | ||
import { IconSettings } from 'lib/lemon-ui/icons' | ||
import { LemonButton } from 'lib/lemon-ui/LemonButton' | ||
import { LemonSwitch } from 'lib/lemon-ui/LemonSwitch' | ||
import { filterTestAccountsDefaultsLogic } from 'scenes/settings/project/filterTestAccountDefaultsLogic' | ||
import { teamLogic } from 'scenes/teamLogic' | ||
import { urls } from 'scenes/urls' | ||
|
||
import { DataNode, EventsQuery, HogQLQuery } from '~/queries/schema' | ||
import { isEventsQuery, isHogQLQuery } from '~/queries/utils' | ||
|
||
interface TestAccountFiltersProps { | ||
query: DataNode | ||
setQuery?: (query: EventsQuery | HogQLQuery) => void | ||
} | ||
export function TestAccountFilters({ query, setQuery }: TestAccountFiltersProps): JSX.Element | null { | ||
const { currentTeam } = useValues(teamLogic) | ||
const hasFilters = (currentTeam?.test_account_filters || []).length > 0 | ||
const { setLocalDefault } = useActions(filterTestAccountsDefaultsLogic) | ||
|
||
if (!isEventsQuery(query) && !isHogQLQuery(query)) { | ||
return null | ||
} | ||
const checked = hasFilters | ||
? !!(isHogQLQuery(query) | ||
? query.filters?.filterTestAccounts | ||
: isEventsQuery(query) | ||
? query.filterTestAccounts | ||
: false) | ||
: false | ||
const onChange = isHogQLQuery(query) | ||
? (checked: boolean) => { | ||
const newQuery: HogQLQuery = { | ||
...query, | ||
filters: { | ||
...query.filters, | ||
filterTestAccounts: checked, | ||
}, | ||
} | ||
setQuery?.(newQuery) | ||
} | ||
: isEventsQuery(query) | ||
? (checked: boolean) => { | ||
const newQuery: EventsQuery = { | ||
...query, | ||
filterTestAccounts: checked, | ||
} | ||
setQuery?.(newQuery) | ||
} | ||
: undefined | ||
|
||
return ( | ||
<LemonSwitch | ||
checked={checked} | ||
onChange={(checked: boolean) => { | ||
onChange?.(checked) | ||
setLocalDefault(checked) | ||
}} | ||
id="test-account-filter" | ||
bordered | ||
label={ | ||
<div className="flex items-center"> | ||
<span>Filter out internal and test users</span> | ||
<LemonButton | ||
icon={<IconSettings />} | ||
to={urls.settings('project-product-analytics', 'internal-user-filtering')} | ||
size="small" | ||
noPadding | ||
className="ml-1" | ||
/> | ||
</div> | ||
} | ||
disabledReason={!hasFilters ? "You haven't set any internal and test filters" : null} | ||
/> | ||
) | ||
return null | ||
} |
Oops, something went wrong.