Skip to content

Commit

Permalink
Make Incident Banner (#1365)
Browse files Browse the repository at this point in the history
* Make Incident Banner

* Export Severity type

* Add status from status page

* Remove unnecessary condition
  • Loading branch information
anafilipadealmeida committed May 16, 2024
1 parent 89b902a commit 64734a6
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
35 changes: 35 additions & 0 deletions ui/apps/dashboard/src/app/(organization-active)/IncidentBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use client';

import { Link } from '@inngest/components/Link';

import { Banner, type Severity } from '@/components/Banner';
import { useBooleanFlag } from '@/components/FeatureFlags/hooks';
import { useSystemStatus } from './support/statusPage';

export default function IncidentBanner() {
const isIncidentBannerEnabled = useBooleanFlag('incident-banner');
const status = useSystemStatus();

if (!isIncidentBannerEnabled.value && status.indicator === 'none') return;

let message = '';
let severity: Severity = 'warning';

if (isIncidentBannerEnabled.value) {
message = ' We are experiencing some issues.';
} else {
message = `${status.description}`;
if (status.indicator === 'minor') {
severity = 'info';
}
}

return (
<Banner kind={severity}>
{message} Please check the{' '}
<span style={{ display: 'inline-flex' }}>
<Link href="https://status.inngest.com/">status page.</Link>
</span>
</Banner>
);
}
10 changes: 2 additions & 8 deletions ui/apps/dashboard/src/app/(organization-active)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { ReactNode } from 'react';
import { Link } from '@inngest/components/Link';

import { Banner } from '@/components/Banner';
import { URQLProvider } from '@/queries/URQLProvider';
import IncidentBanner from './IncidentBanner';

type OrganizationActiveLayoutProps = {
children: ReactNode;
Expand All @@ -11,12 +10,7 @@ type OrganizationActiveLayoutProps = {
export default function OrganizationActiveLayout({ children }: OrganizationActiveLayoutProps) {
return (
<URQLProvider>
<Banner kind="warning">
We are experiencing some API issues. Please check the{' '}
<span style={{ display: 'inline-flex' }}>
<Link href="https://status.inngest.com/">status page.</Link>
</span>
</Banner>
<IncidentBanner />
{children}
</URQLProvider>
);
Expand Down
2 changes: 1 addition & 1 deletion ui/apps/dashboard/src/components/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button } from '@inngest/components/Button';
import { cn } from '@inngest/components/utils/classNames';
import { RiCloseLine, RiErrorWarningLine, RiInformationLine } from '@remixicon/react';

type Severity = 'info' | 'error' | 'warning';
export type Severity = 'info' | 'error' | 'warning';

const backgroundColors = {
info: 'bg-blue-100',
Expand Down
2 changes: 1 addition & 1 deletion ui/apps/dashboard/src/components/Banner/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Banner } from './Banner';
export { Banner, type Severity } from './Banner';

0 comments on commit 64734a6

Please sign in to comment.