Annotations: FE#6481
Merged
Merged
Conversation
|
…attern - Show the site option as a disabled radio with a plan pill and hover tooltip instead of an inline warning message - Add a reusable UpgradePill with diamond icon in both React and LiveView and use it in the annotation, segment, and goal settings modals plus the feature setup notice
RobertJoonas
approved these changes
Jul 9, 2026
| {!!annotationDatetime && canAddAnnotation && ( | ||
| <Button | ||
| size="xs" | ||
| className="flex-1 bg-gray-600/70 border-gray-600/70 hover:bg-gray-600 hover:border-gray-600" |
Contributor
There was a problem hiding this comment.
The classname between the two buttons should be exactly the same so perhaps let's extract that into a variable?
Contributor
Author
There was a problem hiding this comment.
Hmm, true that it is duplicative... AFAIK TW recommends against variables though. They suggest to generate repetitive items with map, or extract to component, or to use multicursor when editing. I can do the map thing, but it creates this situation:
{hasActions && (
<div className="flex flex-row gap-x-2 mt-2">
{[
!!annotationDatetime &&
canAddAnnotation && {
text: 'Add note',
onClick: () => {
closeTooltip()
setModal({
type: 'create-annotation',
annotation: {
type: AnnotationType.personal,
datetime: annotationDatetime,
granularity: getAnnotationGranularity(interval)
}
})
}
},
!!zoomDate && {
text: `View ${interval}`,
onClick: () => onZoomToPeriod(zoomDate)
}
]
.filter((b) => !!b)
.map(({ text, onClick }) => (
<Button
key={text}
size="xs"
className="flex-1 bg-gray-600/70 border-gray-600/70 hover:bg-gray-600 hover:border-gray-600"
onClick={onClick}
>
{text}
</Button>
))}
</div>
)}
Contributor
There was a problem hiding this comment.
Makes sense. Maybe extracting a simple button component would be the cleanest approach then?
function TooltipActionButton(props) {
const className = "flex-1 bg-gray-600/70 border-gray-600/70 hover:bg-gray-600 hover:border-gray-600"
return <Button className={className} {...props}>
}Fine for me to leave the duplicate classes though.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
Adds the rest of Annotations feature. Depends on the BE PR.
Tests
Changelog
Documentation
Dark mode
TODO after merge