Skip to content

Commit 6475b44

Browse files
clr182luke-beltonabigailbramble
authored andcommitted
feat(Support status redirect): add status to support panel (#42223)
Co-authored-by: Luke Belton <[email protected]> Co-authored-by: Abigail <[email protected]>
1 parent 0992c05 commit 6475b44

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

frontend/src/layout/navigation-3000/sidepanel/panels/SidePanelSupport.tsx

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useActions, useValues } from 'kea'
22
import React from 'react'
33

4-
import { IconFeatures, IconHelmet, IconMap } from '@posthog/icons'
4+
import { IconFeatures, IconHelmet, IconMap, IconWarning } from '@posthog/icons'
55
import { LemonButton, Link } from '@posthog/lemon-ui'
66

77
import { SupportForm } from 'lib/components/Support/SupportForm'
@@ -20,6 +20,8 @@ import { AvailableFeature, BillingFeatureType, BillingPlan, BillingType, SidePan
2020

2121
import { SidePanelPaneHeader } from '../components/SidePanelPaneHeader'
2222
import { sidePanelLogic } from '../sidePanelLogic'
23+
import { sidePanelStatusIncidentIoLogic } from './sidePanelStatusIncidentIoLogic'
24+
import { sidePanelStatusLogic } from './sidePanelStatusLogic'
2325

2426
const Section = ({ title, children }: { title: string; children: React.ReactNode }): React.ReactElement => {
2527
return (
@@ -32,6 +34,59 @@ const Section = ({ title, children }: { title: string; children: React.ReactNode
3234
)
3335
}
3436

37+
const StatusPageAlert = (): JSX.Element | null => {
38+
const { featureFlags } = useValues(featureFlagLogic)
39+
const useIncidentIo = !!featureFlags[FEATURE_FLAGS.INCIDENT_IO_STATUS_PAGE]
40+
const { openSidePanel } = useActions(sidePanelLogic)
41+
42+
const { status: atlassianStatus, statusPage } = useValues(sidePanelStatusLogic)
43+
const { status: incidentIoStatus, statusDescription: incidentIoDescription } =
44+
useValues(sidePanelStatusIncidentIoLogic)
45+
46+
const status = useIncidentIo ? incidentIoStatus : atlassianStatus
47+
48+
if (status === 'operational') {
49+
return null
50+
}
51+
52+
const description = useIncidentIo ? incidentIoDescription : statusPage?.status.description || 'Active incident'
53+
54+
const severityClass = status.includes('outage')
55+
? 'bg-danger-highlight border-danger'
56+
: 'bg-warning-highlight border-warning'
57+
58+
return (
59+
<div className={`border rounded p-3 mb-3 ${severityClass}`}>
60+
<div className="flex items-start gap-2">
61+
<IconWarning className="text-warning w-5 h-5 shrink-0 mt-0.5" />
62+
<div className="flex-1">
63+
<p className="font-semibold mb-1">
64+
<span
65+
className="cursor-pointer text-link hover:underline"
66+
onClick={() => openSidePanel(SidePanelTab.Status)}
67+
>
68+
{description}
69+
</span>
70+
</p>
71+
<div className="text-sm">
72+
<p className="mb-1">We're aware of an issue that may be affecting your PostHog experience.</p>
73+
<p className="mb-0">
74+
You may wish to check our{' '}
75+
<span
76+
className="cursor-pointer text-link hover:underline"
77+
onClick={() => openSidePanel(SidePanelTab.Status)}
78+
>
79+
current status
80+
</span>{' '}
81+
before contacting support.
82+
</p>
83+
</div>
84+
</div>
85+
</div>
86+
</div>
87+
)
88+
}
89+
3590
// In order to set these turn on the `support-message-override` feature flag.
3691

3792
//Support offsite messaging
@@ -323,6 +378,7 @@ export function SidePanelSupport(): JSX.Element {
323378

324379
{showEmailSupport && isBillingLoaded && (
325380
<Section title="Contact us">
381+
<StatusPageAlert />
326382
<p>Can't find what you need and PostHog AI unable to help?</p>
327383
<LemonButton
328384
type="secondary"

0 commit comments

Comments
 (0)