Skip to content

Commit

Permalink
chore(ui): remove MQTT EOL announcement and related code
Browse files Browse the repository at this point in the history
  • Loading branch information
mavarius committed Nov 19, 2024
1 parent 471508c commit 4087276
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 181 deletions.
20 changes: 8 additions & 12 deletions src/homepageExperience/ClickThroughAnnouncementHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import {useLocalStorageState} from 'use-local-storage-state'

// Utils
import {showOverlay, dismissOverlay} from 'src/overlays/actions/overlays'
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
import {event} from 'src/cloud/utils/reporting'

export enum AnnouncementID {
MqttEol = 'mqttEolClickThroughAnnouncement',
None = 'none',
}

enum AnnouncementState {
Dismissed = 'dismissed',
Display = 'display',
Disabled = 'disabled',
}

export const ClickThroughAnnouncementHandler: FC = () => {
Expand Down Expand Up @@ -46,6 +46,10 @@ export const ClickThroughAnnouncementHandler: FC = () => {
}

const handleDisplayAnnouncement = (announcementID: string): void => {
if (announcementID === AnnouncementID.None) {
return null
}

initAnnouncement(announcementID)

if (announcementState[announcementID] === AnnouncementState.Display) {
Expand All @@ -61,16 +65,8 @@ export const ClickThroughAnnouncementHandler: FC = () => {
}

useEffect(() => {
// MQTT Audience: Cloud users with MQTT feature flag enabled
const isMqttAudience = isFlagEnabled('subscriptionsUI')

// Sequentially display announcements in order of priority
if (
isMqttAudience &&
announcementState[AnnouncementID.MqttEol] !== AnnouncementState.Dismissed
) {
handleDisplayAnnouncement(AnnouncementID.MqttEol)
}
// Sequentially display announcements in order of priority (use AnnouncementID.None to disable)
handleDisplayAnnouncement(AnnouncementID.None)
}, [announcementState])

return null
Expand Down
21 changes: 3 additions & 18 deletions src/me/components/ClickThroughAnnouncementOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {useSelector} from 'react-redux'

// Components
import {Overlay} from '@influxdata/clockface'
import {MqttEolAnnouncement} from 'src/me/components/announcements/MqttEolAnnouncement'

// Utils
import {event} from 'src/cloud/utils/reporting'
Expand All @@ -19,31 +18,17 @@ interface ClickThroughAnnouncementOverlayProps {

export const ClickThroughAnnouncementOverlay: FC<
ClickThroughAnnouncementOverlayProps
> = ({onClose}) => {
> = () => {
const {announcementID} = useSelector(getOverlayParams)

useEffect(() => {
event(`${announcementID}.displayed`)
}, [])

const handleDetailsClick = () => {
event(`${announcementID}.details.clicked`)
}

const handleAcknowledgeClick = () => {
event(`${announcementID}.acknowledge.clicked`)
onClose()
}

const announcementContents = (): JSX.Element => {
switch (announcementID) {
case AnnouncementID.MqttEol:
return (
<MqttEolAnnouncement
handleAcknowledgeClick={handleAcknowledgeClick}
handleDetailsClick={handleDetailsClick}
/>
)
case AnnouncementID.None:
return null
default:
return null
}
Expand Down
151 changes: 0 additions & 151 deletions src/me/components/announcements/MqttEolAnnouncement.tsx

This file was deleted.

0 comments on commit 4087276

Please sign in to comment.