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 data deletion modal

Blue Mouse0676eabaebef
diff --git a/backend/apps/cloud/src/analytics/analytics.service.ts b/backend/apps/cloud/src/analytics/analytics.service.ts
index 9c514dc74..05f5d88e1 100644
--- a/backend/apps/cloud/src/analytics/analytics.service.ts
+++ b/backend/apps/cloud/src/analytics/analytics.service.ts
@@ -144,6 +144,12 @@ const MAX_FILTER_VALUES = 100
// Event types that can be targeted by the data-deletion tool.
const DELETABLE_EVENT_TYPES = [...DATA_DELETION_EVENT_TYPES]
+// The subset that actually lives in the `events` table. Session replays are
+// stored separately (session_replay_chunks + object storage), so they are
+// counted and deleted on their own path.
+const EVENT_TABLE_DELETION_TYPES = DELETABLE_EVENT_TYPES.filter(
+ (type) => type !== 'session_replay',
+)
// Sentinel bounds used when no explicit date range is given, so that
// session-scoped filters (entry/exit page, referrer) still resolve.
const DELETION_MIN_DATE = '2000-01-01 00:00:00'
@@ -1660,7 +1666,7 @@ export class AnalyticsService {
const params: Record<string, unknown> = {
pid,
- types: DELETABLE_EVENT_TYPES,
+ types: EVENT_TABLE_DELETION_TYPES,
groupFrom: from || DELETION_MIN_DATE,
groupTo: to || DELETION_MAX_DATE,
...filtersParams,
@@ -1704,6 +1710,21 @@ export class AnalyticsService {
}
}
+ // Session replays aren't rows in the `events` table, so count them
+ // separately using the same date range + (filter-resolved) sessions.
+ const replayCount = await this.countMatchingSessionReplays(
+ pid,
+ filtersQuery,
+ filtersParams,
+ from,
+ to,
+ dateRange.condition,
+ )
+ if (replayCount > 0) {
+ counts.session_replay = replayCount
+ total += replayCount
+ }
+
if (total === 0) {
return { counts: {}, total: 0, timeline: { x: [], counts: [] } }
}
@@ -1725,6 +1746,114 @@ export class AnalyticsService {
return { counts, total, timeline }
}
+ // session_replay_chunks carries no traffic columns, so when field filters are
+ // present the matching sessions are resolved from the `events` table by psid.
+ // The clause is shared by the preview count and the actual deletion so that
+ // what the user previews is exactly what gets removed.
+ private buildSessionReplayDeletionWhere(
+ filtersQuery: string,
+ dateCondition: string,
+ ): string {
+ const psidFilter = _isEmpty(filtersQuery)
+ ? ''
+ : `AND psid IN (SELECT DISTINCT psid FROM events WHERE pid = {pid:FixedString(12)} ${dateCondition} ${filtersQuery})`
+
+ return `pid = {pid:FixedString(12)} ${dateCondition} ${psidFilter}`
+ }
+
+ private buildSessionReplayDeletionParams(
+ pid: string,
+ filtersParams: Record<string, unknown>,
+ from: string | null,
+ to: string | null,
+ ): Record<string, unknown> {
+ return {
+ pid,
+ groupFrom: from || DELETION_MIN_DATE,
+ groupTo: to || DELETION_MAX_DATE,
+ ...filtersParams,
+ ...(from ? { from } : {}),
+ ...(to ? { to } : {}),
+ }
+ }
+
+ private async countMatchingSessionReplays(
+ pid: string,
+ filtersQuery: string,
+ filtersParams: Record<string, unknown>,
+ from: string | null,
+ to: string | null,
+ dateCondition: string,
+ ): Promise<number> {
+ if (!this.sessionReplayStorage.isConfigured()) {
+ return 0
+ }
+
+ const where = this.buildSessionReplayDeletionWhere(
+ filtersQuery,
+ dateCondition,
+ )
+
+ const { data } = await clickhouse
+ .query({
+ query: `SELECT count(DISTINCT replayId) AS c FROM session_replay_chunks WHERE ${where}`,
+ query_params: this.buildSessionReplayDeletionParams(
+ pid,
+ filtersParams,
+ from,
+ to,
+ ),
+ })
+ .then((resultSet) => resultSet.json<{ c: string }>())
+
+ return Number(data[0]?.c) || 0
+ }
+
+ // Removes every replay matching the deletion query: first the object-storage
+ // payloads, then the chunk rows. Mirrors deleteSessionReplay's two-step delete.
+ private async deleteMatchingSessionReplays(
+ pid: string,
+ filtersQuery: string,
+ filtersParams: Record<string, unknown>,
+ from: string | null,
+ to: string | null,
+ dateCondition: string,
+ ): Promise<void> {
+ if (!this.sessionReplayStorage.isConfigured()) {
+ return
+ }
+
+ const where = this.buildSessionReplayDeletionWhere(
+ filtersQuery,
+ dateCondition,
+ )
+ const params = this.buildSessionReplayDeletionParams(
+ pid,
+ filtersParams,
+ from,
+ to,
+ )
+
+ const { data: chunks } = await clickhouse
+ .query({
+ query: `SELECT DISTINCT objectKey FROM session_replay_chunks WHERE ${where}`,
+ query_params: params,
+ })
+ .then((resultSet) => resultSet.json<{ objectKey: string }>())
+
+ const objectKeys = chunks.map((chunk) => chunk.objectKey).filter(Boolean)
+
+ await mapLimit(objectKeys, SESSION_REPLAY_CHUNK_FETCH_CONCURRENCY, (key) =>
+ this.sessionReplayStorage.deleteObject(key),
+ )
+
+ await clickhouse.command({
+ query: `ALTER TABLE session_replay_chunks DELETE WHERE ${where}`,
+ query_params: params,
+ clickhouse_settings: { mutations_sync: '2' },
+ })
+ }
+
private getDataDeletionDateRange(from: string | null, to: string | null) {
const normalizedFrom = from
? dayjs.utc(from).format('YYYY-MM-DD HH:mm:ss')
@@ -1817,6 +1946,10 @@ export class AnalyticsService {
throw new BadRequestException('No event types selected for deletion')
}
+ const eventTableTypes = _filter(safeTypes, (type) =>
+ _includes(EVENT_TABLE_DELETION_TYPES, type),
+ )
+
const [filtersQuery, filtersParams] = this.getFiltersQuery(
filters,
DataType.ANALYTICS,
@@ -1828,7 +1961,7 @@ export class AnalyticsService {
const params: Record<string, unknown> = {
pid,
- types: safeTypes,
+ types: eventTableTypes,
groupFrom: from || DELETION_MIN_DATE,
groupTo: to || DELETION_MAX_DATE,
...filtersParams,
@@ -1836,31 +1969,48 @@ export class AnalyticsService {
...(to ? { to } : {}),
}
- const commands: Promise<unknown>[] = [
- clickhouse.command({
- query: `ALTER TABLE events DELETE WHERE pid = {pid:FixedString(12)} AND type IN ({types:Array(String)}) ${dateRange.condition} ${filtersQuery}`,
- query_params: params,
- clickhouse_settings: { mutations_sync: '2' },
- }),
- ]
+ const commands: Promise<unknown>[] = []
- // error_statuses carries no traffic columns, so it can only be cleared when
- // no field filters are applied (a full reset or a plain date-range reset).
- if (_includes(safeTypes, 'error') && _isEmpty(filtersQuery)) {
+ if (!_isEmpty(eventTableTypes)) {
commands.push(
clickhouse.command({
- query: `ALTER TABLE error_statuses DELETE WHERE pid = {pid:FixedString(12)} ${dateRange.condition}`,
- query_params: {
- pid,
- ...(from ? { from } : {}),
- ...(to ? { to } : {}),
- },
+ query: `ALTER TABLE events DELETE WHERE pid = {pid:FixedString(12)} AND type IN ({types:Array(String)}) ${dateRange.condition} ${filtersQuery}`,
+ query_params: params,
clickhouse_settings: { mutations_sync: '2' },
}),
)
+
+ // error_statuses carries no traffic columns, so it can only be cleared
+ // when no field filters are applied (a full or plain date-range reset).
+ if (_includes(safeTypes, 'error') && _isEmpty(filtersQuery)) {
+ commands.push(
+ clickhouse.command({
+ query: `ALTER TABLE error_statuses DELETE WHERE pid = {pid:FixedString(12)} ${dateRange.condition}`,
+ query_params: {
+ pid,
+ ...(from ? { from } : {}),
+ ...(to ? { to } : {}),
+ },
+ clickhouse_settings: { mutations_sync: '2' },
+ }),
+ )
+ }
}
await Promise.all(commands)
+
+ // Session replays live in their own table + object storage, so they are
+ // removed on a dedicated path after the events-table mutations settle.
+ if (_includes(safeTypes, 'session_replay')) {
+ await this.deleteMatchingSessionReplays(
+ pid,
+ filtersQuery,
+ filtersParams,
+ from,
+ to,
+ dateRange.condition,
+ )
+ }
}
derivePsidFromInputs(
diff --git a/backend/apps/cloud/src/analytics/dto/data-deletion.dto.ts b/backend/apps/cloud/src/analytics/dto/data-deletion.dto.ts
index b1d806853..bef99385a 100644
--- a/backend/apps/cloud/src/analytics/dto/data-deletion.dto.ts
+++ b/backend/apps/cloud/src/analytics/dto/data-deletion.dto.ts
@@ -16,6 +16,9 @@ export const DATA_DELETION_EVENT_TYPES = [
'error',
'performance',
'captcha',
+ // Session replays live in a separate table (session_replay_chunks) + object
+ // storage rather than the `events` table; deletion is handled specially.
+ 'session_replay',
] as const
export type DataDeletionEventType = (typeof DATA_DELETION_EVENT_TYPES)[number]
@@ -64,7 +67,7 @@ export class DataDeletionDto extends DataDeletionPreviewDto {
type: [String],
enum: DATA_DELETION_EVENT_TYPES,
description:
- "Event types to delete. Any of: 'pageview', 'custom_event', 'error', 'performance', 'captcha'.",
+ "Event types to delete. Any of: 'pageview', 'custom_event', 'error', 'performance', 'captcha', 'session_replay'.",
})
@IsArray()
@ArrayNotEmpty()
diff --git a/web/app/pages/Project/Settings/components/DeleteDataModal.tsx b/web/app/pages/Project/Settings/components/DeleteDataModal.tsx
index 42e455844..3c34720f6 100644
--- a/web/app/pages/Project/Settings/components/DeleteDataModal.tsx
+++ b/web/app/pages/Project/Settings/components/DeleteDataModal.tsx
@@ -1,3 +1,12 @@
+import {
+ CheckIcon,
+ CursorClickIcon,
+ EyeIcon,
+ GaugeIcon,
+ MonitorPlayIcon,
+ ShieldCheckIcon,
+ WarningIcon,
+} from '@phosphor-icons/react'
import dayjs from 'dayjs'
import { useEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -6,10 +15,12 @@ import { toast } from 'sonner'
import type { DataDeletionPreview } from '~/api/api.server'
import { useDataDeletionPreviewProxy } from '~/hooks/useAnalyticsProxy'
+import { isSelfhosted } from '~/lib/constants'
import type { ProjectSettingsActionData } from '~/routes/projects.settings.$id'
import DatePicker from '~/ui/Datepicker'
import HoldToConfirmButton from '~/ui/HoldToConfirmButton'
import Modal from '~/ui/Modal'
+import { Text } from '~/ui/Text'
import { cn } from '~/utils/generic'
import FilterRowsEditor from '../../View/components/FilterRowsEditor'
@@ -27,19 +38,49 @@ const PERIODS: { key: PeriodKey; labelKey: string }[] = [
{ key: 'custom', labelKey: 'project.settings.deleteData.periods.custom' },
]
-// Order mirrors how prominent each type is for a typical cleanup.
-const EVENT_TYPES: { key: string; labelKey: string }[] = [
- { key: 'pageview', labelKey: 'project.settings.deleteData.types.pageview' },
+interface EventType {
+ key: string
+ labelKey: string
+ Icon: React.ElementType
+}
+
+// Order mirrors how prominent each type is for a typical cleanup. Session
+// replays are cloud-only — self-hosted has no replay storage.
+const EVENT_TYPES: EventType[] = [
+ {
+ key: 'pageview',
+ labelKey: 'project.settings.deleteData.types.pageview',
+ Icon: EyeIcon,
+ },
{
key: 'custom_event',
labelKey: 'project.settings.deleteData.types.custom_event',
+ Icon: CursorClickIcon,
+ },
+ {
+ key: 'error',
+ labelKey: 'project.settings.deleteData.types.error',
+ Icon: WarningIcon,
},
- { key: 'error', labelKey: 'project.settings.deleteData.types.error' },
{
key: 'performance',
labelKey: 'project.settings.deleteData.types.performance',
+ Icon: GaugeIcon,
},
- { key: 'captcha', labelKey: 'project.settings.deleteData.types.captcha' },
+ {
+ key: 'captcha',
+ labelKey: 'project.settings.deleteData.types.captcha',
+ Icon: ShieldCheckIcon,
+ },
+ ...(isSelfhosted
+ ? []
+ : [
+ {
+ key: 'session_replay',
+ labelKey: 'project.settings.deleteData.types.session_replay',
+ Icon: MonitorPlayIcon,
+ },
+ ]),
]
const DEFAULT_TYPES = ['pageview', 'custom_event']
@@ -74,6 +115,20 @@ const computeRange = (period: PeriodKey, customRange: Date[]): DateRange => {
}
}
+// Small uppercase section heading, matching the rest of the settings UI.
+const SectionLabel = ({ children }: { children: React.ReactNode }) => (
+ <Text
+ as='p'
+ size='xs'
+ weight='medium'
+ colour='muted'
+ tracking='wide'
+ className='uppercase'
+ >
+ {children}
+ </Text>
+)
+
// Lightweight, dependency-free sparkline of the matching events over time.
// Bars read as "the data you're about to delete", so they're tinted red.
const MatchingTimeline = ({
@@ -91,7 +146,7 @@ const MatchingTimeline = ({
return (
<div
className={cn(
- 'flex h-16 items-end gap-px border-b border-gray-200 transition-opacity duration-200 dark:border-slate-800',
+ 'flex h-14 items-end gap-px transition-opacity duration-200',
loading && counts.length ? 'opacity-40' : 'opacity-100',
)}
>
@@ -111,7 +166,7 @@ const MatchingTimeline = ({
title={label || undefined}
>
<div
- className='absolute inset-x-0 bottom-0 rounded-sm bg-red-400/80 transition-[height] duration-200 ease-out dark:bg-red-500/70'
+ className='absolute inset-x-0 bottom-0 rounded-sm bg-red-400/80 transition-[height] duration-200 ease-out dark:bg-red-500/60'
style={{
height: count > 0 ? `max(2px, ${ratio * 100}%)` : '0px',
}}
@@ -124,6 +179,92 @@ const MatchingTimeline = ({
)
}
+// A single togglable row in the breakdown: check indicator, icon, label and a
+// right-aligned count. Replaces the old pill/badge cluster.
+const TypeRow = ({
+ Icon,
+ label,
+ count,
+ selected,
+ disabled,
+ loading,
+ onToggle,
+ language,
+}: {
+ Icon: React.ElementType
+ label: string
+ count: number
+ selected: boolean
+ disabled: boolean
+ loading: boolean
+ onToggle: () => void
+ language: string
+}) => (
+ <button
+ type='button'
+ aria-pressed={selected}
+ disabled={disabled}
+ onClick={onToggle}
+ className={cn(
+ 'group flex w-full items-center gap-3 px-3.5 py-2.5 text-left transition-colors',
+ disabled
+ ? 'cursor-not-allowed'
+ : 'cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-900/50',
+ )}
+ >
+ <span
+ aria-hidden
+ className={cn(
+ 'flex size-4 shrink-0 items-center justify-center rounded-[5px] ring-1 transition-colors ring-inset',
+ disabled
+ ? 'bg-gray-100 ring-gray-200 dark:bg-slate-900 dark:ring-slate-800'
+ : selected
+ ? 'bg-slate-900 ring-slate-900 dark:bg-slate-100 dark:ring-slate-100'
+ : 'bg-white ring-gray-300 group-hover:ring-gray-400 dark:bg-slate-950 dark:ring-slate-700/80 dark:group-hover:ring-slate-600',
+ )}
+ >
+ {selected && !disabled ? (
+ <CheckIcon
+ weight='bold'
+ className='size-3 text-white dark:text-slate-900'
+ />
+ ) : null}
+ </span>
+ <Icon
+ weight='regular'
+ className={cn(
+ 'size-4 shrink-0',
+ disabled
+ ? 'text-gray-300 dark:text-slate-700'
+ : 'text-gray-400 dark:text-slate-500',
+ )}
+ />
+ <span
+ className={cn(
+ 'flex-1 truncate text-sm',
+ disabled
+ ? 'text-gray-400 dark:text-slate-600'
+ : 'font-medium text-gray-700 dark:text-gray-200',
+ )}
+ >
+ {label}
+ </span>
+ <span
+ className={cn(
+ 'text-sm tabular-nums transition-opacity duration-200',
+ loading && 'opacity-40',
+ disabled
+ ? 'text-gray-300 dark:text-slate-700'
+ : selected
+ ? 'font-semibold text-gray-900 dark:text-gray-50'
+ : 'text-gray-400 line-through dark:text-slate-600',
+ )}
+ >
+ {count.toLocaleString(language)}
+ </span>
+ </button>
+)
+
interface DeleteDataModalProps {
pid: string
isOpen: boolean
@@ -225,7 +366,7 @@ const DeleteDataModal = ({ pid, isOpen, onClose }: DeleteDataModalProps) => {
const countFor = (type: string) => preview?.counts?.[type] ?? 0
- // Until the user touches a chip, default to every type that actually matches.
+ // Until the user touches a row, default to every type that actually matches.
const autoTypes = useMemo(() => {
const matching = EVENT_TYPES.filter((type) => countFor(type.key) > 0).map(
(type) => type.key,
@@ -278,19 +419,31 @@ const DeleteDataModal = ({ pid, isOpen, onClose }: DeleteDataModalProps) => {
fetcher.submit(formData, { method: 'post' })
}
- const rangeSummary = useMemo(() => {
+ const rangeCaption = useMemo(() => {
if (period === 'all') {
- return t('project.settings.deleteData.summaryAllTime')
+ return t('project.settings.deleteData.allTime')
}
if (range.from && range.to) {
- return t('project.settings.deleteData.summaryRange', {
- from: dayjs(range.from).format('MMM D, YYYY'),
- to: dayjs(range.to).format('MMM D, YYYY'),
- })
+ return `${dayjs(range.from).format('MMM D, YYYY')} – ${dayjs(range.to).format('MMM D, YYYY')}`
}
return ''
}, [period, range.from, range.to, t])
+ const showBreakdown =
+ range.ready && !previewError && Boolean(preview) && hasAnyMatch
+
+ // What to show when there's nothing to break down (loading / empty / error).
+ const statusMessage = previewError
+ ? { text: t('project.settings.deleteData.previewError'), tone: 'error' }
+ : !range.ready
+ ? {
+ text: t('project.settings.deleteData.customRangePrompt'),
+ tone: 'mut',
+ }
+ : !preview
+ ? { text: t('project.settings.deleteData.calculating'), tone: 'mut' }
+ : { text: t('project.settings.deleteData.noMatch'), tone: 'mut' }
+
return (
<Modal
type='error'
@@ -314,17 +467,17 @@ const DeleteDataModal = ({ pid, isOpen, onClose }: DeleteDataModalProps) => {
</HoldToConfirmButton>
}
message={
- <div className='space-y-5'>
+ <div className='space-y-6'>
<p className='text-sm text-gray-500 dark:text-gray-400'>
{t('project.settings.deleteData.intro')}
</p>
{/* Date range */}
- <div className='space-y-2'>
- <p className='text-xs font-medium tracking-wide text-gray-500 uppercase dark:text-gray-400'>
+ <div className='space-y-2.5'>
+ <SectionLabel>
{t('project.settings.deleteData.dateRange')}
- </p>
- <div className='inline-flex flex-wrap gap-1 rounded-lg bg-gray-100 p-1 dark:bg-slate-900'>
+ </SectionLabel>
+ <div className='flex flex-wrap gap-1 rounded-lg bg-gray-100 p-1 dark:bg-slate-900'>
{PERIODS.map(({ key, labelKey }) => (
<button
key={key}
@@ -353,10 +506,10 @@ const DeleteDataModal = ({ pid, isOpen, onClose }: DeleteDataModalProps) => {
</div>
{/* Filters */}
- <div className='space-y-2'>
- <p className='text-xs font-medium tracking-wide text-gray-500 uppercase dark:text-gray-400'>
+ <div className='space-y-2.5'>
+ <SectionLabel>
{t('project.settings.deleteData.matching')}
- </p>
+ </SectionLabel>
<FilterRowsEditor
active={isOpen}
projectId={pid}
@@ -364,86 +517,80 @@ const DeleteDataModal = ({ pid, isOpen, onClose }: DeleteDataModalProps) => {
tnMapping={EMPTY_TN_MAPPING}
onChange={setFilters}
/>
- <p className='text-xs text-gray-400 dark:text-gray-500'>
+ <Text as='p' size='xs' colour='muted' className='leading-relaxed'>
{t('project.settings.deleteData.filtersHint')}
- </p>
+ </Text>
</div>
{/* Preview */}
- <div className='rounded-lg border border-gray-200 bg-gray-50/60 p-4 dark:border-slate-800 dark:bg-slate-900/40'>
- <MatchingTimeline
- timeline={preview?.timeline}
- loading={previewLoading}
- language={language}
- />
-
- <div className='mt-3 flex items-baseline gap-2'>
- {previewError ? (
- <span className='text-sm text-red-600 dark:text-red-400'>
- {t('project.settings.deleteData.previewError')}
- </span>
- ) : !range.ready ? (
- <span className='text-sm text-gray-500 dark:text-gray-400'>
- {t('project.settings.deleteData.customRangePrompt')}
- </span>
- ) : preview && !hasAnyMatch ? (
- <span className='text-sm text-gray-500 dark:text-gray-400'>
- {t('project.settings.deleteData.noMatch')}
- </span>
- ) : !preview ? (
- <span className='text-sm text-gray-400 dark:text-gray-500'>
- {t('project.settings.deleteData.calculating')}
- </span>
- ) : (
+ <div className='space-y-2.5'>
+ <SectionLabel>
+ {t('project.settings.deleteData.breakdownTitle')}
+ </SectionLabel>
+ <div className='overflow-hidden rounded-xl border border-gray-200 dark:border-slate-800'>
+ {showBreakdown ? (
<>
+ <div className='space-y-1.5 px-3.5 pt-3.5 pb-3'>
+ <MatchingTimeline
+ timeline={preview?.timeline}
+ loading={previewLoading}
+ language={language}
+ />
+ {rangeCaption ? (
+ <Text as='p' size='xs' colour='muted'>
+ {rangeCaption}
+ </Text>
+ ) : null}
+ </div>
+
+ <div className='divide-y divide-gray-100 border-t border-gray-200 dark:divide-slate-800/60 dark:border-slate-800'>
+ {EVENT_TYPES.map((type) => {
+ const count = countFor(type.key)
+ return (
+ <TypeRow
+ key={type.key}
+ Icon={type.Icon}
+ label={t(type.labelKey)}
+ count={count}
+ selected={selectedTypes.has(type.key)}
+ disabled={count === 0}
+ loading={previewLoading}
+ onToggle={() => toggleType(type.key)}
+ language={language}
+ />
+ )
+ })}
+ </div>
+
+ <div className='flex items-center justify-between border-t border-gray-200 bg-gray-50/70 px-3.5 py-3 dark:border-slate-800 dark:bg-slate-900/40'>
+ <Text size='sm' weight='medium' colour='secondary'>
+ {t('project.settings.deleteData.total')}
+ </Text>
+ <span
+ className={cn(
+ 'text-lg font-bold text-red-600 tabular-nums transition-opacity duration-200 dark:text-red-400',
+ previewLoading && 'opacity-40',
+ )}
+ >
+ {selectedTotal.toLocaleString(language)}
+ </span>
+ </div>
+ </>
+ ) : (
+ <div className='flex min-h-28 items-center justify-center px-4 py-8 text-center'>
<span
className={cn(
- 'text-2xl font-bold text-red-600 tabular-nums transition-opacity dark:text-red-400',
- previewLoading && !preview ? 'opacity-40' : 'opacity-100',
+ 'text-sm',
+ statusMessage.tone === 'error'
+ ? 'text-red-600 dark:text-red-400'
+ : 'text-gray-500 dark:text-gray-400',
)}
>
- {selectedTotal.toLocaleString(language)}
+ {statusMessage.text}
</span>
- <span className='text-sm text-gray-500 dark:text-gray-400'>
- {t('project.settings.deleteData.willDelete')}
- {rangeSummary ? ` · ${rangeSummary}` : ''}
- </span>
- </>
+ </div>
)}
</div>
-
- {/* Per-type breakdown / toggles */}
- {preview && hasAnyMatch ? (
- <div className='mt-3 flex flex-wrap gap-1.5'>
- {EVENT_TYPES.map((type) => {
- const count = countFor(type.key)
- const isSelected = selectedTypes.has(type.key)
- const isEmpty = count === 0
-
- return (
- <button
- key={type.key}
- type='button'
- onClick={() => toggleType(type.key)}
- disabled={isEmpty}
- className={cn(
- 'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors active:scale-[0.97]',
- isEmpty
- ? 'cursor-not-allowed border-gray-200 text-gray-300 dark:border-slate-800 dark:text-slate-600'
- : isSelected
- ? 'border-red-300 bg-red-50 text-red-700 dark:border-red-500/40 dark:bg-red-500/10 dark:text-red-300'
- : 'border-gray-200 text-gray-500 hover:border-gray-300 dark:border-slate-700 dark:text-gray-400 dark:hover:border-slate-600',
- )}
- >
- {t(type.labelKey)}
- <span className='tabular-nums opacity-70'>
- {count.toLocaleString(language)}
- </span>
- </button>
- )
- })}
- </div>
- ) : null}
</div>
</div>
}
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index fb6984fc5..bcc27c06b 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -2632,8 +2632,12 @@
"custom_event": "Custom events",
"error": "Errors",
"performance": "Performance",
- "captcha": "CAPTCHA"
+ "captcha": "CAPTCHA",
+ "session_replay": "Session replays"
},
+ "breakdownTitle": "What will be deleted",
+ "total": "Total to delete",
+ "allTime": "All time",
"willDelete": "will be permanently deleted",
"holdToDeleteCount": "Hold to delete {{total}}",
"summaryAllTime": "across all time",