Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Redesign panel tabs as buttons

Blue Mousedb13f0840414
diff --git a/web/app/pages/Project/View/Panels.tsx b/web/app/pages/Project/View/Panels.tsx
index 2a7c00cd7..487a08076 100644
--- a/web/app/pages/Project/View/Panels.tsx
+++ b/web/app/pages/Project/View/Panels.tsx
@@ -18,7 +18,6 @@ import _sum from 'lodash/sum'
import _toPairs from 'lodash/toPairs'
import {
FunnelIcon,
- ScanIcon,
CaretUpIcon,
CaretDownIcon,
CaretRightIcon,
@@ -67,6 +66,12 @@ import { nFormatter, getLocaleDisplayName } from '~/utils/generic'
import countries from '~/utils/isoCountries'
import { MainChart } from './components/MainChart'
+import {
+ PanelHeader,
+ panelControlClasses,
+ type PanelHeaderProps,
+} from './components/PanelHeader'
+import { MetadataPicker } from './components/MetadataPicker'
import { V2Filter } from '~/api/v2/types'
import { Customs } from './interfaces/traffic'
import { RefetchIndicator } from './v2/loading'
@@ -88,8 +93,6 @@ const UTM_TRACKING_PANEL_IDS = new Set([
'utm_term',
'utm_content',
])
-const PANEL_HEADER_ACTIONS_CLASS =
- 'panel-header-actions flex min-w-0 max-w-full items-center gap-2.5 overflow-x-auto overflow-y-hidden pb-0.5 scrollbar-thin'
const PANEL_EMPTY_STATE_DOCS = {
customEvents: 'https://swetrix.com/docs/swetrix-js-reference#track',
customEventMetadata: 'https://swetrix.com/docs/swetrix-js-reference#track',
@@ -112,13 +115,6 @@ const panelBarStyle = (pct: number) =>
'--panel-bar-scale': Math.max(0, Math.min(100, pct)) / 100,
}) as React.CSSProperties
-const PanelTabUnderline = () => (
- <span
- aria-hidden
- className='absolute inset-x-0 -bottom-0.5 h-0.5 bg-slate-900 dark:bg-gray-50'
- />
-)
-
const getDocsEmptyStateVariant = (
id: string,
activeTab: keyof typeof PROJECT_TABS,
@@ -201,43 +197,26 @@ const PanelDocsEmptyState = ({
)
}
-interface PanelContainerProps {
- name: React.ReactNode
+interface PanelContainerProps extends PanelHeaderProps {
children?: React.ReactNode
icon?: React.ReactNode
type: string
hideHeader?: boolean
- tooltip?: React.ReactNode
contentClassName?: string
- tabs?: Array<
- | {
- id: string
- label: string
- }
- | Array<{
- id: string
- label: string
- }>
- >
- onTabChange?: (tab: string) => void
- activeTabId?: string
- onDetailsClick?: () => void
- /** Renders the details button in a disabled state, keeping the panel height stable while there is nothing to drill into. */
- detailsDisabled?: boolean
- dropdownPlaceholder?: string
+ headerContent?: React.ReactNode
isRefetching?: boolean
- /** Replaces the panel body with a centered spinner, keeping the panel at its usual height. */
isLoading?: boolean
}
const PanelContainer = ({
name,
children,
- icon,
type,
hideHeader,
tooltip,
+ actions,
contentClassName,
+ headerContent,
tabs,
onTabChange,
activeTabId,
@@ -246,131 +225,41 @@ const PanelContainer = ({
dropdownPlaceholder,
isRefetching,
isLoading,
-}: PanelContainerProps) => {
- const { t } = useTranslation('common')
- return (
+}: PanelContainerProps) => (
+ <div
+ className={cx(
+ 'relative isolate min-w-0 overflow-hidden rounded-lg border border-gray-200 bg-white px-3 py-3 sm:px-4 dark:border-slate-800/60 dark:bg-slate-900/25',
+ {
+ 'col-span-full sm:col-span-2':
+ type === 'metadata' || type === 'customEvents',
+ },
+ )}
+ >
+ {isRefetching ? <RefetchIndicator /> : null}
+ {!hideHeader ? (
+ <PanelHeader
+ name={name}
+ tabs={tabs}
+ onTabChange={onTabChange}
+ activeTabId={activeTabId}
+ onDetailsClick={onDetailsClick}
+ detailsDisabled={detailsDisabled}
+ dropdownPlaceholder={dropdownPlaceholder}
+ tooltip={tooltip}
+ actions={actions}
+ >
+ {headerContent}
+ </PanelHeader>
+ ) : null}
<div
- className={cx(
- 'relative isolate overflow-hidden rounded-lg border border-gray-200 bg-white px-4 pb-3 dark:border-slate-800/60 dark:bg-slate-900/25',
- hideHeader ? 'pt-3' : 'pt-5',
- {
- 'col-span-full sm:col-span-2':
- type === 'metadata' || type === 'customEvents',
- },
- )}
+ className={
+ contentClassName ?? 'relative flex h-[19.6rem] flex-col overflow-hidden'
+ }
>
- {isRefetching ? <RefetchIndicator /> : null}
- {!hideHeader ? (
- <div className='mb-2 flex items-center justify-between gap-4'>
- <Text
- as='h3'
- size='lg'
- weight='semibold'
- className='flex items-center leading-6 whitespace-nowrap'
- >
- {icon ? <span className='mr-1'>{icon}</span> : null}
- {name}
- {tooltip ? (
- <span className='ml-1.5 flex items-center'>{tooltip}</span>
- ) : null}
- </Text>
- <div className={PANEL_HEADER_ACTIONS_CLASS}>
- {tabs && onTabChange ? (
- <>
- {tabs.map((tab, index) => {
- if (Array.isArray(tab)) {
- const dropdownTabs = tab
- const activeDropdownTab = dropdownTabs.find(
- (t) => t.id === activeTabId,
- )
- const dropdownTitle = activeDropdownTab
- ? activeDropdownTab.label
- : dropdownPlaceholder || t('project.campaigns')
-
- return (
- <div
- key={`dropdown-${index}`}
- className='relative inline-flex'
- >
- <Dropdown
- title={dropdownTitle}
- items={dropdownTabs}
- labelExtractor={(item) => item.label}
- keyExtractor={(item) => item.id}
- onSelect={(item) => {
- onTabChange(item.id)
- }}
- buttonClassName={cx(
- 'relative border-b-2 border-transparent px-0 py-1 text-sm font-bold whitespace-nowrap transition-colors duration-200 md:px-0',
- {
- 'text-slate-900 dark:text-gray-50':
- !!activeDropdownTab,
- 'text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':
- !activeDropdownTab,
- },
- )}
- headless
- chevron='mini'
- />
- {activeDropdownTab ? <PanelTabUnderline /> : null}
- </div>
- )
- }
-
- // Regular tab button
- return (
- <button
- key={tab.id}
- type='button'
- onClick={() => {
- onTabChange(tab.id)
- }}
- className={cx(
- 'relative border-b-2 border-transparent py-1 text-sm font-bold whitespace-nowrap transition-colors duration-200',
- {
- 'text-slate-900 dark:text-gray-50':
- activeTabId === tab.id,
- 'text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':
- activeTabId !== tab.id,
- },
- )}
- >
- {tab.label}
- {activeTabId === tab.id ? <PanelTabUnderline /> : null}
- </button>
- )
- })}
- </>
- ) : null}
- </div>
- </div>
- ) : null}
- <div
- className={cx(
- contentClassName ??
- 'relative flex h-[19.6rem] flex-col overflow-hidden',
- )}
- >
- {isLoading ? <PanelLoadingState /> : children}
- </div>
- {onDetailsClick ? (
- <div className='mt-2 flex items-center justify-center'>
- <Button
- variant='icon'
- className='gap-1.5 px-3 py-2'
- type='button'
- onClick={onDetailsClick}
- disabled={detailsDisabled}
- aria-label={t('common.details')}
- >
- <ScanIcon className='size-4' />
- <span>{t('common.details')}</span>
- </Button>
- </div>
- ) : null}
+ {isLoading ? <PanelLoadingState /> : children}
</div>
- )
-}
+ </div>
+)
interface CustomEventsProps {
customs?: Customs
@@ -1264,26 +1153,25 @@ const CustomEvents = ({
<PanelContainer
name={t('dashboard.events')}
type='customEventsChart'
- hideHeader
+ headerContent={
+ <Dropdown
+ className='ml-auto shrink-0'
+ title={t('project.topX', { x: chartTopLimit })}
+ items={[...CUSTOM_EVENTS_TOP_LIMITS]}
+ keyExtractor={(item) => item}
+ labelExtractor={(item) => t('project.topX', { x: item })}
+ onSelect={(item, _e, close) => {
+ setChartTopLimit(item)
+ close()
+ }}
+ headless
+ chevron='mini'
+ buttonClassName={panelControlClasses(true)}
+ menuItemsClassName='w-24'
+ />
+ }
>
- <div className='flex h-full flex-col'>
- <div className='mb-2 flex justify-end'>
- <Dropdown
- title={t('project.topX', { x: chartTopLimit })}
- items={[...CUSTOM_EVENTS_TOP_LIMITS]}
- keyExtractor={(item) => item}
- labelExtractor={(item) => t('project.topX', { x: item })}
- onSelect={(item, _e, close) => {
- setChartTopLimit(item)
- close()
- }}
- chevron='mini'
- buttonClassName='min-w-[96px] items-center px-2 py-1.5 text-sm leading-none font-medium md:px-2 [&_svg]:h-4 [&_svg]:w-4'
- menuItemsClassName='w-24'
- />
- </div>
- <div className='min-h-0 flex-1'>{renderStackedChart()}</div>
- </div>
+ {renderStackedChart()}
</PanelContainer>
</div>
)
@@ -1330,7 +1218,7 @@ const MetadataKeyBody = ({
}: MetadataKeyBodyProps) => {
const { t } = useTranslation('common')
const navigate = useNavigate()
- const [loading, setLoading] = useState(false)
+ const [loading, setLoading] = useState(Boolean(activeKey))
const [valuesData, setValuesData] = useState<
Array<{ value: string; count: number }>
>([])
@@ -1342,9 +1230,11 @@ const MetadataKeyBody = ({
const uniques = _sum(chartData.uniques)
useEffect(() => {
+ let cancelled = false
if (!activeKey) {
setValuesData([])
setRawMetadata([])
+ setLoading(false)
return
}
@@ -1352,68 +1242,37 @@ const MetadataKeyBody = ({
setLoading(true)
try {
const { result } = await getMetadataValues(activeKey)
+ if (cancelled) return
if (mode === 'property') {
- const values = result
- .filter((item) => item.key === activeKey)
- .map((item) => ({ value: item.value, count: item.count }))
- setValuesData(values)
+ setValuesData(
+ result
+ .filter((item) => item.key === activeKey)
+ .map((item) => ({ value: item.value, count: item.count })),
+ )
} else {
setRawMetadata(result)
- const values = result.map((item) => ({
- value: `${item.key}: ${item.value}`,
- count: item.count,
- }))
- setValuesData(values)
+ setValuesData(
+ result.map((item) => ({
+ value: `${item.key}: ${item.value}`,
+ count: item.count,
+ })),
+ )
}
} catch (error) {
- console.error(
- `[ERROR](MetadataKeyBody) Failed to load values for key ${activeKey}`,
- error,
- )
+ if (cancelled) return
+ console.error('[ERROR](MetadataKeyBody) Failed to load metadata', error)
setValuesData([])
setRawMetadata([])
} finally {
- setLoading(false)
+ if (!cancelled) setLoading(false)
}
}
loadValues()
- }, [activeKey, getMetadataValues, mode])
-
- useEffect(() => {
- if (activeKey) {
- const loadValues = async () => {
- setLoading(true)
- try {
- const { result } = await getMetadataValues(activeKey)
- if (mode === 'property') {
- const values = result
- .filter((item) => item.key === activeKey)
- .map((item) => ({ value: item.value, count: item.count }))
- setValuesData(values)
- } else {
- setRawMetadata(result)
- const values = result.map((item) => ({
- value: `${item.key}: ${item.value}`,
- count: item.count,
- }))
- setValuesData(values)
- }
- } catch (error) {
- console.error(
- `[ERROR](MetadataKeyBody) Failed to reload values for key ${activeKey}`,
- error,
- )
- setValuesData([])
- setRawMetadata([])
- } finally {
- setLoading(false)
- }
- }
- loadValues()
+ return () => {
+ cancelled = true
}
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [filters])
+ }, [activeKey, getMetadataValues, mode, filters])
const valuesToDisplay = useMemo(() => {
if (mode === 'customEvent') {
@@ -1548,11 +1407,13 @@ const MetadataKeyBody = ({
mode === 'customEvent' ? !_isEmpty(rawMetadata) : !_isEmpty(valuesData)
useEffect(() => {
- onShowDetailsChange?.(hasExistingData)
- }, [hasExistingData, onShowDetailsChange])
+ onShowDetailsChange?.(hasExistingData && !loading)
+ }, [hasExistingData, loading, onShowDetailsChange])
+ const previousDetailsTrigger = useRef(detailsTrigger)
useEffect(() => {
- if (detailsTrigger && detailsTrigger > 0) {
+ if (detailsTrigger !== previousDetailsTrigger.current) {
+ previousDetailsTrigger.current = detailsTrigger
setDetailsOpened(true)
}
}, [detailsTrigger])
@@ -1802,139 +1663,65 @@ const CombinedMetadataPanel = ({
filters,
}: CombinedMetadataPanelProps) => {
const { t } = useTranslation('common')
- const hasProperty = !_isEmpty(property.metadataKeys)
- const hasCustomEvent = !_isEmpty(customEvent.metadataKeys)
-
- const [activeMode, setActiveMode] = useState<'property' | 'customEvent'>(
- () => {
- if (hasProperty) return 'property'
- if (hasCustomEvent) return 'customEvent'
- return 'property'
- },
+ const [selectedMode, setSelectedMode] = useState<'property' | 'customEvent'>(
+ 'property',
)
-
- useEffect(() => {
- if (activeMode === 'property' && !hasProperty && hasCustomEvent) {
- setActiveMode('customEvent')
- } else if (activeMode === 'customEvent' && !hasCustomEvent && hasProperty) {
- setActiveMode('property')
- }
- }, [activeMode, hasProperty, hasCustomEvent])
-
+ const activeMode = (selectedMode === 'property' ? property : customEvent)
+ .metadataKeys.length
+ ? selectedMode
+ : property.metadataKeys.length || !customEvent.metadataKeys.length
+ ? 'property'
+ : 'customEvent'
const activeSection = activeMode === 'property' ? property : customEvent
- const activeFilterPrefix: 'event_metadata' | 'page_property' =
- activeMode === 'property' ? 'page_property' : 'event_metadata'
-
- const dropdownItems = useMemo(
- () => activeSection.metadataKeys.map((key) => ({ id: key, label: key })),
- [activeSection.metadataKeys],
- )
-
- const modeTabs: Array<{ id: 'property' | 'customEvent'; label: string }> =
- useMemo(() => {
- const tabs: Array<{ id: 'property' | 'customEvent'; label: string }> = []
- if (hasProperty) {
- tabs.push({ id: 'property', label: t('project.pageviewMetadata') })
- }
- if (hasCustomEvent) {
- tabs.push({ id: 'customEvent', label: t('project.customEvMetadata') })
- }
- return tabs
- }, [hasProperty, hasCustomEvent, t])
-
+ const activeKey = activeSection.metadataKeys.includes(activeSection.activeKey)
+ ? activeSection.activeKey
+ : activeSection.metadataKeys[0] || ''
const [canShowDetails, setCanShowDetails] = useState(false)
const [detailsTrigger, setDetailsTrigger] = useState(0)
- const activeDropdownTab = dropdownItems.find(
- (item) => item.id === activeSection.activeKey,
- )
- const dropdownTitle = activeDropdownTab
- ? activeDropdownTab.label
- : activeMode === 'customEvent'
- ? t('project.selectEvent')
- : t('project.selectProperty')
return (
- <div className='isolate overflow-hidden rounded-lg border border-gray-200 bg-white px-4 pt-5 pb-3 dark:border-slate-800/60 dark:bg-slate-900/25'>
- <div className='mb-2 flex items-center justify-between gap-4'>
- <Text
- as='h3'
- size='lg'
- weight='semibold'
- className='flex items-center leading-6 whitespace-nowrap'
- >
- {title}
- </Text>
- <div className={PANEL_HEADER_ACTIONS_CLASS}>
- {modeTabs.map((tab) => (
- <button
- key={tab.id}
- type='button'
- onClick={() => setActiveMode(tab.id)}
- className={cx(
- 'relative border-b-2 border-transparent py-1 text-sm font-bold whitespace-nowrap transition-colors duration-200',
- {
- 'text-slate-900 dark:text-gray-50': activeMode === tab.id,
- 'text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':
- activeMode !== tab.id,
- },
- )}
- >
- {tab.label}
- {activeMode === tab.id ? <PanelTabUnderline /> : null}
- </button>
- ))}
- {!_isEmpty(dropdownItems) ? (
- <Dropdown
- title={dropdownTitle}
- items={dropdownItems}
- labelExtractor={(item) => item.label}
- keyExtractor={(item) => item.id}
- onSelect={(item) => activeSection.onKeyChange(item.id)}
- buttonClassName={cx(
- 'relative border-b-2 px-0 py-1 text-sm font-bold whitespace-nowrap transition-colors duration-200 md:px-0',
- {
- 'border-slate-900 text-slate-900 dark:border-gray-50 dark:text-gray-50':
- !!activeDropdownTab,
- 'border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':
- !activeDropdownTab,
- },
- )}
- headless
- chevron='mini'
- />
- ) : null}
- </div>
- </div>
- <div className='relative flex h-[19.6rem] flex-col overflow-hidden'>
- <MetadataKeyBody
- key={activeMode}
- title={title}
- hasMetadataKeys={!_isEmpty(activeSection.metadataKeys)}
- getMetadataValues={activeSection.getMetadataValues}
- getFilterLink={getFilterLink}
- chartData={chartData}
- filters={filters}
- activeKey={activeSection.activeKey}
- filterPrefix={activeFilterPrefix}
- mode={activeMode}
- onShowDetailsChange={setCanShowDetails}
- detailsTrigger={detailsTrigger}
+ <PanelContainer
+ name={title}
+ type='metadataPicker'
+ onDetailsClick={() => setDetailsTrigger((n) => n + 1)}
+ detailsDisabled={!canShowDetails}
+ headerContent={
+ <MetadataPicker
+ propertyKeys={property.metadataKeys}
+ eventKeys={customEvent.metadataKeys}
+ activeMode={activeMode}
+ activeKey={activeKey}
+ onSelect={(mode, key) => {
+ if (mode === activeMode && key === activeKey) return
+ setCanShowDetails(false)
+ setSelectedMode(mode)
+ const section = mode === 'property' ? property : customEvent
+ section.onKeyChange(key)
+ }}
/>
- </div>
- <div className='mt-2 flex items-center justify-center'>
- <Button
- variant='icon'
- className='gap-1.5 px-3 py-2'
- type='button'
- onClick={() => setDetailsTrigger((n) => n + 1)}
- disabled={!canShowDetails}
- aria-label={t('common.details')}
- >
- <ScanIcon className='size-4' />
- <span>{t('common.details')}</span>
- </Button>
- </div>
- </div>
+ }
+ >
+ <MetadataKeyBody
+ key={`${activeMode}:${activeKey}`}
+ title={
+ activeMode === 'property'
+ ? t('project.pageProperties')
+ : t('project.customEvMetadata')
+ }
+ hasMetadataKeys={activeSection.metadataKeys.length > 0}
+ getMetadataValues={activeSection.getMetadataValues}
+ getFilterLink={getFilterLink}
+ chartData={chartData}
+ filters={filters}
+ activeKey={activeKey}
+ filterPrefix={
+ activeMode === 'property' ? 'page_property' : 'event_metadata'
+ }
+ mode={activeMode}
+ onShowDetailsChange={setCanShowDetails}
+ detailsTrigger={detailsTrigger}
+ />
+ </PanelContainer>
)
}
diff --git a/web/app/pages/Project/View/components/MetadataPicker.tsx b/web/app/pages/Project/View/components/MetadataPicker.tsx
new file mode 100644
index 000000000..30307e583
--- /dev/null
+++ b/web/app/pages/Project/View/components/MetadataPicker.tsx
@@ -0,0 +1,176 @@
+import {
+ Combobox,
+ ComboboxInput,
+ ComboboxOption,
+ ComboboxOptions,
+ Popover,
+ PopoverButton,
+ PopoverPanel,
+} from '@headlessui/react'
+import {
+ CaretDownIcon,
+ CheckIcon,
+ CursorClickIcon,
+ MagnifyingGlassIcon,
+ TagIcon,
+} from '@phosphor-icons/react'
+import { useId, useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+
+import { panelControlClasses } from './PanelHeader'
+
+type MetadataMode = 'property' | 'customEvent'
+
+interface MetadataOption {
+ mode: MetadataMode
+ key: string
+}
+
+interface MetadataPickerProps {
+ propertyKeys: string[]
+ eventKeys: string[]
+ activeMode: MetadataMode
+ activeKey: string
+ onSelect: (mode: MetadataMode, key: string) => void
+}
+
+export const MetadataPicker = ({
+ propertyKeys,
+ eventKeys,
+ activeMode,
+ activeKey,
+ onSelect,
+}: MetadataPickerProps) => {
+ const { t } = useTranslation('common')
+ const [query, setQuery] = useState('')
+ const id = useId()
+ const groups = useMemo(() => {
+ const search = query.trim().toLocaleLowerCase()
+ return [
+ {
+ mode: 'property' as const,
+ label: t('project.pageProperties'),
+ keys: propertyKeys,
+ },
+ {
+ mode: 'customEvent' as const,
+ label: t('project.customEvents'),
+ keys: eventKeys,
+ },
+ ].map((group) => ({
+ ...group,
+ keys: group.keys.filter((key) =>
+ `${group.label} ${key}`.toLocaleLowerCase().includes(search),
+ ),
+ }))
+ }, [propertyKeys, eventKeys, query, t])
+ const sourceLabel =
+ activeMode === 'property' ? t('project.property') : t('project.customEvent')
+ const SourceIcon = activeMode === 'property' ? TagIcon : CursorClickIcon
+
+ return (
+ <Popover className='max-w-full min-w-0'>
+ {({ close }) => (
+ <>
+ <PopoverButton
+ className={`${panelControlClasses(true)} max-w-full gap-1.5`}
+ onClick={() => setQuery('')}
+ disabled={!propertyKeys.length && !eventKeys.length}
+ aria-label={`${t('project.metadata')}: ${sourceLabel}${activeKey ? `: ${activeKey}` : ''}`}
+ title={
+ activeKey ? `${sourceLabel}: ${activeKey}` : t('project.metadata')
+ }
+ >
+ <SourceIcon
+ className='size-4 shrink-0 text-gray-500 dark:text-gray-400'
+ aria-hidden
+ />
+ <span className='shrink-0 font-medium text-gray-500 dark:text-gray-400'>
+ {activeKey ? `${sourceLabel}:` : t('project.metadata')}
+ </span>
+ {activeKey ? <span className='truncate'>{activeKey}</span> : null}
+ <CaretDownIcon className='size-4 shrink-0' aria-hidden />
+ </PopoverButton>
+ <PopoverPanel
+ anchor={{ to: 'bottom start', gap: 6, padding: 12 }}
+ modal={false}
+ focus
+ transition
+ className='z-50 w-80 max-w-[calc(100vw-1.5rem)] origin-top-left rounded-lg bg-white p-1 shadow-lg ring-1 ring-gray-200/80 transition-[opacity,transform] duration-150 ease-out-quint focus:outline-hidden data-closed:scale-95 data-closed:opacity-0 data-leave:duration-100 motion-reduce:transition-none dark:bg-slate-900 dark:ring-slate-700/60'
+ >
+ <Combobox
+ value={{ mode: activeMode, key: activeKey }}
+ by={(a: MetadataOption, b: MetadataOption) =>
+ a?.mode === b?.mode && a?.key === b?.key
+ }
+ onChange={(option: MetadataOption | null) => {
+ if (!option) return
+ onSelect(option.mode, option.key)
+ close()
+ }}
+ onClose={() => close()}
+ immediate
+ >
+ <div className='relative mb-1 border-b border-gray-100 dark:border-slate-800'>
+ <MagnifyingGlassIcon
+ className='pointer-events-none absolute top-2.5 left-2 size-4 text-gray-400'
+ aria-hidden
+ />
+ <ComboboxInput
+ data-autofocus
+ aria-label={t('project.searchMetadata')}
+ placeholder={t('project.searchMetadata')}
+ displayValue={() => query}
+ onChange={(event) => setQuery(event.target.value)}
+ className='w-full border-0 bg-transparent py-2 pr-2 pl-8 text-sm text-gray-900 outline-hidden placeholder:text-gray-400 focus:ring-0 dark:text-gray-50'
+ />
+ </div>
+ <ComboboxOptions
+ static
+ modal={false}
+ className='max-h-72 overflow-y-auto overscroll-contain outline-hidden'
+ >
+ {groups.map((group) =>
+ group.keys.length ? (
+ <fieldset
+ key={group.mode}
+ className='m-0 min-w-0 border-0 p-0'
+ aria-labelledby={`${id}-${group.mode}`}
+ >
+ <legend
+ id={`${id}-${group.mode}`}
+ className='px-2 pt-2 pb-1 text-xs font-medium text-gray-500 dark:text-gray-400'
+ >
+ {group.label}
+ </legend>
+ {group.keys.map((key) => (
+ <ComboboxOption
+ key={key}
+ value={{ mode: group.mode, key }}
+ className='group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-gray-700 transition-colors duration-100 ease-out select-none data-focus:bg-gray-100 data-focus:text-gray-900 dark:text-gray-200 dark:data-focus:bg-slate-800 dark:data-focus:text-white'
+ >
+ <span className='min-w-0 flex-1 wrap-break-word'>
+ {key}
+ </span>
+ <CheckIcon
+ className='invisible size-4 shrink-0 group-data-selected:visible'
+ aria-hidden
+ />
+ </ComboboxOption>
+ ))}
+ </fieldset>
+ ) : null,
+ )}
+ {groups.every((group) => !group.keys.length) ? (
+ <p className='px-2 py-4 text-center text-sm text-gray-500 dark:text-gray-400'>
+ {t('common.nothingFound')}
+ </p>
+ ) : null}
+ </ComboboxOptions>
+ </Combobox>
+ </PopoverPanel>
+ </>
+ )}
+ </Popover>
+ )
+}
diff --git a/web/app/pages/Project/View/components/PanelHeader.tsx b/web/app/pages/Project/View/components/PanelHeader.tsx
new file mode 100644
index 000000000..a2dc2b6da
--- /dev/null
+++ b/web/app/pages/Project/View/components/PanelHeader.tsx
@@ -0,0 +1,141 @@
+import { ArrowsOutSimpleIcon } from '@phosphor-icons/react'
+import { useEffect, useRef, type ReactNode } from 'react'
+import { useTranslation } from 'react-i18next'
+
+import Button, { buttonClasses } from '~/ui/Button'
+import Dropdown from '~/ui/Dropdown'
+
+interface PanelTab {
+ id: string
+ label: string
+}
+
+export interface PanelHeaderProps {
+ name: ReactNode
+ tabs?: (PanelTab | PanelTab[])[]
+ activeTabId?: string
+ onTabChange?: (id: string) => void
+ dropdownPlaceholder?: string
+ tooltip?: ReactNode
+ actions?: ReactNode
+ children?: ReactNode
+ onDetailsClick?: () => void
+ detailsDisabled?: boolean
+}
+
+export const panelControlClasses = (active = false) =>
+ buttonClasses({
+ variant: 'ghost',
+ size: 'sm',
+ className: `shrink-0 px-2 py-1 whitespace-nowrap font-medium md:px-2 focus-visible:ring-inset focus-visible:ring-offset-0 motion-reduce:transition-none motion-reduce:active:scale-100 ${
+ active
+ ? 'bg-gray-100 text-gray-900 hover:bg-gray-200/70 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-slate-700'
+ : 'text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-slate-800 dark:hover:text-gray-50'
+ }`,
+ })
+
+export const PanelHeader = ({
+ name,
+ tabs,
+ activeTabId,
+ onTabChange,
+ dropdownPlaceholder,
+ tooltip,
+ actions,
+ children,
+ onDetailsClick,
+ detailsDisabled,
+}: PanelHeaderProps) => {
+ const { t } = useTranslation('common')
+ const label = typeof name === 'string' ? name : undefined
+ const controlsRef = useRef<HTMLFieldSetElement>(null)
+
+ useEffect(() => {
+ const controls = controlsRef.current
+ const selected = controls?.querySelector<HTMLElement>(
+ '[aria-pressed="true"], .panel-active-tab',
+ )
+ if (!controls || !selected) return
+ const bounds = controls.getBoundingClientRect()
+ const selectedBounds = selected.getBoundingClientRect()
+ if (selectedBounds.left < bounds.left) {
+ controls.scrollLeft += selectedBounds.left - bounds.left
+ } else if (selectedBounds.right > bounds.right) {
+ controls.scrollLeft += selectedBounds.right - bounds.right
+ }
+ }, [activeTabId])
+
+ return (
+ <div className='mb-2 flex min-w-0 items-center gap-2'>
+ <fieldset
+ ref={controlsRef}
+ className='m-0 flex min-h-7 min-w-0 flex-1 scrollbar-thin items-center gap-0.5 overflow-x-auto overflow-y-hidden border-0 p-0'
+ aria-label={label}
+ >
+ {children ??
+ (tabs?.length && onTabChange ? (
+ tabs.map((tab, index) => {
+ if (Array.isArray(tab)) {
+ const active = tab.find((item) => item.id === activeTabId)
+ return (
+ <Dropdown
+ key={`dropdown-${index}`}
+ title={
+ active?.label ||
+ dropdownPlaceholder ||
+ t('project.campaigns')
+ }
+ items={tab}
+ labelExtractor={(item) => item.label}
+ keyExtractor={(item) => item.id}
+ onSelect={(item, _event, close) => {
+ onTabChange(item.id)
+ close()
+ }}
+ className={
+ active ? 'panel-active-tab shrink-0' : 'shrink-0'
+ }
+ buttonClassName={panelControlClasses(!!active)}
+ headless
+ chevron='mini'
+ />
+ )
+ }
+
+ return (
+ <button
+ key={tab.id}
+ type='button'
+ aria-pressed={activeTabId === tab.id}
+ onClick={() => onTabChange(tab.id)}
+ className={panelControlClasses(activeTabId === tab.id)}
+ >
+ {tab.label}
+ </button>
+ )
+ })
+ ) : (
+ <h3 className='px-1 py-1 text-sm leading-4 font-semibold text-gray-900 dark:text-gray-50'>
+ {name}
+ </h3>
+ ))}
+ </fieldset>
+ {tooltip}
+ {actions}
+ {onDetailsClick ? (
+ <Button
+ variant='ghost'
+ className='size-7 shrink-0 justify-center p-0 focus-visible:ring-offset-0 focus-visible:ring-inset motion-reduce:transition-none motion-reduce:active:scale-100'
+ onClick={onDetailsClick}
+ disabled={detailsDisabled}
+ aria-label={
+ label ? `${t('common.details')}: ${label}` : t('common.details')
+ }
+ title={t('common.details')}
+ >
+ <ArrowsOutSimpleIcon className='size-4' aria-hidden />
+ </Button>
+ ) : null}
+ </div>
+ )
+}
diff --git a/web/app/pages/Project/View/v2/BreakdownPanel.tsx b/web/app/pages/Project/View/v2/BreakdownPanel.tsx
index 14a70f76f..e5ebd4a86 100644
--- a/web/app/pages/Project/View/v2/BreakdownPanel.tsx
+++ b/web/app/pages/Project/View/v2/BreakdownPanel.tsx
@@ -150,18 +150,15 @@ export const BreakdownPanel = ({
)
}, [activeSubTab, versionsQuery.data, primaryMetric])
- const containerTabs =
- flatSubTabs.length > 1
- ? subTabs.map((tab) =>
- Array.isArray(tab)
- ? tab.map(({ id, label }) => ({ id, label }))
- : { id: tab.id, label: tab.label },
- )
- : undefined
+ const containerTabs = subTabs.map((tab) =>
+ Array.isArray(tab)
+ ? tab.map(({ id, label }) => ({ id, label }))
+ : { id: tab.id, label: tab.label },
+ )
if (isSentinel) {
return (
- <div ref={ref}>
+ <div ref={ref} className='min-w-0'>
<PanelContainer
name={name}
icon={icon}
@@ -201,7 +198,7 @@ export const BreakdownPanel = ({
)
return (
- <div ref={ref}>
+ <div ref={ref} className='min-w-0'>
<Panel
key={activeSubTabId}
icon={icon}
diff --git a/web/app/pages/Project/tabs/Captcha/CaptchaView.tsx b/web/app/pages/Project/tabs/Captcha/CaptchaView.tsx
index aa11bf056..e7ad6e24f 100644
--- a/web/app/pages/Project/tabs/Captcha/CaptchaView.tsx
+++ b/web/app/pages/Project/tabs/Captcha/CaptchaView.tsx
@@ -140,7 +140,11 @@ const CaptchaView = (_props: CaptchaViewProps) => {
dimension,
name: tnMapping[dimension],
subTabs: [
- { id: dimension, label: tnMapping[dimension], dimension },
+ {
+ id: dimension,
+ label: t(`project.panelTabs.${dimension}`),
+ dimension,
+ },
] as BreakdownSubTab[],
})),
// eslint-disable-next-line react-hooks/exhaustive-deps
diff --git a/web/app/pages/Project/tabs/Errors/ErrorsView.tsx b/web/app/pages/Project/tabs/Errors/ErrorsView.tsx
index f43de1422..364f5e7bd 100644
--- a/web/app/pages/Project/tabs/Errors/ErrorsView.tsx
+++ b/web/app/pages/Project/tabs/Errors/ErrorsView.tsx
@@ -874,10 +874,22 @@ const ErrorsViewInner = () => {
const locationSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- { id: 'country', label: t('project.mapping.cc'), dimension: 'country' },
- { id: 'region', label: t('project.mapping.rg'), dimension: 'region' },
- { id: 'city', label: t('project.mapping.ct'), dimension: 'city' },
- { id: 'locale', label: t('project.mapping.lc'), dimension: 'locale' },
+ {
+ id: 'country',
+ label: t('project.panelTabs.country'),
+ dimension: 'country',
+ },
+ {
+ id: 'region',
+ label: t('project.panelTabs.region'),
+ dimension: 'region',
+ },
+ { id: 'city', label: t('project.panelTabs.city'), dimension: 'city' },
+ {
+ id: 'locale',
+ label: t('project.panelTabs.locale'),
+ dimension: 'locale',
+ },
{
id: 'map',
label: t('project.mapping.map'),
@@ -889,8 +901,8 @@ const ErrorsViewInner = () => {
const pagesSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- { id: 'page', label: t('project.mapping.pg'), dimension: 'page' },
- { id: 'host', label: t('project.mapping.host'), dimension: 'host' },
+ { id: 'page', label: t('project.panelTabs.page'), dimension: 'page' },
+ { id: 'host', label: t('project.panelTabs.host'), dimension: 'host' },
],
[t],
)
@@ -899,39 +911,43 @@ const ErrorsViewInner = () => {
() => [
{
id: 'browser',
- label: t('project.mapping.br'),
+ label: t('project.panelTabs.browser'),
dimension: 'browser',
versionsDimension: 'browser_version' as const,
versionsParentField: 'browser' as const,
},
{
id: 'os',
- label: t('project.mapping.os'),
+ label: t('project.panelTabs.os'),
dimension: 'os',
versionsDimension: 'os_version' as const,
versionsParentField: 'os' as const,
},
- { id: 'device', label: t('project.mapping.dv'), dimension: 'device' },
+ {
+ id: 'device',
+ label: t('project.panelTabs.device'),
+ dimension: 'device',
+ },
],
[t],
)
const networkSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- { id: 'isp', label: t('project.mapping.isp'), dimension: 'isp' },
+ { id: 'isp', label: t('project.panelTabs.isp'), dimension: 'isp' },
{
id: 'organization',
- label: t('project.mapping.og'),
+ label: t('project.panelTabs.organization'),
dimension: 'organization',
},
{
id: 'user_type',
- label: t('project.mapping.ut'),
+ label: t('project.panelTabs.user_type'),
dimension: 'user_type',
},
{
id: 'connection_type',
- label: t('project.mapping.ctp'),
+ label: t('project.panelTabs.connection_type'),
dimension: 'connection_type',
},
],
diff --git a/web/app/pages/Project/tabs/Performance/PerformanceView.tsx b/web/app/pages/Project/tabs/Performance/PerformanceView.tsx
index df98de45b..a30646681 100644
--- a/web/app/pages/Project/tabs/Performance/PerformanceView.tsx
+++ b/web/app/pages/Project/tabs/Performance/PerformanceView.tsx
@@ -333,9 +333,17 @@ const PerformanceViewInner = ({ tnMapping }: PerformanceViewProps) => {
const locationSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- { id: 'country', label: t('project.mapping.cc'), dimension: 'country' },
- { id: 'region', label: t('project.mapping.rg'), dimension: 'region' },
- { id: 'city', label: t('project.mapping.ct'), dimension: 'city' },
+ {
+ id: 'country',
+ label: t('project.panelTabs.country'),
+ dimension: 'country',
+ },
+ {
+ id: 'region',
+ label: t('project.panelTabs.region'),
+ dimension: 'region',
+ },
+ { id: 'city', label: t('project.panelTabs.city'), dimension: 'city' },
{
id: 'map',
label: t('project.mapping.map'),
@@ -349,8 +357,8 @@ const PerformanceViewInner = ({ tnMapping }: PerformanceViewProps) => {
const pagesSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- { id: 'page', label: t('project.mapping.pg'), dimension: 'page' },
- { id: 'host', label: t('project.mapping.host'), dimension: 'host' },
+ { id: 'page', label: t('project.panelTabs.page'), dimension: 'page' },
+ { id: 'host', label: t('project.panelTabs.host'), dimension: 'host' },
],
[t],
)
@@ -359,36 +367,38 @@ const PerformanceViewInner = ({ tnMapping }: PerformanceViewProps) => {
() => [
{
id: 'browser',
- label: t('project.mapping.br'),
+ label: t('project.panelTabs.browser'),
dimension: 'browser',
versionsDimension: 'browser_version' as const,
versionsParentField: 'browser' as const,
},
- { id: 'device', label: t('project.mapping.dv'), dimension: 'device' },
+ {
+ id: 'device',
+ label: t('project.panelTabs.device'),
+ dimension: 'device',
+ },
],
[t],
)
- const networkSubTabs = useMemo<(BreakdownSubTab | BreakdownSubTab[])[]>(
+ const networkSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- [
- { id: 'isp', label: t('project.mapping.isp'), dimension: 'isp' },
- {
- id: 'organization',
- label: t('project.mapping.og'),
- dimension: 'organization',
- },
- {
- id: 'user_type',
- label: t('project.mapping.ut'),
- dimension: 'user_type',
- },
- {
- id: 'connection_type',
- label: t('project.mapping.ctp'),
- dimension: 'connection_type',
- },
- ],
+ { id: 'isp', label: t('project.panelTabs.isp'), dimension: 'isp' },
+ {
+ id: 'organization',
+ label: t('project.panelTabs.organization'),
+ dimension: 'organization',
+ },
+ {
+ id: 'user_type',
+ label: t('project.panelTabs.user_type'),
+ dimension: 'user_type',
+ },
+ {
+ id: 'connection_type',
+ label: t('project.panelTabs.connection_type'),
+ dimension: 'connection_type',
+ },
],
[t],
)
diff --git a/web/app/pages/Project/tabs/SEO/CompactReferralPanel.tsx b/web/app/pages/Project/tabs/SEO/CompactReferralPanel.tsx
index 13b39a46c..6d5189382 100644
--- a/web/app/pages/Project/tabs/SEO/CompactReferralPanel.tsx
+++ b/web/app/pages/Project/tabs/SEO/CompactReferralPanel.tsx
@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next'
import type { Entry } from '~/lib/models/Entry'
import { PanelEmptyState, PanelLoadingState } from '~/pages/Project/View/Panels'
import { RefetchIndicator } from '~/pages/Project/View/v2/loading'
+import { PanelHeader } from '~/pages/Project/View/components/PanelHeader'
import { Text } from '~/ui/Text'
import { nFormatter } from '~/utils/generic'
@@ -24,7 +25,6 @@ interface CompactReferralPanelProps {
const CompactReferralPanel = ({
title,
data,
- icon,
rowMapper,
isLoading,
isRefetching,
@@ -60,14 +60,9 @@ const CompactReferralPanel = ({
if (isLoading || _isEmpty(data)) {
return (
- <div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'>
+ <div className='relative min-w-0 overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'>
{isRefetching ? <RefetchIndicator /> : null}
- <div className='flex items-center gap-1 text-gray-900 dark:text-gray-50'>
- {icon}
- <Text size='sm' weight='semibold'>
- {title}
- </Text>
- </div>
+ <PanelHeader name={title} />
{isLoading ? (
<PanelLoadingState />
) : (
@@ -120,19 +115,16 @@ const CompactReferralPanel = ({
}
return (
- <div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'>
+ <div className='relative min-w-0 overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'>
{isRefetching ? <RefetchIndicator /> : null}
- <div className='mb-2 flex items-center justify-between'>
- <div className='flex items-center gap-1 text-gray-900 dark:text-gray-50'>
- {icon}
- <Text size='sm' weight='semibold'>
- {title}
+ <PanelHeader
+ name={title}
+ actions={
+ <Text size='sm' weight='medium' className='shrink-0 tabular-nums'>
+ {nFormatter(total, 1)}
</Text>
- </div>
- <Text size='sm' weight='medium' className='tabular-nums'>
- {nFormatter(total, 1)}
- </Text>
- </div>
+ }
+ />
<div className='grid grid-cols-2 gap-x-3'>
<div className='space-y-0.5'>
{col1.map((row, i) => renderRow(row, i))}
diff --git a/web/app/pages/Project/tabs/SEO/SEOView.tsx b/web/app/pages/Project/tabs/SEO/SEOView.tsx
index a7ed3cf82..a2f252eb0 100644
--- a/web/app/pages/Project/tabs/SEO/SEOView.tsx
+++ b/web/app/pages/Project/tabs/SEO/SEOView.tsx
@@ -76,6 +76,7 @@ import { getSearchEngineReferrals, getAIReferrals } from '~/utils/referrers'
import routes from '~/utils/routes'
import CompactReferralPanel from './CompactReferralPanel'
+import { PanelHeader } from '~/pages/Project/View/components/PanelHeader'
import {
SEO_METRICS,
type SEOMetricKey,
@@ -595,25 +596,37 @@ const SEOViewInner = ({ tnMapping }: SEOViewProps) => {
)
const pagesSubTabs = useMemo<BreakdownSubTab[]>(
- () => [{ id: 'page', label: t('project.seo.page'), dimension: 'page' }],
+ () => [
+ { id: 'page', label: t('project.panelTabs.page'), dimension: 'page' },
+ ],
[t],
)
const queriesSubTabs = useMemo<BreakdownSubTab[]>(
- () => [{ id: 'query', label: t('project.seo.query'), dimension: 'query' }],
+ () => [
+ { id: 'query', label: t('project.panelTabs.query'), dimension: 'query' },
+ ],
[t],
)
const countriesSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- { id: 'country', label: t('project.mapping.cc'), dimension: 'country' },
+ {
+ id: 'country',
+ label: t('project.panelTabs.country'),
+ dimension: 'country',
+ },
],
[t],
)
const devicesSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- { id: 'device', label: t('project.mapping.dv'), dimension: 'device' },
+ {
+ id: 'device',
+ label: t('project.panelTabs.device'),
+ dimension: 'device',
+ },
],
[t],
)
@@ -911,12 +924,7 @@ const SEOViewInner = ({ tnMapping }: SEOViewProps) => {
{brandedQuery.isFetching && !brandedQuery.isPending ? (
<RefetchIndicator />
) : null}
- <div className='mb-1 flex items-center gap-1 text-gray-900 dark:text-gray-50'>
- <MagnifyingGlassIcon className='size-5' />
- <Text size='sm' weight='semibold'>
- {t('project.seo.brandedTraffic')}
- </Text>
- </div>
+ <PanelHeader name={t('project.seo.brandedTraffic')} />
{brandedQuery.isPending ? (
<PanelLoadingState />
) : brandedQuery.isError ? (
diff --git a/web/app/pages/Project/tabs/Traffic/TrafficView.tsx b/web/app/pages/Project/tabs/Traffic/TrafficView.tsx
index dcc66c7ce..1d8b98707 100644
--- a/web/app/pages/Project/tabs/Traffic/TrafficView.tsx
+++ b/web/app/pages/Project/tabs/Traffic/TrafficView.tsx
@@ -715,10 +715,22 @@ const TrafficViewInner = ({
const locationSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- { id: 'country', label: t('project.mapping.cc'), dimension: 'country' },
- { id: 'region', label: t('project.mapping.rg'), dimension: 'region' },
- { id: 'city', label: t('project.mapping.ct'), dimension: 'city' },
- { id: 'locale', label: t('project.mapping.lc'), dimension: 'locale' },
+ {
+ id: 'country',
+ label: t('project.panelTabs.country'),
+ dimension: 'country',
+ },
+ {
+ id: 'region',
+ label: t('project.panelTabs.region'),
+ dimension: 'region',
+ },
+ { id: 'city', label: t('project.panelTabs.city'), dimension: 'city' },
+ {
+ id: 'locale',
+ label: t('project.panelTabs.locale'),
+ dimension: 'locale',
+ },
{
id: 'map',
label: t('project.mapping.map'),
@@ -730,18 +742,18 @@ const TrafficViewInner = ({
const pagesSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- { id: 'page', label: t('project.mapping.pg'), dimension: 'page' },
+ { id: 'page', label: t('project.panelTabs.page'), dimension: 'page' },
{
id: 'entry_page',
- label: t('project.entryPages'),
+ label: t('project.panelTabs.entry_page'),
dimension: 'entry_page',
},
{
id: 'exit_page',
- label: t('project.exitPages'),
+ label: t('project.panelTabs.exit_page'),
dimension: 'exit_page',
},
- { id: 'host', label: t('project.mapping.host'), dimension: 'host' },
+ { id: 'host', label: t('project.panelTabs.host'), dimension: 'host' },
],
[t],
)
@@ -750,19 +762,23 @@ const TrafficViewInner = ({
() => [
{
id: 'browser',
- label: t('project.mapping.br'),
+ label: t('project.panelTabs.browser'),
dimension: 'browser',
versionsDimension: 'browser_version' as const,
versionsParentField: 'browser' as const,
},
{
id: 'os',
- label: t('project.mapping.os'),
+ label: t('project.panelTabs.os'),
dimension: 'os',
versionsDimension: 'os_version' as const,
versionsParentField: 'os' as const,
},
- { id: 'device', label: t('project.mapping.dv'), dimension: 'device' },
+ {
+ id: 'device',
+ label: t('project.panelTabs.device'),
+ dimension: 'device',
+ },
],
[t],
)
@@ -771,33 +787,33 @@ const TrafficViewInner = ({
() => [
{
id: 'referrer',
- label: t('project.mapping.ref'),
+ label: t('project.panelTabs.referrer'),
dimension: 'referrer',
},
[
{
id: 'utm_source',
- label: t('project.mapping.so'),
+ label: t('project.panelTabs.utm_source'),
dimension: 'utm_source',
},
{
id: 'utm_medium',
- label: t('project.mapping.me'),
+ label: t('project.panelTabs.utm_medium'),
dimension: 'utm_medium',
},
{
id: 'utm_campaign',
- label: t('project.mapping.ca'),
+ label: t('project.panelTabs.utm_campaign'),
dimension: 'utm_campaign',
},
{
id: 'utm_term',
- label: t('project.mapping.te'),
+ label: t('project.panelTabs.utm_term'),
dimension: 'utm_term',
},
{
id: 'utm_content',
- label: t('project.mapping.co'),
+ label: t('project.panelTabs.utm_content'),
dimension: 'utm_content',
},
],
@@ -805,26 +821,24 @@ const TrafficViewInner = ({
[t],
)
- const networkSubTabs = useMemo<(BreakdownSubTab | BreakdownSubTab[])[]>(
+ const networkSubTabs = useMemo<BreakdownSubTab[]>(
() => [
- [
- { id: 'isp', label: t('project.mapping.isp'), dimension: 'isp' },
- {
- id: 'organization',
- label: t('project.mapping.og'),
- dimension: 'organization',
- },
- {
- id: 'user_type',
- label: t('project.mapping.ut'),
- dimension: 'user_type',
- },
- {
- id: 'connection_type',
- label: t('project.mapping.ctp'),
- dimension: 'connection_type',
- },
- ],
+ { id: 'isp', label: t('project.panelTabs.isp'), dimension: 'isp' },
+ {
+ id: 'organization',
+ label: t('project.panelTabs.organization'),
+ dimension: 'organization',
+ },
+ {
+ id: 'user_type',
+ label: t('project.panelTabs.user_type'),
+ dimension: 'user_type',
+ },
+ {
+ id: 'connection_type',
+ label: t('project.panelTabs.connection_type'),
+ dimension: 'connection_type',
+ },
],
[t],
)
diff --git a/web/app/styles/index.css b/web/app/styles/index.css
index 274b31496..016c7b070 100644
--- a/web/app/styles/index.css
+++ b/web/app/styles/index.css
@@ -24,19 +24,6 @@
scrollbar-width: thin;
}
-.panel-header-actions:has([aria-expanded='true']) {
- scrollbar-width: none;
-}
-
-.panel-header-actions:has([aria-expanded='true'])::-webkit-scrollbar {
- display: none;
-}
-
-.panel-header-actions button[aria-haspopup='menu'] > svg {
- transform: none;
- transition: none;
-}
-
/* custom scrollbar */
::-webkit-scrollbar {
width: 5px;
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index f9dea084c..fe5a36997 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -1779,6 +1779,8 @@
"percentage": "Percentage",
"stackTraceXFrames": "Stack trace ({{x}} frames)",
"metadata": "Metadata",
+ "pageProperties": "Page properties",
+ "searchMetadata": "Search properties and events…",
"aiDetailsDesc": "The buttons above allow you to see an estimate of what kind of traffic you can expect within an hour in the next X hours.",
"search": "Search",
"segments": "Segments",
@@ -2074,6 +2076,34 @@
"noReplaysFiltersTitle": "No replays found",
"noReplaysFiltersDesc": "No replays match this period and filter set. Try changing the date range or filters.",
"noCaptchaEv": "No CAPTCHA events were recorded for this period.\nIf you have not set up CAPTCHA yet, see the <url>docs</url> to add it to your app.",
+ "panelTabs": {
+ "country": "Countries",
+ "region": "Regions",
+ "city": "Cities",
+ "locale": "Locales",
+ "page": "Pages",
+ "entry_page": "Entry pages",
+ "exit_page": "Exit pages",
+ "host": "Hosts",
+ "browser": "Browsers",
+ "os": "Operating systems",
+ "device": "Device types",
+ "referrer": "Referrers",
+ "isp": "ISPs",
+ "organization": "Organisations",
+ "user_type": "Usage types",
+ "connection_type": "Connection types",
+ "utm_source": "UTM Sources",
+ "utm_medium": "UTM Mediums",
+ "utm_campaign": "UTM Campaigns",
+ "utm_term": "UTM Terms",
+ "utm_content": "UTM Content",
+ "query": "Queries",
+ "captcha_event": "Challenge statuses",
+ "captcha_difficulty": "Difficulty levels",
+ "solve_time": "Solve times",
+ "captcha_reason": "Auto difficulty reasons"
+ },
"mapping": {
"cc": "Country",
"rg": "Region",
@@ -2108,7 +2138,7 @@
"aiReferral": "AI referral",
"captcha_event": "Challenge status",
"captcha_difficulty": "Difficulty",
- "captcha_reason": "Auto difficulty reasons",
+ "captcha_reason": "Auto difficulty reason",
"solve_time": "Solve time"
},
"usageTypeMapping": {