-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: first PR for Usage dashboard (#26807)
- Loading branch information
1 parent
c40b194
commit 1b9aa47
Showing
10 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { LemonBanner } from '@posthog/lemon-ui' | ||
|
||
export function BillingOverview(): JSX.Element { | ||
return ( | ||
<div> | ||
<h2>Billing Overview</h2> | ||
<LemonBanner type="info">Overview section under construction</LemonBanner> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import './Billing.scss' | ||
|
||
import { LemonButton } from '@posthog/lemon-ui' | ||
import { useActions, useValues } from 'kea' | ||
import { router } from 'kea-router' | ||
import { useEffect } from 'react' | ||
import { SceneExport } from 'scenes/sceneTypes' | ||
import { urls } from 'scenes/urls' | ||
|
||
import { billingLogic } from './billingLogic' | ||
import { BillingOverview } from './BillingOverview' | ||
import { BillingUsage } from './BillingUsage' | ||
|
||
export const scene: SceneExport = { | ||
component: BillingSection, | ||
logic: billingLogic, | ||
} | ||
|
||
export function BillingSection(): JSX.Element { | ||
const { location } = useValues(router) | ||
const { push } = useActions(router) | ||
|
||
const activeSection = location.pathname.endsWith('/usage') ? 'usage' : 'overview' | ||
|
||
useEffect(() => { | ||
if (location.pathname === '/organization/billing') { | ||
push(urls.organizationBillingSection('overview')) | ||
} | ||
}, [location.pathname]) | ||
|
||
return ( | ||
<div className="flex gap-8 items-start mt-0"> | ||
<div className="sticky top-16 flex-shrink-0 w-1/5 min-w-56 max-w-80 [.SidePanel3000_&]:top-0"> | ||
<ul className="space-y-px"> | ||
<li> | ||
<LemonButton | ||
onClick={() => push(urls.organizationBillingSection('overview'))} | ||
active={activeSection === 'overview'} | ||
size="small" | ||
fullWidth | ||
> | ||
Overview | ||
</LemonButton> | ||
</li> | ||
<li> | ||
<LemonButton | ||
onClick={() => push(urls.organizationBillingSection('usage'))} | ||
active={activeSection === 'usage'} | ||
size="small" | ||
fullWidth | ||
> | ||
Usage | ||
</LemonButton> | ||
</li> | ||
</ul> | ||
</div> | ||
<div className="flex-1 w-full space-y-2 min-w-0"> | ||
{activeSection === 'overview' ? <BillingOverview /> : <BillingUsage />} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { LemonBanner } from '@posthog/lemon-ui' | ||
|
||
export function BillingUsage(): JSX.Element { | ||
return ( | ||
<div> | ||
<h2>Usage Details</h2> | ||
<LemonBanner type="info">Usage section under construction</LemonBanner> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters