Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into by/onboarding-in-app
Browse files Browse the repository at this point in the history
  • Loading branch information
Bianca Yang committed Feb 9, 2024
2 parents 7f8e1c7 + 6b258dc commit d96d1e2
Show file tree
Hide file tree
Showing 69 changed files with 2,370 additions and 428 deletions.
Binary file modified frontend/__snapshots__/exporter-exporter--dashboard--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,9 @@ const api = {
? new ApiRequest().notebook(`${activityLogProps.id}`).withAction('activity')
: new ApiRequest().notebooks().withAction('activity')
},
[ActivityScope.TEAM]: () => {
return new ApiRequest().projectsDetail().withAction('activity')
},
}

const pagingParameters = { page: page || 1, limit: ACTIVITY_PAGE_SIZE }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
featureFlagsActivityResponseJson,
insightsActivityResponseJson,
personActivityResponseJson,
teamActivityResponseJson,
} from 'lib/components/ActivityLog/__mocks__/activityLogMocks'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'

Expand Down Expand Up @@ -37,6 +38,10 @@ const meta: Meta<typeof ActivityLog> = {
ctx.status(200),
ctx.json({ results: personActivityResponseJson }),
],
'/api/projects/:id/activity': (_, __, ctx) => [
ctx.status(200),
ctx.json({ results: teamActivityResponseJson }),
],
},
}),
],
Expand All @@ -59,6 +64,10 @@ export function PersonsActivity(): JSX.Element {
return <ActivityLog scope={ActivityScope.PERSON} id={12} />
}

export function TeamActivity(): JSX.Element {
return <ActivityLog scope={ActivityScope.TEAM} id={12} />
}

