-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add explanation tooltip for availability calculation #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8b4da15
feat: Add explanation tooltip for availability calculation
claude 3714846
feat: Add availability explanation tooltip with spacing and downtime …
claude cd1597c
Show tooltip on hover instead of click
spalmurray 83d0afb
Update month to time period in attribution text
spalmurray 9582129
Clean up tooltip timeout on unmount
spalmurray 9000b3e
Use radix tooltip primitive for availability explanation
spalmurray d6cdef4
Remove broken animation classes from Tooltip component
spalmurray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,46 @@ | ||
| import * as TooltipPrimitive from '@radix-ui/react-tooltip'; | ||
| import {cn} from 'utils/cn'; | ||
|
|
||
| const TooltipProvider = TooltipPrimitive.Provider; | ||
|
|
||
| const Tooltip = TooltipPrimitive.Root; | ||
|
|
||
| const TooltipTrigger = TooltipPrimitive.Trigger; | ||
|
|
||
| interface TooltipContentProps extends React.ComponentPropsWithoutRef< | ||
| typeof TooltipPrimitive.Content | ||
| > { | ||
| ref?: React.Ref<HTMLDivElement>; | ||
| } | ||
|
|
||
| function TooltipContent({ | ||
| className, | ||
| align = 'center', | ||
| sideOffset = 4, | ||
| ref, | ||
| ...props | ||
| }: TooltipContentProps) { | ||
| return ( | ||
| <TooltipPrimitive.Portal> | ||
| <TooltipPrimitive.Content | ||
| ref={ref} | ||
| align={align} | ||
| sideOffset={sideOffset} | ||
| className={cn( | ||
| 'z-50', | ||
| 'rounded-radius-md', | ||
| 'border', | ||
| 'border-gray-200', | ||
| 'bg-background-primary', | ||
| 'p-space-md', | ||
| 'shadow-lg', | ||
| 'outline-none', | ||
| className | ||
| )} | ||
| {...props} | ||
| /> | ||
| </TooltipPrimitive.Portal> | ||
| ); | ||
| } | ||
|
|
||
| export {TooltipProvider, Tooltip, TooltipTrigger, TooltipContent}; |
This file contains hidden or 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
52 changes: 52 additions & 0 deletions
52
frontend/src/routes/availability/components/AvailabilityTooltip.tsx
This file contains hidden or 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,52 @@ | ||
| import {Tooltip, TooltipContent, TooltipTrigger} from 'components/Tooltip'; | ||
| import {Info} from 'lucide-react'; | ||
|
|
||
| export function AvailabilityTooltip() { | ||
| return ( | ||
| <Tooltip> | ||
| <TooltipTrigger asChild> | ||
| <button | ||
| className="text-content-secondary hover:text-content-primary transition-colors" | ||
| aria-label="How availability is calculated" | ||
| > | ||
| <Info size={18} /> | ||
| </button> | ||
| </TooltipTrigger> | ||
| <TooltipContent align="start" className="text-size-sm max-w-sm"> | ||
| <h3 className="text-content-headings mb-space-sm font-semibold"> | ||
| How availability is calculated | ||
| </h3> | ||
| <p className="text-content-secondary mb-space-sm"> | ||
| Availability percentage is calculated as: | ||
| </p> | ||
| <p className="text-content-primary bg-background-secondary mb-space-sm px-space-sm py-space-xs text-size-xs rounded font-mono"> | ||
| (Total Time − Downtime) / Total Time × 100 | ||
| </p> | ||
| <p className="text-content-secondary mb-space-sm"> | ||
| Only <strong>T0 service tier</strong> incidents with{' '} | ||
| <strong>availability impact</strong> are included. | ||
| </p> | ||
| <p className="text-content-secondary mb-space-md"> | ||
| Downtime is captured in the time period the incident was created. | ||
| </p> | ||
| <h4 className="text-content-headings mb-space-xs font-medium"> | ||
| Color thresholds | ||
| </h4> | ||
| <ul className="text-content-secondary space-y-space-xs"> | ||
| <li className="gap-space-xs flex items-center"> | ||
| <span className="bg-graphics-success-moderate inline-block size-3 rounded" /> | ||
| <span>Green: ≥ 99.9%</span> | ||
| </li> | ||
| <li className="gap-space-xs flex items-center"> | ||
| <span className="bg-graphics-warning-moderate inline-block size-3 rounded" /> | ||
| <span>Yellow: ≥ 99.85%</span> | ||
| </li> | ||
| <li className="gap-space-xs flex items-center"> | ||
| <span className="bg-graphics-danger-moderate inline-block size-3 rounded" /> | ||
| <span>Red: < 99.85%</span> | ||
| </li> | ||
| </ul> | ||
| </TooltipContent> | ||
| </Tooltip> | ||
| ); | ||
| } | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.