-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(opentron-ai-client): add Side Panel component (#14886)
* feat(opentron-ai-client): add Side Panel component
- Loading branch information
1 parent
8fb95ca
commit 1e3ef8b
Showing
11 changed files
with
242 additions
and
10 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
21 changes: 21 additions & 0 deletions
21
opentrons-ai-client/src/molecules/SidePanel/SidePanel.stories.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,21 @@ | ||
import React from 'react' | ||
import { I18nextProvider } from 'react-i18next' | ||
import { i18n } from '../../i18n' | ||
import { SidePanel as SidePanelComponent } from './index' | ||
|
||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
const meta: Meta<typeof SidePanelComponent> = { | ||
title: 'AI/molecules/SidePanel', | ||
component: SidePanelComponent, | ||
decorators: [ | ||
Story => ( | ||
<I18nextProvider i18n={i18n}> | ||
<Story /> | ||
</I18nextProvider> | ||
), | ||
], | ||
} | ||
export default meta | ||
type Story = StoryObj<typeof SidePanelComponent> | ||
export const SidePanel: Story = {} |
48 changes: 48 additions & 0 deletions
48
opentrons-ai-client/src/molecules/SidePanel/__tests__/SidePanel.test.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,48 @@ | ||
import React from 'react' | ||
import { screen } from '@testing-library/react' | ||
import { describe, it, expect } from 'vitest' | ||
|
||
import { renderWithProviders } from '../../../__testing-utils__' | ||
import { i18n } from '../../../i18n' | ||
|
||
import { SidePanel } from '../index' | ||
|
||
const LOGO_FILE_NAME = | ||
'/opentrons-ai-client/src/assets/images/opentrons_logo.svg' | ||
|
||
const FEEDBACK_FORM_LINK = 'https://opentrons-ai-beta.paperform.co/' | ||
|
||
const render = (): ReturnType<typeof renderWithProviders> => { | ||
return renderWithProviders(<SidePanel />, { | ||
i18nInstance: i18n, | ||
}) | ||
} | ||
|
||
describe('SidePanel', () => { | ||
it('should render logo and text', () => { | ||
render() | ||
const image = screen.getByRole('img') | ||
expect(image.getAttribute('src')).toEqual(LOGO_FILE_NAME) | ||
screen.getByText( | ||
'Use natural language to generate protocols with OpentronsAI powered by OpenAI' | ||
) | ||
screen.getByText( | ||
'Write a prompt in natural language to generate a Reagent Transfer or a PCR protocol for the OT-2 or Opentrons Flex using the Opentrons Python Protocol API.' | ||
) | ||
screen.getByText('Stuck? Try these example prompts to get started.') | ||
screen.getByText('Got feedback? We love to hear it.') | ||
const link = screen.getByRole('link', { | ||
name: 'Share your thoughts here', | ||
}) | ||
expect(link).toHaveAttribute('href', FEEDBACK_FORM_LINK) | ||
}) | ||
|
||
it('should render buttons', () => { | ||
render() | ||
screen.getByRole('button', { name: 'PCR' }) | ||
screen.getByRole('button', { name: 'PCR (Flex)' }) | ||
screen.getByRole('button', { name: 'Reagent Transfer' }) | ||
screen.getByRole('button', { name: 'Reagent Transfer (Flex)' }) | ||
}) | ||
it.todo('should call a mock function when clicking a button') | ||
}) |
Oops, something went wrong.