export function WithCaption(): JSX.Element {
return (
<ActivityLog
Expand Down
125 changes: 125 additions & 0 deletions frontend/src/lib/components/ActivityLog/__mocks__/activityLogMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,131 @@ import { ActivityLogItem } from 'lib/components/ActivityLog/humanizeActivity'

import { ActivityScope, InsightShortId } from '~/types'

export const teamActivityResponseJson: ActivityLogItem[] = [
{
user: {
first_name: 'sdavasdadadsadas',
last_name: '',
email: '[email protected]',
},
unread: false,
is_staff: false,
is_system: false,
activity: 'updated',
item_id: '1',
scope: ActivityScope.TEAM,
detail: {
name: 'Default Project',
type: undefined,
merge: null,
changes: [
{
type: ActivityScope.TEAM,
after: 2000,
field: 'session_recording_minimum_duration_milliseconds',
action: 'created',
before: null,
},
],
trigger: null,
short_id: null,
},
created_at: '2024-02-08T19:23:53.530402Z',
},
{
user: {
first_name: 'sdavasdadadsadas',
last_name: '',
email: '[email protected]',
},
unread: false,
is_staff: false,
is_system: false,
activity: 'updated',
item_id: '1',
scope: ActivityScope.TEAM,
detail: {
name: 'Default Project',
type: undefined,
merge: null,
changes: [
{
type: ActivityScope.TEAM,
after: {
record_canvas: true,
},
field: 'session_replay_config',
action: 'created',
before: null,
},
],
trigger: null,
short_id: null,
},
created_at: '2024-02-08T19:23:48.099540Z',
},
{
user: {
first_name: 'sdavasdadadsadas',
last_name: '',
email: '[email protected]',
},
unread: false,
is_staff: false,
is_system: false,
activity: 'updated',
item_id: '1',
scope: ActivityScope.TEAM,
detail: {
name: 'Default Project',
type: undefined,
merge: null,
changes: [
{
type: ActivityScope.TEAM,
after: true,
field: 'capture_console_log_opt_in',
action: 'changed',
before: false,
},
],
trigger: null,
short_id: null,
},
created_at: '2024-02-08T19:23:46.325979Z',
},
{
user: {
first_name: 'sdavasdadadsadas',
last_name: '',
email: '[email protected]',
},
unread: false,
is_staff: false,
is_system: false,
activity: 'updated',
item_id: '1',
scope: ActivityScope.TEAM,
detail: {
name: 'Default Project',
type: undefined,
merge: null,
changes: [
{
type: ActivityScope.TEAM,
after: false,
field: 'capture_console_log_opt_in',
action: 'changed',
before: true,
},
],
trigger: null,
short_id: null,
},
created_at: '2024-02-08T19:23:44.851511Z',
},
]

export const featureFlagsActivityResponseJson: ActivityLogItem[] = [
{
user: {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lib/components/ActivityLog/activityLogLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { notebookActivityDescriber } from 'scenes/notebooks/Notebook/notebookAct
import { personActivityDescriber } from 'scenes/persons/activityDescriptions'
import { pluginActivityDescriber } from 'scenes/plugins/pluginActivityDescriptions'
import { insightActivityDescriber } from 'scenes/saved-insights/activityDescriptions'
import { teamActivityDescriber } from 'scenes/teamActivityDescriber'
import { urls } from 'scenes/urls'

import { ActivityScope } from '~/types'
Expand Down Expand Up @@ -44,6 +45,8 @@ export const describerFor = (logItem?: ActivityLogItem): Describer | undefined =
return dataManagementActivityDescriber
case ActivityScope.NOTEBOOK:
return notebookActivityDescriber
case ActivityScope.TEAM:
return teamActivityDescriber
default:
return (logActivity, asNotification) => defaultDescriber(logActivity, asNotification)
}
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/lib/components/BridgePage/BridgePage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
display: flex;
flex: 1;
flex-direction: column;
height: 100%;
min-height: 100vh;
overflow: hidden;
height: 100vh;
overflow: scroll;
background-color: var(--bg-bridge);
-ms-overflow-style: none;

Expand Down
13 changes: 11 additions & 2 deletions frontend/src/lib/components/ExportButton/exporter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,23 @@ export async function triggerExport(asset: TriggerExportProps): Promise<void> {

await delay(POLL_DELAY_MS)

exportedAsset = await api.exports.get(exportedAsset.id)
// Keep polling for pure network errors, but not any HTTP errors
// Example: `NetworkError when attempting to fetch resource`
try {
exportedAsset = await api.exports.get(exportedAsset.id)
} catch (e: any) {
if (e.name === 'NetworkError' || e.message?.message?.startsWith('NetworkError')) {
continue
}
throw e
}
}

reject('Content not loaded in time...')
} catch (e: any) {
trackingProperties.total_time_ms = performance.now() - startTime
posthog.capture('export failed', trackingProperties)
reject(`Export failed: ${JSON.stringify(e)}`)
reject(new Error(`Export failed: ${JSON.stringify(e.detail ?? e)}`))
}
})
await lemonToast.promise(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface PropertyFiltersProps {
orFiltering?: boolean
propertyGroupType?: FilterLogicalOperator | null
addText?: string | null
buttonText?: string
hasRowOperator?: boolean
sendAllKeyUpdates?: boolean
allowNew?: boolean
Expand All @@ -51,6 +52,7 @@ export function PropertyFilters({
logicalRowDivider = false,
propertyGroupType = null,
addText = null,
buttonText = 'Add filter',
hasRowOperator = true,
sendAllKeyUpdates = false,
allowNew = true,
Expand Down Expand Up @@ -91,7 +93,7 @@ export function PropertyFilters({
pageKey={pageKey}
showConditionBadge={showConditionBadge}
disablePopover={disablePopover || orFiltering}
label="Add filter"
label={buttonText}
onRemove={remove}
orFiltering={orFiltering}
filterComponent={(onComplete) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,100 +22,7 @@
.LemonButton__content {
white-space: nowrap;
}
}
}

body:not(.posthog-3000) {
.LemonSegmentedButton {
background: var(--bg-light);
border: 1px solid var(--border);
}

.LemonSegmentedButton__slider {
position: absolute;
top: -1px; // 1px of border
left: -1px; // 1px of border
width: calc(var(--lemon-segmented-button-slider-width) + 2px); // 1px of border (left + right)
height: calc(100% + 2px); // 1px of border (top + bottom)
background: var(--primary);

// This is a real element and not ::after to avoid initial transition from 0 width
transition: width 200ms ease, transform 200ms ease, border-radius 200ms ease;
transform: translateX(var(--lemon-segmented-button-slider-offset));
will-change: width, transform, border-radius;

&.LemonSegmentedButton__slider--first {
border-top-left-radius: var(--radius);
border-bottom-left-radius: var(--radius);
}

&.LemonSegmentedButton__slider--last {
border-top-right-radius: var(--radius);
border-bottom-right-radius: var(--radius);
}
}

.LemonSegmentedButton__option {
.LemonButton {
min-height: calc(var(--lemon-button-height) - 2px);
border-radius: 0;
outline: 1px solid transparent;

// Original transition with outline added
transition: background-color 200ms ease, color 200ms ease, border 200ms ease, opacity 200ms ease,
outline 200ms ease;

&:hover {
> span {
border-color: none !important;
}
}
}

&:first-child,
&:first-child .LemonButton {
border-top-left-radius: var(--radius);
border-bottom-left-radius: var(--radius);
}

&:last-child,
&:last-child .LemonButton {
border-top-right-radius: var(--radius);
border-bottom-right-radius: var(--radius);
}

&:not(:last-child) {
border-right: 1px solid var(--border);
}

&:not(.LemonSegmentedButton__option--disabled, .LemonSegmentedButton__option--selected) {
&:hover .LemonButton {
outline-color: var(--primary);
}

&:active .LemonButton {
outline-color: var(--primary-dark);
}
}

&.LemonSegmentedButton__option--selected {
.LemonButton,
.LemonButton__icon {
color: #fff;
}

.LemonButton {
&:hover,
&:active {
background: none; // Disable LemonButton's hover styles for the selected option
}
}
}
}
}

.posthog-3000 {
.LemonSegmentedButton__option {
& .LemonButton,
& .LemonButton > .LemonButton__chrome::after,
& .LemonButton > .LemonButton__chrome::before {
Expand Down Expand Up @@ -152,21 +59,19 @@ body:not(.posthog-3000) {
border-bottom-right-radius: var(--radius) !important;
}

&:not(:last-child) {
&:not(:first-child) {
.LemonButton__chrome {
border-right: none;
margin-left: -1px;
}
}

&.LemonSegmentedButton__option--selected {
z-index: 2;

.LemonButton {
--lemon-button-icon-opacity: 1;
--lemon-button-profile-picture-opacity: 1;
}

.LemonButton__chrome::after {
background-color: var(--bg-light);
}
}

&--disabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function LemonSegmentedButton<T extends React.Key>({
ref={option.value === value ? selectionRef : undefined}
>
<LemonButton
type="secondary"
type={option.value === value ? 'primary' : 'secondary'}
size={size}
fullWidth
disabledReason={option.disabledReason}
Expand Down
Loading

0 comments on commit d96d1e2

Please sign in to comment.