Skip to content

Commit

Permalink
Merge branch 'master' into feat/improve-counts-for-playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Mar 1, 2025
2 parents afe1047 + e6cdfed commit 52c44d1
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 17 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 24 additions & 15 deletions frontend/src/queries/nodes/DataTable/EventRowActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
import { getCurrentTeamId } from 'lib/utils/getAppContext'
import React from 'react'
import { createActionFromEvent } from 'scenes/activity/explore/createActionFromEvent'
import { insightUrlForEvent } from 'scenes/insights/utils'
import { teamLogic } from 'scenes/teamLogic'
Expand Down Expand Up @@ -40,21 +41,7 @@ export function EventRowActions({ event }: EventActionProps): JSX.Element {
Create action from event
</LemonButton>
)}
{event.uuid && event.timestamp && (
<LemonButton
fullWidth
sideIcon={<IconLink />}
data-attr="events-table-event-link"
onClick={() =>
void copyToClipboard(
urls.absolute(urls.currentProject(urls.event(String(event.uuid), event.timestamp))),
'link to event'
)
}
>
Copy link to event
</LemonButton>
)}
{event.uuid && event.timestamp && <EventCopyLinkButton event={event} />}
<ViewRecordingButton
fullWidth
inModal
Expand Down Expand Up @@ -94,3 +81,25 @@ export function EventRowActions({ event }: EventActionProps): JSX.Element {
/>
)
}

export const EventCopyLinkButton = React.forwardRef<
HTMLButtonElement,
{ event: Pick<EventType, 'uuid' | 'timestamp'> }
>(function EventCopyLinkButton({ event }, ref) {
return (
<LemonButton
ref={ref}
fullWidth
sideIcon={<IconLink />}
data-attr="events-table-event-link"
onClick={() =>
void copyToClipboard(
urls.absolute(urls.currentProject(urls.event(String(event.uuid), event.timestamp))),
'link to event'
)
}
>
Copy link to event
</LemonButton>
)
})
17 changes: 17 additions & 0 deletions frontend/src/scenes/activity/live/LiveEventsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { useActions, useValues } from 'kea'
import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { TZLabel } from 'lib/components/TZLabel'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonTable, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
import { liveEventsTableLogic } from 'scenes/activity/live/liveEventsTableLogic'
import { PersonDisplay } from 'scenes/persons/PersonDisplay'

import { EventCopyLinkButton } from '~/queries/nodes/DataTable/EventRowActions'
import type { LiveEvent } from '~/types'

const columns: LemonTableColumns<LiveEvent> = [
Expand Down Expand Up @@ -46,6 +48,21 @@ const columns: LemonTableColumns<LiveEvent> = [
return <TZLabel time={event.timestamp} />
},
},
{
dataIndex: '__more' as any,
render: function Render(_, event: LiveEvent) {
return (
<More
overlay={
<Tooltip title="It may take up to a few minutes for the event to show up in the Explore view">
<EventCopyLinkButton event={event} />
</Tooltip>
}
/>
)
},
width: 0,
},
]

export function LiveEventsTable(): JSX.Element {
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/scenes/retention/RetentionTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export function RetentionTable({ inSharedMode = false }: { inSharedMode?: boolea
percentage={
mean(
tableRows.map((row) => {
if (columnIndex >= row.length) {
return null
}

// Stop before the last item in a row, which is an incomplete time period
if (
(columnIndex >= row.length - 1 &&
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/scenes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ export const redirects: Record<
])
try {
const timestamp = decodeURIComponent(_)
const after = dayjs(timestamp).subtract(1, 'second').startOf('second').toISOString()
const before = dayjs(timestamp).add(1, 'second').startOf('second').toISOString()
const after = dayjs(timestamp).subtract(15, 'second').startOf('second').toISOString()
const before = dayjs(timestamp).add(15, 'second').startOf('second').toISOString()
Object.assign(query.source as EventsQuery, { before, after })
} catch (e) {
lemonToast.error('Invalid event timestamp')
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/surveys/surveysLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const surveysLogic = kea<surveysLogicType>([
if (searchTerm) {
searchedSurveys = new Fuse(searchedSurveys, {
keys: ['key', 'name'],
ignoreLocation: true,
threshold: 0.3,
})
.search(searchTerm)
Expand Down

0 comments on commit 52c44d1

Please sign in to comment.