Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions web/packages/teleport/src/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import React, { Suspense, useEffect, useMemo } from 'react';
import React, {
ReactNode,
Suspense,
useEffect,
useMemo,
useState,
} from 'react';
import styled from 'styled-components';
import { Indicator } from 'design';
import { Failed } from 'design/CardError';
Expand Down Expand Up @@ -51,8 +57,9 @@ import type { LockedFeatures, TeleportFeature } from 'teleport/types';

interface MainProps {
initialAlerts?: ClusterAlert[];
customBanners?: React.ReactNode[];
customBanners?: ReactNode[];
features: TeleportFeature[];
billingBanners?: ReactNode[];
}

export function Main(props: MainProps) {
Expand All @@ -79,7 +86,7 @@ export function Main(props: MainProps) {

const { alerts, dismissAlert } = useAlerts(props.initialAlerts);

const [showOnboardDiscover, setShowOnboardDiscover] = React.useState(true);
const [showOnboardDiscover, setShowOnboardDiscover] = useState(true);

if (attempt.status === 'failed') {
return <Failed message={attempt.statusText} />;
Expand Down Expand Up @@ -148,6 +155,7 @@ export function Main(props: MainProps) {
<BannerList
banners={banners}
customBanners={props.customBanners}
billingBanners={featureFlags.billing && props.billingBanners}
onBannerDismiss={dismissAlert}
>
<MainContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ import { MainContainer } from 'teleport/Main/MainContainer';

import { Banner } from './Banner';

import type { ReactNode } from 'react';
import type { Severity } from './Banner';
import type { ReactNode } from 'react';

export const BannerList = ({
banners = [],
children,
customBanners = [],
billingBanners = [],
onBannerDismiss = () => {},
}: Props) => {
const [bannerData, setBannerData] = useState<{ [id: string]: BannerType }>(
Expand Down Expand Up @@ -68,6 +69,7 @@ export const BannerList = ({
/>
))}
{customBanners}
{billingBanners}
{children}
</Wrapper>
);
Expand All @@ -89,6 +91,7 @@ type Props = {
children?: ReactNode;
customBanners?: ReactNode[];
onBannerDismiss?: (string) => void;
billingBanners?: ReactNode[];
};

export type BannerType = {
Expand Down