Skip to content

Commit

Permalink
feat: Refactor and simplify insights css (#18570)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored Nov 15, 2023
1 parent c1c6f57 commit 6676a1d
Show file tree
Hide file tree
Showing 197 changed files with 610 additions and 881 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/insights-navigation-open-directly.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Insights', () => {
describe('opening a new insight directly', () => {
it('can open a new trends insight', () => {
insight.newInsight('TRENDS')
cy.get('.trends-insights-container canvas').should('exist')
cy.get('.TrendsInsight canvas').should('exist')
cy.get('tr').should('have.length.gte', 2)
})

Expand All @@ -52,12 +52,12 @@ describe('Insights', () => {

it('can open a new stickiness insight', () => {
insight.newInsight('STICKINESS')
cy.get('.trends-insights-container canvas').should('exist')
cy.get('.TrendsInsight canvas').should('exist')
})

it('can open a new lifecycle insight', () => {
insight.newInsight('LIFECYCLE')
cy.get('.trends-insights-container canvas').should('exist')
cy.get('.TrendsInsight canvas').should('exist')
})

it('can open a new SQL insight', () => {
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/insights-navigation-open-sql-insight-first.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Insights', () => {

it('can open a new trends insight', () => {
insight.clickTab('TRENDS')
cy.get('.trends-insights-container canvas').should('exist')
cy.get('.TrendsInsight canvas').should('exist')
cy.get('tr').should('have.length.gte', 2)
cy.contains('tr', 'No insight results').should('not.exist')
})
Expand All @@ -65,12 +65,12 @@ describe('Insights', () => {

it('can open a new stickiness insight', () => {
insight.clickTab('STICKINESS')
cy.get('.trends-insights-container canvas').should('exist')
cy.get('.TrendsInsight canvas').should('exist')
})

it('can open a new lifecycle insight', () => {
insight.clickTab('LIFECYCLE')
cy.get('.trends-insights-container canvas').should('exist')
cy.get('.TrendsInsight canvas').should('exist')
})

it('can open a new SQL insight', () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/insights-navigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Insights', () => {
cy.get('.DataTable tr').should('have.length.gte', 2)

insight.clickTab('TRENDS')
cy.get('.trends-insights-container canvas').should('exist')
cy.get('.TrendsInsight canvas').should('exist')
cy.get('tr').should('have.length.gte', 2)
cy.contains('tr', 'No insight results').should('not.exist')

Expand All @@ -73,7 +73,7 @@ describe('Insights', () => {
cy.get('.DataTable tr').should('have.length.gte', 2)

insight.clickTab('TRENDS')
cy.get('.trends-insights-container canvas').should('exist')
cy.get('.TrendsInsight canvas').should('exist')
cy.get('tr').should('have.length.gte', 2)
cy.contains('tr', 'No insight results').should('not.exist')
})
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/components-cards-text-card--template.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.
Binary file modified frontend/__snapshots__/exporter-exporter--lifecycle-insight.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.
Binary file modified frontend/__snapshots__/exporter-exporter--retention-insight.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.
Binary file modified frontend/__snapshots__/exporter-exporter--trends-bar-insight.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.
Binary file modified frontend/__snapshots__/exporter-exporter--trends-number-insight.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.
Binary file modified frontend/__snapshots__/exporter-exporter--trends-pie-insight.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.
Binary file modified frontend/__snapshots__/exporter-exporter--user-paths-insight.png
Binary file modified frontend/__snapshots__/insights-insightstable--embedded.png
Binary file modified frontend/__snapshots__/scenes-app-dashboards--edit.png
Binary file modified frontend/__snapshots__/scenes-app-dashboards--show.png
Binary file modified frontend/__snapshots__/scenes-app-insights--lifecycle--webkit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--lifecycle-edit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--lifecycle.png
Binary file modified frontend/__snapshots__/scenes-app-insights--retention--webkit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--retention-edit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--retention.png
Binary file modified frontend/__snapshots__/scenes-app-insights--stickiness--webkit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--stickiness-edit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--stickiness.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-area--webkit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-area-edit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-area.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-bar-edit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-bar.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-line--webkit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-line-edit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-line-multi.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-line.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-number.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-pie--webkit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-pie-edit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-pie.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-table-edit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-table.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-value.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-world-map.png
Binary file modified frontend/__snapshots__/scenes-app-insights--user-paths--webkit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--user-paths-edit.png
Binary file modified frontend/__snapshots__/scenes-app-insights--user-paths.png
Binary file modified frontend/__snapshots__/scenes-app-saved-insights--card-view.png
51 changes: 11 additions & 40 deletions frontend/src/exporter/ExportedInsight/ExportedInsight.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
background: var(--bg-light);
display: flex;
flex-direction: column;
height: 100%;
flex: 1;

.ExportedInsight__header {
padding: 1rem;
Expand All @@ -25,23 +27,19 @@
flex: 1;
position: relative;
z-index: 1;
display: flex;
flex-direction: column;

.FunnelBarChart {
min-height: 50vw;
.LemonTable {
border: none;
border-radius: 0;
background: none;
}

.InsightViz {
position: relative;
display: flex;
.InsightCard__viz {
// We can't use the viewport height, as the screenshotter will resize the height of the window to capture the full content
// Instead we try to make it roughly rectangular
min-height: 50vw;

> * {
flex: 1;
}

.ActionsPie {
position: absolute;
}
}
}

Expand All @@ -56,31 +54,4 @@
margin: 0.25rem;
}
}

&.ExportedInsight--fit-screen {
height: 100vh;
max-height: 100vh;

.ExportedInsight__content {
display: flex;
flex-direction: column;

.FunnelBarChart {
height: 100%;
max-height: 100%;
min-height: auto;
flex: 1;
}

.InsightViz {
flex: 1;
min-height: 100px;
max-height: 100%;
}

&.ExportedInsight__content--with-watermark {
padding-top: 1rem;
}
}
}
}
6 changes: 1 addition & 5 deletions frontend/src/exporter/ExportedInsight/ExportedInsight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ export function ExportedInsight({
<QueriesUnsupportedHere />
)
) : (
<FilterBasedCardContent
insight={insight as any}
insightProps={insightLogicProps}
style={{ top: 0, left: 0 }}
/>
<FilterBasedCardContent insight={insight as any} insightProps={insightLogicProps} />
)}
{showLegend ? (
<div className="p-4">
Expand Down
10 changes: 4 additions & 6 deletions frontend/src/exporter/Exporter.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

.Exporter {
padding: 1rem;
min-height: 100vh;
display: flex;
flex-direction: column;

&--recording {
height: 100vh;
Expand Down Expand Up @@ -50,11 +53,6 @@ html.export-type-embed {

.Exporter {
padding: 0;

// Insights can resize to fit any height, whereas dashboards cannot
&--insight {
height: 100vh;
max-height: 100vh;
}
min-height: 100vh;
}
}
85 changes: 50 additions & 35 deletions frontend/src/lib/components/Cards/CardMeta.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,23 @@
}

.CardMeta {
position: absolute;
top: 0;
left: 0;
display: flex;
position: relative;
flex-shrink: 0;
flex-direction: column;
width: 100%;
max-height: calc(100% - 2rem);
background: var(--bg-light);
z-index: 101; // Elevate above viz
overflow: hidden;
border-radius: var(--radius);

&--with-details {
.CardMeta__top {
// Reduced height so that, considering the padding set above, CardMeta__top doesn't have too much margin
height: 1.5rem;
}
}

h5 {
color: var(--muted);
line-height: 1.5rem;
Expand All @@ -62,44 +67,54 @@
font-weight: 600;
margin-bottom: 0.125rem;
}
}

.CardMeta--with-details {
padding: 1rem;

.CardMeta__top {
// Reduced height so that, considering the padding set above, CardMeta__top doesn't have too much margin
height: 1.5rem;
.CardMeta__primary {
display: flex;
width: 100%;
padding: 1rem;
}
}

.CardMeta--expansion-enter-active,
.CardMeta--expansion-exit-active,
.CardMeta--expansion-enter,
.CardMeta--expansion-exit {
transition: box-shadow 200ms ease, height 200ms ease;
}
.CardMeta__divider {
margin: 0 1rem;
height: 1px;
background: var(--border);
opacity: 0;
transition: opacity 200ms ease;
}

.CardMeta--expansion-exit.CardMeta--expansion-exit-active,
.CardMeta--expansion-exit-done,
.CardMeta--expansion-enter {
box-shadow: none;
}
.CardMeta__details {
position: absolute;
left: 0;
right: 0;
top: 100%;
max-height: 18rem;
margin-top: -1px; // To cause overlap with the divider when closed
border-bottom-width: 1px;
background: var(--bg-light);
transition: box-shadow 200ms ease, height 200ms ease, margin 200ms ease;
overflow-y: auto;

.CardMeta__details__content {
pointer-events: none;
overflow-y: auto;
}
}

.CardMeta--expansion-enter.CardMeta--expansion-enter-active,
.CardMeta--expansion-enter-done,
.CardMeta--expansion-exit {
box-shadow: var(--shadow-elevation);
}
&.CardMeta--details-shown {
.CardMeta__details {
box-shadow: var(--shadow-elevation);
margin-top: 0;

.CardMeta--expansion-enter-done {
overflow: auto;
}
.CardMeta__details__content {
opacity: 1;
pointer-events: all;
}
}

.CardMeta__primary {
display: flex;
width: 100%;
margin-bottom: 0.5rem;
.CardMeta__divider {
opacity: 1;
}
}
}

.CardMeta__ribbon {
Expand Down
Loading

0 comments on commit 6676a1d

Please sign in to comment.