chore(root): migrate to biome
This commit is contained in:
@@ -15,7 +15,7 @@ export function ReportLineType({ className }: ReportLineTypeProps) {
|
||||
const chartType = useSelector((state) => state.report.chartType);
|
||||
const type = useSelector((state) => state.report.lineType);
|
||||
|
||||
if (chartType != 'linear' && chartType != 'area') {
|
||||
if (chartType !== 'linear' && chartType !== 'area') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,20 +44,19 @@ export function ReportSaveButton({ className }: ReportSaveButtonProps) {
|
||||
Update
|
||||
</Button>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Button
|
||||
className={className}
|
||||
disabled={!report.dirty}
|
||||
onClick={() => {
|
||||
pushModal('SaveReport', {
|
||||
report,
|
||||
});
|
||||
}}
|
||||
icon={SaveIcon}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Button
|
||||
className={className}
|
||||
disabled={!report.dirty}
|
||||
onClick={() => {
|
||||
pushModal('SaveReport', {
|
||||
report,
|
||||
});
|
||||
}}
|
||||
icon={SaveIcon}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { PencilIcon } from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
|
||||
type Props = {
|
||||
name?: string;
|
||||
@@ -23,7 +23,7 @@ const EditReportName = ({ name }: Props) => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('report-name-change', {
|
||||
detail: newName === '' ? name : newName,
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
setIsEditing(false);
|
||||
@@ -33,8 +33,6 @@ const EditReportName = ({ name }: Props) => {
|
||||
return (
|
||||
<div className="flex">
|
||||
<input
|
||||
// eslint-disable-next-line jsx-a11y/no-autofocus
|
||||
autoFocus
|
||||
type="text"
|
||||
value={newName}
|
||||
onKeyDown={(e) => {
|
||||
@@ -53,6 +51,7 @@ const EditReportName = ({ name }: Props) => {
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="flex cursor-pointer select-none items-center gap-2"
|
||||
onClick={() => setIsEditing(true)}
|
||||
>
|
||||
|
||||
@@ -100,11 +100,11 @@ export const reportSlice = createSlice({
|
||||
state,
|
||||
action: PayloadAction<{
|
||||
id?: string;
|
||||
}>
|
||||
}>,
|
||||
) => {
|
||||
state.dirty = true;
|
||||
state.events = state.events.filter(
|
||||
(event) => event.id !== action.payload.id
|
||||
(event) => event.id !== action.payload.id,
|
||||
);
|
||||
},
|
||||
changeEvent: (state, action: PayloadAction<IChartEvent>) => {
|
||||
@@ -126,7 +126,7 @@ export const reportSlice = createSlice({
|
||||
// Breakdowns
|
||||
addBreakdown: (
|
||||
state,
|
||||
action: PayloadAction<Omit<IChartBreakdown, 'id'>>
|
||||
action: PayloadAction<Omit<IChartBreakdown, 'id'>>,
|
||||
) => {
|
||||
state.dirty = true;
|
||||
state.breakdowns.push({
|
||||
@@ -138,11 +138,11 @@ export const reportSlice = createSlice({
|
||||
state,
|
||||
action: PayloadAction<{
|
||||
id?: string;
|
||||
}>
|
||||
}>,
|
||||
) => {
|
||||
state.dirty = true;
|
||||
state.breakdowns = state.breakdowns.filter(
|
||||
(event) => event.id !== action.payload.id
|
||||
(event) => event.id !== action.payload.id,
|
||||
);
|
||||
},
|
||||
changeBreakdown: (state, action: PayloadAction<IChartBreakdown>) => {
|
||||
@@ -193,7 +193,7 @@ export const reportSlice = createSlice({
|
||||
action: PayloadAction<{
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
}>
|
||||
}>,
|
||||
) => {
|
||||
state.dirty = true;
|
||||
state.startDate = formatISO(startOfDay(action.payload.startDate));
|
||||
@@ -215,7 +215,7 @@ export const reportSlice = createSlice({
|
||||
|
||||
const interval = getDefaultIntervalByDates(
|
||||
state.startDate,
|
||||
state.endDate
|
||||
state.endDate,
|
||||
);
|
||||
if (interval) {
|
||||
state.interval = interval;
|
||||
@@ -229,7 +229,7 @@ export const reportSlice = createSlice({
|
||||
|
||||
const interval = getDefaultIntervalByDates(
|
||||
state.startDate,
|
||||
state.endDate
|
||||
state.endDate,
|
||||
);
|
||||
if (interval) {
|
||||
state.interval = interval;
|
||||
|
||||
@@ -30,7 +30,7 @@ export function EventPropertiesCombobox({
|
||||
},
|
||||
{
|
||||
enabled: !!event.name,
|
||||
}
|
||||
},
|
||||
).map((item) => ({
|
||||
label: item,
|
||||
value: item,
|
||||
@@ -47,14 +47,15 @@ export function EventPropertiesCombobox({
|
||||
changeEvent({
|
||||
...event,
|
||||
property: value,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className={cn(
|
||||
'flex items-center gap-1 rounded-md border border-border p-1 px-2 text-sm font-medium leading-none',
|
||||
!event.property && 'border-destructive text-destructive'
|
||||
!event.property && 'border-destructive text-destructive',
|
||||
)}
|
||||
>
|
||||
<DatabaseIcon size={12} />{' '}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { MoreHorizontal, Trash } from 'lucide-react';
|
||||
import * as React from 'react';
|
||||
|
||||
export interface ReportBreakdownMoreProps {
|
||||
onClick: (action: 'remove') => void;
|
||||
|
||||
@@ -60,7 +60,7 @@ export function ReportBreakdowns() {
|
||||
changeBreakdown({
|
||||
...item,
|
||||
name: value,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}}
|
||||
items={properties}
|
||||
@@ -80,7 +80,7 @@ export function ReportBreakdowns() {
|
||||
dispatch(
|
||||
addBreakdown({
|
||||
name: value,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}}
|
||||
items={properties}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
Command,
|
||||
@@ -22,6 +21,7 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { Filter, MoreHorizontal, Tags, Trash } from 'lucide-react';
|
||||
import * as React from 'react';
|
||||
|
||||
const labels = [
|
||||
'feature',
|
||||
|
||||
@@ -21,10 +21,10 @@ import {
|
||||
removeEvent,
|
||||
} from '../reportSlice';
|
||||
import { EventPropertiesCombobox } from './EventPropertiesCombobox';
|
||||
import { FiltersCombobox } from './filters/FiltersCombobox';
|
||||
import { FiltersList } from './filters/FiltersList';
|
||||
import { ReportEventMore } from './ReportEventMore';
|
||||
import type { ReportEventMoreProps } from './ReportEventMore';
|
||||
import { FiltersCombobox } from './filters/FiltersCombobox';
|
||||
import { FiltersList } from './filters/FiltersList';
|
||||
|
||||
export function ReportEvents() {
|
||||
const previous = useSelector((state) => state.report.previous);
|
||||
@@ -79,7 +79,7 @@ export function ReportEvents() {
|
||||
...event,
|
||||
name: value,
|
||||
filters: [],
|
||||
})
|
||||
}),
|
||||
);
|
||||
}}
|
||||
items={eventNames.map((item) => ({
|
||||
@@ -113,7 +113,7 @@ export function ReportEvents() {
|
||||
changeEvent({
|
||||
...event,
|
||||
segment,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}}
|
||||
items={[
|
||||
@@ -148,7 +148,10 @@ export function ReportEvents() {
|
||||
]}
|
||||
label="Segment"
|
||||
>
|
||||
<button className="flex items-center gap-1 rounded-md border border-border bg-card p-1 px-2 text-sm font-medium leading-none">
|
||||
<button
|
||||
type="button"
|
||||
className="flex items-center gap-1 rounded-md border border-border bg-card p-1 px-2 text-sm font-medium leading-none"
|
||||
>
|
||||
{event.segment === 'user' ? (
|
||||
<>
|
||||
<Users size={12} /> Unique users
|
||||
@@ -205,7 +208,7 @@ export function ReportEvents() {
|
||||
name: value,
|
||||
segment: 'event',
|
||||
filters: [],
|
||||
})
|
||||
}),
|
||||
);
|
||||
}}
|
||||
items={eventNames.map((item) => ({
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { ColorSquare } from '@/components/color-square';
|
||||
import { RenderDots } from '@/components/ui/RenderDots';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ComboboxAdvanced } from '@/components/ui/combobox-advanced';
|
||||
import { DropdownMenuComposed } from '@/components/ui/dropdown-menu';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { RenderDots } from '@/components/ui/RenderDots';
|
||||
import { useAppParams } from '@/hooks/useAppParams';
|
||||
import { useMappings } from '@/hooks/useMappings';
|
||||
import { usePropertyValues } from '@/hooks/usePropertyValues';
|
||||
import { useDispatch, useSelector } from '@/redux';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { RefreshCcwIcon, SlidersHorizontal, Trash } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { operators } from '@openpanel/constants';
|
||||
import type {
|
||||
@@ -41,31 +41,31 @@ interface PureFilterProps {
|
||||
onRemove: (filter: IChartEventFilter) => void;
|
||||
onChangeValue: (
|
||||
value: IChartEventFilterValue[],
|
||||
filter: IChartEventFilter
|
||||
filter: IChartEventFilter,
|
||||
) => void;
|
||||
onChangeOperator: (
|
||||
operator: IChartEventFilterOperator,
|
||||
filter: IChartEventFilter
|
||||
filter: IChartEventFilter,
|
||||
) => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function FilterItem({ filter, event }: FilterProps) {
|
||||
const { range, startDate, endDate, interval } = useSelector(
|
||||
(state) => state.report
|
||||
(state) => state.report,
|
||||
);
|
||||
const onRemove = ({ id }: IChartEventFilter) => {
|
||||
dispatch(
|
||||
changeEvent({
|
||||
...event,
|
||||
filters: event.filters.filter((item) => item.id !== id),
|
||||
})
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
const onChangeValue = (
|
||||
value: IChartEventFilterValue[],
|
||||
{ id }: IChartEventFilter
|
||||
{ id }: IChartEventFilter,
|
||||
) => {
|
||||
dispatch(
|
||||
changeEvent({
|
||||
@@ -80,13 +80,13 @@ export function FilterItem({ filter, event }: FilterProps) {
|
||||
|
||||
return item;
|
||||
}),
|
||||
})
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
const onChangeOperator = (
|
||||
operator: IChartEventFilterOperator,
|
||||
{ id }: IChartEventFilter
|
||||
{ id }: IChartEventFilter,
|
||||
) => {
|
||||
dispatch(
|
||||
changeEvent({
|
||||
@@ -102,7 +102,7 @@ export function FilterItem({ filter, event }: FilterProps) {
|
||||
|
||||
return item;
|
||||
}),
|
||||
})
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ export function FiltersCombobox({ event }: FiltersComboboxProps) {
|
||||
},
|
||||
{
|
||||
enabled: !!event.name,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -57,11 +57,14 @@ export function FiltersCombobox({ event }: FiltersComboboxProps) {
|
||||
value: [],
|
||||
},
|
||||
],
|
||||
})
|
||||
}),
|
||||
);
|
||||
}}
|
||||
>
|
||||
<button className="flex items-center gap-1 rounded-md border border-border bg-card p-1 px-2 text-sm font-medium leading-none">
|
||||
<button
|
||||
type="button"
|
||||
className="flex items-center gap-1 rounded-md border border-border bg-card p-1 px-2 text-sm font-medium leading-none"
|
||||
>
|
||||
<FilterIcon size={12} /> Add filter
|
||||
</button>
|
||||
</Combobox>
|
||||
|
||||
Reference in New Issue
Block a user