This commit is contained in:
Francis Cao
2026-03-04 21:30:21 -08:00
9 changed files with 11 additions and 17 deletions
@@ -9,16 +9,9 @@ export function BoardControls() {
?.flatMap(row => row.columns)
.map(column => column.component?.websiteId)
.filter(Boolean);
const fallbackWebsiteId =
componentWebsiteIds && new Set(componentWebsiteIds).size === 1
? componentWebsiteIds[0]
: undefined;
const fallbackWebsiteId = componentWebsiteIds?.[0];
const websiteId = boardWebsiteId || fallbackWebsiteId;
if (!websiteId) {
return null;
}
return (
<Box marginBottom="4">
<WebsiteControls websiteId={websiteId} />
@@ -13,7 +13,7 @@ export function WebsiteControls({
allowDownload = false,
allowCompare = false,
}: {
websiteId: string;
websiteId?: string;
allowFilter?: boolean;
allowBounceFilter?: boolean;
allowDateFilter?: boolean;
+1 -1
View File
@@ -17,7 +17,7 @@ import { X } from '@/components/icons';
import { isSearchOperator } from '@/lib/params';
export interface FilterRecordProps {
websiteId: string;
websiteId?: string;
type: string;
startDate: Date;
endDate: Date;
+1 -1
View File
@@ -23,7 +23,7 @@ import { type FieldGroup, useFields, useMessages, useMobile } from '@/components
import { Plus } from '@/components/icons';
export interface FieldFiltersProps {
websiteId: string;
websiteId?: string;
value?: { name: string; operator: string; value: string }[];
exclude?: string[];
match?: string;
+3 -2
View File
@@ -20,7 +20,7 @@ import {
import { Bookmark, X } from '@/components/icons';
import { isSearchOperator } from '@/lib/params';
export function FilterBar({ websiteId }: { websiteId: string }) {
export function FilterBar({ websiteId }: { websiteId?: string }) {
const { t, labels } = useMessages();
const { formatValue } = useFormat();
const {
@@ -32,7 +32,8 @@ export function FilterBar({ websiteId }: { websiteId: string }) {
} = useNavigation();
const { filters, operatorLabels } = useFilters();
const { data, isLoading } = useWebsiteSegmentQuery(websiteId, segment || cohort);
const canSaveSegment = filters.length > 0 && !segment && !cohort && !pathname.includes('/share');
const canSaveSegment =
!!websiteId && filters.length > 0 && !segment && !cohort && !pathname.includes('/share');
const handleCloseFilter = (param: string) => {
router.push(updateParams({ [param]: undefined }));
+1 -1
View File
@@ -27,7 +27,7 @@ export function FilterEditForm({ websiteId, onChange, onClose }: FilterEditFormP
const [currentCohort, setCurrentCohort] = useState(cohort);
const [currentMatch, setCurrentMatch] = useState<string>(match || 'all');
const { isMobile } = useMobile();
const excludeFilters = pathname.includes('/pixels') || pathname.includes('/links');
const excludeFilters = !websiteId || pathname.includes('/pixels') || pathname.includes('/links');
const excludeEvent = !pathname.endsWith('/events') && !pathname.endsWith('/replays');
const handleReset = () => {
+1 -1
View File
@@ -6,7 +6,7 @@ import { useWebsiteSegmentsQuery } from '@/components/hooks';
import { ChartPie, UserPlus } from '@/components/icons';
export interface SegmentFiltersProps {
websiteId: string;
websiteId?: string;
segmentId: string;
type?: string;
onChange?: (id: string, type: string) => void;
+1 -1
View File
@@ -7,7 +7,7 @@ import { getDateRangeValue } from '@/lib/date';
import { DateFilter } from './DateFilter';
export interface WebsiteDateFilterProps {
websiteId: string;
websiteId?: string;
compare?: string;
showAllTime?: boolean;
showButtons?: boolean;
+1 -1
View File
@@ -9,7 +9,7 @@ import { filtersArrayToObject } from '@/lib/params';
export function WebsiteFilterButton({
websiteId,
}: {
websiteId: string;
websiteId?: string;
position?: 'bottom' | 'top' | 'left' | 'right';
alignment?: 'end' | 'center' | 'start';
}) {