Skip to content

Commit 6da71e7

Browse files
authored
chore: make error tracking UI full with and remove card style (#42240)
1 parent 82628eb commit 6da71e7

File tree

8 files changed

+73
-58
lines changed

8 files changed

+73
-58
lines changed
-260 Bytes
Loading
-266 Bytes
Loading
-270 Bytes
Loading
-291 Bytes
Loading

products/error_tracking/frontend/components/DataSourceTable/DataSourceTable.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export interface DataSourceTableProps<T extends Record<string, any>> {
1010
dataSource: BuiltLogic<DataSourceLogic<T>>
1111
className?: string
1212
children?: React.ReactNode
13-
embedded?: boolean
13+
embedded?: LemonTableProps<T>['embedded']
14+
stealth?: LemonTableProps<T>['stealth']
1415
expandable?: LemonTableProps<T>['expandable']
1516
onRowClick?: (item: T, evt: MouseEvent) => void
1617
rowRibbonColor?: LemonTableProps<T>['rowRibbonColor']
@@ -20,6 +21,7 @@ export function DataSourceTable<T extends Record<string, any>>({
2021
dataSource,
2122
className,
2223
embedded = false,
24+
stealth = false,
2325
onRowClick,
2426
rowRibbonColor,
2527
expandable,
@@ -35,6 +37,7 @@ export function DataSourceTable<T extends Record<string, any>>({
3537
title: props.title,
3638
align: props.align,
3739
width: props.width,
40+
className: props.className,
3841
render: (_, record: T, recordIndex: number, rowCount: number) =>
3942
props.cellRenderer(record, recordIndex, rowCount),
4043
} as LemonTableColumn<T, keyof T | undefined>
@@ -47,10 +50,8 @@ export function DataSourceTable<T extends Record<string, any>>({
4750
}
4851
return {
4952
// onClick handler adds style to row we don't want
50-
onClick: (event: MouseEvent) => {
51-
onRowClick(record, event)
52-
},
53-
className: 'hover:bg-fill-highlight-50',
53+
onClick: (event: MouseEvent) => onRowClick(record, event),
54+
className: 'hover:bg-color-accent-highlight-secondary',
5455
}
5556
},
5657
[onRowClick]
@@ -62,6 +63,7 @@ export function DataSourceTable<T extends Record<string, any>>({
6263
columns={columns}
6364
loading={itemsLoading}
6465
embedded={embedded}
66+
stealth={stealth}
6567
onRow={onRow}
6668
className={className}
6769
footer={<DataSourceTableFooter dataSource={dataSource} />}
@@ -102,6 +104,7 @@ export interface DataSourceTableColumnProps<T> {
102104
title?: string
103105
align?: 'left' | 'right' | 'center'
104106
width?: string
107+
className?: string
105108
cellRenderer: (item: T, itemIdx: number, rowCount: number) => React.ReactNode
106109
}
107110

products/error_tracking/frontend/components/EventsTable/EventsTable.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { IconLink, IconPlayCircle } from 'lib/lemon-ui/icons'
1212
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
1313
import { isString } from 'lib/utils'
1414
import { copyToClipboard } from 'lib/utils/copyToClipboard'
15+
import { cn } from 'lib/utils/css-classes'
1516
import { PersonDisplay, PersonIcon } from 'scenes/persons/PersonDisplay'
1617
import { asDisplay } from 'scenes/persons/person-utils'
1718
import { urls } from 'scenes/urls'
@@ -32,10 +33,14 @@ export interface EventsTableProps {
3233
onEventSelect: (event: ErrorEventType | null) => void
3334
}
3435

35-
export function EventsTable({ query, queryKey, onEventSelect }: EventsTableProps): JSX.Element {
36+
export function EventsTable({ query, queryKey, onEventSelect, selectedEvent }: EventsTableProps): JSX.Element {
3637
const tagRenderer = useErrorTagRenderer()
3738
const dataSource = eventsSourceLogic({ queryKey, query })
3839

40+
function isEventSelected(record: ErrorEventType): boolean {
41+
return selectedEvent ? selectedEvent.uuid === record.uuid : false
42+
}
43+
3944
function renderTitle(record: ErrorEventType): JSX.Element {
4045
return (
4146
<LemonTableLink
@@ -74,13 +79,27 @@ export function EventsTable({ query, queryKey, onEventSelect }: EventsTableProps
7479
return <TZLabel time={record.timestamp} />
7580
}
7681

82+
function renderRowSelectedIndicator(record: ErrorEventType): JSX.Element {
83+
return (
84+
<div
85+
className={cn(
86+
'w-1 min-h-[84px]',
87+
isEventSelected(record)
88+
? 'bg-primary-3000 hover:bg-primary-3000'
89+
: 'hover:bg-color-accent-highlight-secondary'
90+
)}
91+
/>
92+
)
93+
}
94+
7795
return (
7896
<DataSourceTable<ErrorEventType>
7997
dataSource={dataSource}
8098
embedded
81-
onRowClick={undefined}
99+
onRowClick={(record) => onEventSelect(record)}
82100
className="overflow-auto"
83101
>
102+
<DataSourceTableColumn<ErrorEventType> className="p-0" cellRenderer={renderRowSelectedIndicator} />
84103
<DataSourceTableColumn<ErrorEventType> title="Exception" cellRenderer={renderTitle} />
85104
<DataSourceTableColumn<ErrorEventType> title="Labels" align="right" cellRenderer={renderAttributes} />
86105
<DataSourceTableColumn<ErrorEventType> title="Actions" align="right" cellRenderer={Actions} />

products/error_tracking/frontend/components/ExceptionCard/ExceptionCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { ErrorPropertiesLogicProps, errorPropertiesLogic } from 'lib/components/
88
import { ErrorEventType } from 'lib/components/Errors/types'
99
import { TZLabel } from 'lib/components/TZLabel'
1010
import { TabsPrimitive, TabsPrimitiveList, TabsPrimitiveTrigger } from 'lib/ui/TabsPrimitive/TabsPrimitive'
11-
import { cn } from 'lib/utils/css-classes'
1211

1312
import { ErrorTrackingRelationalIssue } from '~/queries/schema/schema-general'
1413

@@ -64,7 +63,7 @@ function ExceptionCardContent({ issue, issueLoading, timestamp, label }: Excepti
6463
const { setCurrentTab } = useActions(exceptionCardLogic)
6564

6665
return (
67-
<LemonCard hoverEffect={false} className={cn('p-0 relative overflow-y-auto w-full')}>
66+
<LemonCard hoverEffect={false} className="p-0 relative overflow-y-auto w-full border-0 rounded-none">
6867
<TabsPrimitive value={currentTab} onValueChange={setCurrentTab}>
6968
<div className="flex justify-between h-[2rem] items-center w-full px-2 border-b">
7069
<TabsPrimitiveList className="flex justify-between w-full h-full items-center">

products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useEffect } from 'react'
66
import { useRef } from 'react'
77

88
import { IconFilter, IconList, IconSearch } from '@posthog/icons'
9-
import { LemonCollapse, LemonDivider } from '@posthog/lemon-ui'
9+
import { LemonDivider } from '@posthog/lemon-ui'
1010

1111
import { Resizer } from 'lib/components/Resizer/Resizer'
1212
import { ResizerLogicProps, resizerLogic } from 'lib/components/Resizer/resizerLogic'
@@ -66,33 +66,36 @@ export function ErrorTrackingIssueScene(): JSX.Element {
6666
<ErrorTrackingSetupPrompt>
6767
<BindLogic logic={issueFiltersLogic} props={{ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY }}>
6868
{issue && (
69-
<div className="px-4">
70-
<SceneTitleSection
71-
canEdit
72-
name={issue.name}
73-
onNameChange={updateName}
74-
description={null}
75-
resourceType={{ type: 'error_tracking' }}
76-
actions={
77-
<div className="flex items-center gap-1">
78-
<IssueAssigneeSelect
79-
assignee={issue.assignee}
80-
onChange={updateAssignee}
81-
disabled={issue.status != 'active'}
82-
/>
83-
<IssueStatusSelect status={issue.status} onChange={updateStatus} />
84-
</div>
85-
}
86-
/>
87-
69+
<>
70+
<div className="px-4">
71+
<SceneTitleSection
72+
canEdit
73+
name={issue.name}
74+
onNameChange={updateName}
75+
description={null}
76+
resourceType={{ type: 'error_tracking' }}
77+
actions={
78+
<div className="flex items-center gap-1">
79+
<IssueAssigneeSelect
80+
assignee={issue.assignee}
81+
onChange={updateAssignee}
82+
disabled={issue.status != 'active'}
83+
/>
84+
<IssueStatusSelect status={issue.status} onChange={updateStatus} />
85+
</div>
86+
}
87+
/>
88+
</div>
8889
<ErrorTrackingIssueScenePanel issue={issue} />
89-
</div>
90-
)}
9190

92-
<div className="ErrorTrackingIssue flex h-[calc(100vh-var(--scene-layout-header-height)-50px)]">
93-
<LeftHandColumn />
94-
<RightHandColumn />
95-
</div>
91+
<div className="ErrorTrackingIssue h-[calc(100vh-var(--scene-layout-header-height)-50px)] flex">
92+
<div className="flex flex-1 h-full">
93+
<LeftHandColumn />
94+
<RightHandColumn />
95+
</div>
96+
</div>
97+
</>
98+
)}
9699
</BindLogic>
97100
</ErrorTrackingSetupPrompt>
98101
)
@@ -103,7 +106,7 @@ const RightHandColumn = (): JSX.Element => {
103106
const tagRenderer = useErrorTagRenderer()
104107

105108
return (
106-
<div className="flex flex-1 gap-y-1 px-4 py-3 overflow-y-auto min-w-[375px]">
109+
<div className="flex flex-1 gap-y-1 overflow-y-auto min-w-[375px]">
107110
<PostHogSDKIssueBanner event={selectedEvent} />
108111

109112
<ExceptionCard
@@ -139,7 +142,7 @@ const LeftHandColumn = (): JSX.Element => {
139142
width: desiredSize ?? '30%',
140143
minWidth: 320,
141144
}}
142-
className="flex flex-col relative bg-bg-light"
145+
className="flex flex-col relative bg-surface-primary"
143146
>
144147
<TabsPrimitive
145148
value={category}
@@ -148,7 +151,7 @@ const LeftHandColumn = (): JSX.Element => {
148151
>
149152
<div>
150153
<ScrollableShadows direction="horizontal" className="border-b" hideScrollbars>
151-
<TabsPrimitiveList className="flex justify-between space-x-2">
154+
<TabsPrimitiveList className="flex justify-between space-x-0.5">
152155
<TabsPrimitiveTrigger className="flex items-center px-2 py-1.5" value="exceptions">
153156
<IconList className="mr-1" />
154157
<span className="text-nowrap">Exceptions</span>
@@ -195,35 +198,26 @@ const LeftHandColumn = (): JSX.Element => {
195198
}
196199

197200
const ExceptionsTab = (): JSX.Element => {
198-
const { eventsQuery, eventsQueryKey } = useValues(errorTrackingIssueSceneLogic)
201+
const { eventsQuery, eventsQueryKey, selectedEvent } = useValues(errorTrackingIssueSceneLogic)
199202
const { selectEvent } = useActions(errorTrackingIssueSceneLogic)
200203

201204
return (
202205
<div className="flex flex-col h-full">
203-
<LemonCollapse
204-
embedded
205-
panels={[
206-
{
207-
key: 'filters',
208-
header: 'Add filters',
209-
content: (
210-
<ErrorFilters.Root>
211-
<div className="flex gap-2 justify-between flex-wrap">
212-
<ErrorFilters.DateRange />
213-
<ErrorFilters.InternalAccounts />
214-
</div>
215-
<ErrorFilters.FilterGroup />
216-
</ErrorFilters.Root>
217-
),
218-
},
219-
]}
220-
/>
206+
<div className="px-2 py-3">
207+
<ErrorFilters.Root>
208+
<div className="flex gap-2 justify-between flex-wrap">
209+
<ErrorFilters.DateRange />
210+
<ErrorFilters.InternalAccounts />
211+
</div>
212+
<ErrorFilters.FilterGroup />
213+
</ErrorFilters.Root>
214+
</div>
221215
<LemonDivider className="my-0" />
222216
<Metadata className="flex flex-col overflow-y-auto">
223217
<EventsTable
224218
query={eventsQuery}
225219
queryKey={eventsQueryKey}
226-
selectedEvent={null}
220+
selectedEvent={selectedEvent}
227221
onEventSelect={(selectedEvent) => {
228222
if (selectedEvent) {
229223
selectEvent(selectedEvent)

0 commit comments

Comments
 (0)