-
-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: event timeline signals tip (#8342)
https://linear.app/unleash/issue/2-2723/add-signals-tip Adds a tip to the event timeline regarding the usage of signals. The conditions for it to show up are the following: - `!signalsSuggestionSeen` - The current user has not closed the tip yet - `isEnterprise()` - The Unleash instance is an Enterprise instance (signals are currently Enterprise-only) - `isAdmin` - The current user is an admin (signals are currently admin-only) - `signalsEnabled` - The signals feature flag is currently enabled - `!loading` - Signal endpoints have not finished loading (prevents flickering) - `signalEndpoints.length === 0` - The Unleash instance currently has zero configured signal endpoints (signals feature is not being used) ![image](https://github.com/user-attachments/assets/8dd73e62-a341-4d12-97b1-4e011f7891c3)
- Loading branch information
Showing
5 changed files
with
71 additions
and
8 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
61 changes: 61 additions & 0 deletions
61
frontend/src/component/events/EventTimeline/EventTimelineHeader/EventTimelineHeaderTip.tsx
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,61 @@ | ||
import { Chip, styled } from '@mui/material'; | ||
import AccessContext from 'contexts/AccessContext'; | ||
import { useSignalEndpoints } from 'hooks/api/getters/useSignalEndpoints/useSignalEndpoints'; | ||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; | ||
import { useUiFlag } from 'hooks/useUiFlag'; | ||
import { useContext } from 'react'; | ||
import { useEventTimelineContext } from '../EventTimelineContext'; | ||
import { Link, useNavigate } from 'react-router-dom'; | ||
import SensorsIcon from '@mui/icons-material/Sensors'; | ||
|
||
const StyledTip = styled('div')({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
}); | ||
|
||
const StyledSignalIcon = styled(SensorsIcon)(({ theme }) => ({ | ||
'&&&': { | ||
color: theme.palette.primary.main, | ||
}, | ||
})); | ||
|
||
const signalsLink = '/integrations/signals'; | ||
|
||
export const EventTimelineHeaderTip = () => { | ||
const navigate = useNavigate(); | ||
const { signalsSuggestionSeen, setSignalsSuggestionSeen } = | ||
useEventTimelineContext(); | ||
|
||
const { isEnterprise } = useUiConfig(); | ||
const { isAdmin } = useContext(AccessContext); | ||
const signalsEnabled = useUiFlag('signals'); | ||
const { signalEndpoints, loading } = useSignalEndpoints(); | ||
|
||
if ( | ||
!signalsSuggestionSeen && | ||
isEnterprise() && | ||
isAdmin && | ||
signalsEnabled && | ||
!loading && | ||
signalEndpoints.length === 0 | ||
) { | ||
return ( | ||
<StyledTip> | ||
<Chip | ||
size='small' | ||
icon={<StyledSignalIcon />} | ||
label={ | ||
<> | ||
See <Link to={signalsLink}>signals</Link> from | ||
external sources in real-time within Unleash | ||
</> | ||
} | ||
onClick={() => navigate(signalsLink)} | ||
onDelete={() => setSignalsSuggestionSeen(true)} | ||
/> | ||
</StyledTip> | ||
); | ||
} | ||
|
||
return null; | ||
}; |
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