diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx index dd8a0a11f120e..e3102f59b9b73 100644 --- a/frontend/src/lib/constants.tsx +++ b/frontend/src/lib/constants.tsx @@ -232,4 +232,5 @@ export const WEBHOOK_SERVICES: Record = { export const FEATURE_FLAGS: Record = { INGESTION_GRID: 'ingestion-grid-exp-3', PROJECT_HOME: 'project-home-exp-5', + QUERY_UX_V2: '4050-query-ui-optB', } diff --git a/frontend/src/scenes/dashboard/DashboardItem.tsx b/frontend/src/scenes/dashboard/DashboardItem.tsx index 5a9b3d93afe1b..290e9416b8661 100644 --- a/frontend/src/scenes/dashboard/DashboardItem.tsx +++ b/frontend/src/scenes/dashboard/DashboardItem.tsx @@ -128,12 +128,8 @@ export const displayMap: Record = { link: ({ id, dashboard, name, filters }: DashboardItemType): string => { return combineUrl( `/insights`, - { - insight: ViewType.FUNNELS, - fromDashboardItem: { id: id, name: name, dashboard: dashboard }, - ...filters, - }, - {} + { insight: ViewType.FUNNELS, ...filters }, + { fromItem: id, fromItemName: name, fromDashboard: dashboard } ).url }, }, diff --git a/frontend/src/scenes/insights/ActionFilter/ActionFilter.scss b/frontend/src/scenes/insights/ActionFilter/ActionFilter.scss index 2f88fb70464b6..b96bdc6053914 100644 --- a/frontend/src/scenes/insights/ActionFilter/ActionFilter.scss +++ b/frontend/src/scenes/insights/ActionFilter/ActionFilter.scss @@ -17,3 +17,12 @@ margin-top: 0; } } + +.add-action-event-button { + &.new-ui { + border-color: $border_dark; + color: $primary; + padding-left: $default_spacing * 2.5; + padding-right: $default_spacing * 2.5; + } +} diff --git a/frontend/src/scenes/insights/ActionFilter/ActionFilter.tsx b/frontend/src/scenes/insights/ActionFilter/ActionFilter.tsx index 4800e2911c80e..b1f89e6b80ac0 100644 --- a/frontend/src/scenes/insights/ActionFilter/ActionFilter.tsx +++ b/frontend/src/scenes/insights/ActionFilter/ActionFilter.tsx @@ -9,6 +9,8 @@ import { alphabet } from 'lib/utils' import posthog from 'posthog-js' import { ActionFilter as ActionFilterType, FilterType, Optional } from '~/types' import { SortableContainer, SortableActionFilterRow } from './Sortable' +import { featureFlagLogic } from 'lib/logic/featureFlagLogic' +import { FEATURE_FLAGS } from 'lib/constants' export interface ActionFilterProps { setFilters: (filters: FilterType) => void @@ -41,6 +43,8 @@ export function ActionFilter({ }: ActionFilterProps): JSX.Element { const logic = entityFilterLogic({ setFilters, filters, typeKey }) + const { featureFlags } = useValues(featureFlagLogic) + const { localFilters } = useValues(logic) const { addFilter, setLocalFilters } = useActions(logic) @@ -101,12 +105,13 @@ export function ActionFilter({ {!singleFilter && (
diff --git a/frontend/src/scenes/insights/InsightTabs/FunnelTab/FunnelTab.tsx b/frontend/src/scenes/insights/InsightTabs/FunnelTab/FunnelTab.tsx index be2bf647fc2d2..030ca99deca38 100644 --- a/frontend/src/scenes/insights/InsightTabs/FunnelTab/FunnelTab.tsx +++ b/frontend/src/scenes/insights/InsightTabs/FunnelTab/FunnelTab.tsx @@ -11,8 +11,14 @@ import { useState } from 'react' import { SaveModal } from '../../SaveModal' import { funnelCommandLogic } from './funnelCommandLogic' import { TestAccountFilter } from 'scenes/insights/TestAccountFilter' +import { BaseTabProps } from 'scenes/insights/Insights' +import { InsightTitle } from '../InsightTitle' -export function FunnelTab(): JSX.Element { +interface FunnelTabProps extends BaseTabProps { + newUI: boolean +} + +export function FunnelTab({ annotationsToCreate, newUI }: FunnelTabProps): JSX.Element { useMountedLogic(funnelCommandLogic) const { isStepsEmpty, filters, stepsWithCount } = useValues(funnelLogic()) const { loadResults, clearFunnel, setFilters, saveFunnelInsight } = useActions(funnelLogic()) @@ -28,6 +34,11 @@ export function FunnelTab(): JSX.Element { return (
+ {newUI && ( + + + + )}
{ e.preventDefault() diff --git a/frontend/src/scenes/insights/InsightTabs/InsightTitle.tsx b/frontend/src/scenes/insights/InsightTabs/InsightTitle.tsx new file mode 100644 index 0000000000000..87a7fea840e44 --- /dev/null +++ b/frontend/src/scenes/insights/InsightTabs/InsightTitle.tsx @@ -0,0 +1,37 @@ +import { Button } from 'antd' +import { SaveToDashboard } from 'lib/components/SaveToDashboard/SaveToDashboard' +import React, { useState } from 'react' +import { SaveOutlined, DashboardOutlined } from '@ant-design/icons' +import { FilterType } from '~/types' +import { router } from 'kea-router' + +export interface InsightTitleProps { + filters: FilterType + annotations: any[] // TODO: Type properly +} + +export function InsightTitle({ annotations, filters }: InsightTitleProps): JSX.Element { + const [{ fromItemName, fromDashboard }] = useState(router.values.hashParams) + return ( + <> +

+ {fromDashboard && ( + + )} + {fromItemName || 'Unsaved query'}{' '} + } />} + item={{ + entity: { + filters, + annotations, + }, + }} + /> +

+ + ) +} diff --git a/frontend/src/scenes/insights/InsightTabs/PathTab.tsx b/frontend/src/scenes/insights/InsightTabs/PathTab.tsx index 8ed176826618c..c32185ef7eb3c 100644 --- a/frontend/src/scenes/insights/InsightTabs/PathTab.tsx +++ b/frontend/src/scenes/insights/InsightTabs/PathTab.tsx @@ -15,10 +15,12 @@ import { TestAccountFilter } from '../TestAccountFilter' import { eventDefinitionsLogic } from 'scenes/events/eventDefinitionsLogic' import { featureFlagLogic } from 'lib/logic/featureFlagLogic' import { PathTabHorizontal } from './PathTabHorizontal' +import { FEATURE_FLAGS } from 'lib/constants' +import { BaseTabProps } from '../Insights' -export function PathTab(): JSX.Element { +export function PathTab(props: BaseTabProps): JSX.Element { const { featureFlags } = useValues(featureFlagLogic) - return featureFlags['4050-query-ui-optB'] ? : + return featureFlags[FEATURE_FLAGS.QUERY_UX_V2] ? : } function DefaultPathTab(): JSX.Element { diff --git a/frontend/src/scenes/insights/InsightTabs/PathTabHorizontal.tsx b/frontend/src/scenes/insights/InsightTabs/PathTabHorizontal.tsx index 2383538d83c4e..28377d7da73ef 100644 --- a/frontend/src/scenes/insights/InsightTabs/PathTabHorizontal.tsx +++ b/frontend/src/scenes/insights/InsightTabs/PathTabHorizontal.tsx @@ -14,8 +14,10 @@ import { PropertyValue } from 'lib/components/PropertyFilters' import { TestAccountFilter } from '../TestAccountFilter' import { eventDefinitionsLogic } from 'scenes/events/eventDefinitionsLogic' import useBreakpoint from 'antd/lib/grid/hooks/useBreakpoint' +import { BaseTabProps } from '../Insights' +import { InsightTitle } from './InsightTitle' -export function PathTabHorizontal(): JSX.Element { +export function PathTabHorizontal({ annotationsToCreate }: BaseTabProps): JSX.Element { const { customEventNames } = useValues(eventDefinitionsLogic) const { filter, filtersLoading } = useValues(pathsLogic({ dashboardItemId: null })) const { setFilter } = useActions(pathsLogic({ dashboardItemId: null })) @@ -26,6 +28,9 @@ export function PathTabHorizontal(): JSX.Element { return ( + + + Showing paths from diff --git a/frontend/src/scenes/insights/InsightTabs/RetentionTab.scss b/frontend/src/scenes/insights/InsightTabs/RetentionTab.scss index a213eebfdc734..8fa6b6b1de5bb 100644 --- a/frontend/src/scenes/insights/InsightTabs/RetentionTab.scss +++ b/frontend/src/scenes/insights/InsightTabs/RetentionTab.scss @@ -1,13 +1,16 @@ @import '~/vars'; .retention-tab { - .ant-btn { + .btn-retention-dropdown { display: flex; } - .svg-fix { + .dropdown-indicator { color: $text_muted; padding-left: 4px; + margin-top: 2px; + color: #bdbdbd; + margin-right: -6px; svg { height: 10px; width: 10px; diff --git a/frontend/src/scenes/insights/InsightTabs/RetentionTab.tsx b/frontend/src/scenes/insights/InsightTabs/RetentionTab.tsx index 80a11f5283a0e..554a84e062804 100644 --- a/frontend/src/scenes/insights/InsightTabs/RetentionTab.tsx +++ b/frontend/src/scenes/insights/InsightTabs/RetentionTab.tsx @@ -23,12 +23,14 @@ import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo' import './RetentionTab.scss' import { featureFlagLogic } from 'lib/logic/featureFlagLogic' import { RetentionTabHorizontal } from './RetentionTabHorizontal' +import { FEATURE_FLAGS } from 'lib/constants' +import { BaseTabProps } from '../Insights' const DatePicker = generatePicker(dayjsGenerateConfig) -export function RetentionTab(): JSX.Element { +export function RetentionTab(props: BaseTabProps): JSX.Element { const { featureFlags } = useValues(featureFlagLogic) - return featureFlags['4050-query-ui-optB'] ? : + return featureFlags[FEATURE_FLAGS.QUERY_UX_V2] ? : } function DefaultRetentionTab(): JSX.Element { @@ -99,9 +101,10 @@ function DefaultRetentionTab(): JSX.Element { data-attr="retention-action" onClick={(): void => setOpen(!open)} style={{ marginRight: 8, marginBottom: 8 }} + className="btn-retention-dropdown" > - +