Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import styled, { css } from 'styled-components'

import { FlexGroup } from 'uiSrc/components/base/layout/flex'
import { IconButton } from 'uiSrc/components/base/forms/buttons'
import { IconButtonProps } from 'uiSrc/components/base/forms/buttons/IconButton'

export const CopilotWrapper = styled(FlexGroup)`
user-select: none;
`

export const CopilotIconButton = styled(IconButton)<
{ isOpen: boolean } & IconButtonProps
>`
padding: ${({ theme }) => theme.core.space.space200};

// TODO: Remove this once size property is enabled for IconButton
svg {
width: 21px;
height: 21px;
color: var(--triggerIconActiveColor);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing important flag on SVG color

The SVG color property lacks the !important flag that was present in the original SCSS implementation. Without this flag, the icon color may be overridden by other styles with higher specificity, potentially breaking the visual appearance of the Copilot icon.

Fix in Cursor Fix in Web

}

${({ isOpen }) =>
isOpen &&
css`
background-color: ${({ theme }) =>
theme.semantic.color.background.primary200};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing important flag on background color

The background-color property when isOpen is true lacks the !important flag that was present in the original SCSS implementation. The similar BulbIconButton in the insights trigger uses !important for the same property. Without this flag, the background color may not apply correctly if conflicting styles exist with higher specificity, breaking the visual indication that the panel is open.

Fix in Cursor Fix in Web

`}
`
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React from 'react'
import cx from 'classnames'

import { useDispatch, useSelector } from 'react-redux'
import {
sidePanelsSelector,
Expand All @@ -10,34 +8,32 @@ import {
import { RiTooltip } from 'uiSrc/components'
import { CopilotIcon } from 'uiSrc/components/base/icons'
import { SidePanels } from 'uiSrc/slices/interfaces/insights'
import { EmptyButton } from 'uiSrc/components/base/forms/buttons'
import styles from './styles.module.scss'
import { CopilotWrapper, CopilotIconButton } from './CopilotTrigger.styles'

const CopilotTrigger = () => {
const { openedPanel } = useSelector(sidePanelsSelector)

const dispatch = useDispatch()

const handleClickTrigger = () => {
dispatch(toggleSidePanel(SidePanels.AiAssistant))
}

const isCopilotOpen = openedPanel === SidePanels.AiAssistant

return (
<div
className={cx(styles.container, {
[styles.isOpen]: openedPanel === SidePanels.AiAssistant,
})}
>
<CopilotWrapper align="center" justify="end">
<RiTooltip content="Redis Copilot">
<EmptyButton
className={styles.btn}
<CopilotIconButton
size="S"
role="button"
icon={CopilotIcon}
onClick={handleClickTrigger}
data-testid="copilot-trigger"
isOpen={isCopilotOpen}
aria-label="Copilot-trigger"
/>
</RiTooltip>
</div>
</CopilotWrapper>
)
}

Expand Down

This file was deleted.

Loading