Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: banner paddings #27301

Merged
merged 12 commits into from
Jan 13, 2025
Merged
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__/scenes-app-dashboards--list--dark.png
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__/scenes-app-dashboards--list--light.png
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__/scenes-app-dashboards--new--dark.png
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__/scenes-app-dashboards--new--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.
Binary file modified frontend/__snapshots__/scenes-app-events--event-explorer--dark.png
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__/scenes-app-events--event-explorer--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.
8 changes: 0 additions & 8 deletions frontend/src/layout/navigation-3000/Navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@
flex-direction: column;
height: 100vh;
}

&.Navigation3000__scene--canvas {
--scene-padding: 0px;

display: flex;
flex-direction: column;
overflow: hidden;
}
}

// Navbar
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/layout/navigation-3000/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ export function Navigation({
'Navigation3000__scene',
// Hack - once we only have 3000 the "minimal" scenes should become "app-raw"
sceneConfig?.layout === 'app-raw' && 'Navigation3000__scene--raw',
sceneConfig?.layout === 'app-raw-no-header' && 'Navigation3000__scene--raw-no-header',
sceneConfig?.layout === 'app-canvas' && 'Navigation3000__scene--canvas'
joshsny marked this conversation as resolved.
Show resolved Hide resolved
sceneConfig?.layout === 'app-raw-no-header' && 'Navigation3000__scene--raw-no-header'
)}
>
{!sceneConfig?.hideBillingNotice && <BillingAlertsV2 />}
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/layout/navigation/ProjectNotice.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IconGear, IconPlus } from '@posthog/icons'
import { Spinner } from '@posthog/lemon-ui'
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { dayjs } from 'lib/dayjs'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
Expand All @@ -8,6 +9,7 @@ import { Link } from 'lib/lemon-ui/Link'
import { useEffect, useState } from 'react'
import { verifyEmailLogic } from 'scenes/authentication/signup/verify-email/verifyEmailLogic'
import { organizationLogic } from 'scenes/organizationLogic'
import { sceneLogic } from 'scenes/sceneLogic'
import { inviteLogic } from 'scenes/settings/organization/inviteLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
Expand Down Expand Up @@ -58,6 +60,7 @@ export function ProjectNotice(): JSX.Element | null {
const { closeProjectNotice } = useActions(navigationLogic)
const { showInviteModal } = useActions(inviteLogic)
const { requestVerificationLink } = useActions(verifyEmailLogic)
const { sceneConfig } = useValues(sceneLogic)

if (!projectNoticeVariant) {
return null
Expand Down Expand Up @@ -169,10 +172,13 @@ export function ProjectNotice(): JSX.Element | null {

const relevantNotice = NOTICES[projectNoticeVariant]

const requiresHorizontalMargin =
sceneConfig?.layout && ['app-raw', 'app-raw-no-header'].includes(sceneConfig.layout)

return (
<LemonBanner
type={relevantNotice.type || 'info'}
className="my-4"
className={clsx('my-4', requiresHorizontalMargin && 'mx-4')}
action={relevantNotice.action}
onClose={relevantNotice.closeable ? () => closeProjectNotice(projectNoticeVariant) : undefined}
>
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/lib/components/BillingAlertsV2.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { useEffect, useState } from 'react'
import { billingLogic } from 'scenes/billing/billingLogic'
import { sceneLogic } from 'scenes/sceneLogic'
import { urls } from 'scenes/urls'

export function BillingAlertsV2(): JSX.Element | null {
const { billingAlert } = useValues(billingLogic)
const { reportBillingAlertShown, reportBillingAlertActionClicked } = useActions(billingLogic)
const { currentLocation } = useValues(router)
const { sceneConfig } = useValues(sceneLogic)
const [alertHidden, setAlertHidden] = useState(false)

useEffect(() => {
Expand All @@ -29,6 +32,9 @@ export function BillingAlertsV2(): JSX.Element | null {
const showButton =
billingAlert.action || billingAlert.contactSupport || currentLocation.pathname !== urls.organizationBilling()

const requiresHorizontalMargin =
sceneConfig?.layout && ['app-raw', 'app-raw-no-header'].includes(sceneConfig.layout)

const buttonProps = billingAlert.action
? billingAlert.action
: billingAlert.contactSupport
Expand All @@ -44,7 +50,7 @@ export function BillingAlertsV2(): JSX.Element | null {
}

return (
<div className="my-4">
<div className={clsx('my-4', requiresHorizontalMargin && 'mx-4')}>
<LemonBanner
type={billingAlert.status}
action={showButton ? buttonProps : undefined}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/sceneTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export interface SceneConfig {
* If `plain`, there's no navigation present, and the scene has no padding.
* @default 'app'
*/
layout?: 'app' | 'app-raw' | 'app-canvas' | 'app-container' | 'app-raw-no-header' | 'plain'
layout?: 'app' | 'app-raw' | 'app-container' | 'app-raw-no-header' | 'plain'
/** Hides project notice (ProjectNotice.tsx). */
hideProjectNotice?: boolean
/** Hides billing notice (BillingAlertsV2.tsx). */
Expand Down
Loading