Skip to content
Merged
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,27 @@
import styled 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: ${({ theme }) => theme.semantic.color.text.attention600};
}

${({ isOpen, theme }) =>

Check warning on line 23 in redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.styles.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
isOpen
? `background-color: ${theme.semantic.color.background.primary200};`

Check warning on line 25 in redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.styles.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
: ''}

Check warning on line 26 in redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.styles.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 26 in redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.styles.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
`
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,35 +8,33 @@
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

Check warning on line 21 in redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

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>
)

Check warning on line 37 in redisinsight/ui/src/components/triggers/copilot-trigger/CopilotTrigger.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

export default CopilotTrigger

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import styled, { css } from "styled-components"
import styled from 'styled-components'

import { IconButton } from "uiSrc/components/base/forms/buttons"
import { IconButtonProps } from "uiSrc/components/base/forms/buttons/IconButton"
import { IconButton } from 'uiSrc/components/base/forms/buttons'
import { IconButtonProps } from 'uiSrc/components/base/forms/buttons/IconButton'

export const BulbWrapper = styled.div`
position: relative;
`

export const BulbHighlighting = styled.span`
// TODO: Using the background color from the previous value until there is an appropriate color
// TODO: Using the background color from the previous value until there is an appropriate color
// from the pallete to use for both light and dark themes.
background-color: #ffaf2b;
background-color: ${({ theme }) => theme.semantic.color.text.attention600};
position: absolute;
left: 5px;
top: 5px;
Expand All @@ -31,10 +31,8 @@ export const BulbIconButton = styled(IconButton)<
height: 21px;
}

${({ isOpen }) =>
isOpen &&
css`
background-color: ${({ theme }) =>
theme.semantic.color.background.primary200} !important;
`}
${({ isOpen, theme }) =>
isOpen
? `background-color: ${theme.semantic.color.background.primary200} !important;`
: ''}
`
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
BulbHighlighting,
BulbIconButton,
BulbWrapper,
} from './insights-trigger.styles'
} from './InsightsTrigger.styles'

export interface Props {
source?: string
Expand Down
Loading