Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/edge' into EXEC-1055-96-chan-tes…
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Dec 12, 2024
2 parents f99df68 + 09febe7 commit 979241b
Show file tree
Hide file tree
Showing 62 changed files with 1,577 additions and 182 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {
'no-case-declarations': 'warn',
'prefer-regex-literals': 'warn',
'react/prop-types': 'warn',
'react/jsx-curly-brace-presence': 'warn',

// Enforce notification hooks
'no-restricted-imports': [
Expand Down
8 changes: 5 additions & 3 deletions .github/actions/odd-resource-analysis/action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ async function run() {
try {
const mixpanelUser = core.getInput('mixpanel-user', { required: true })
const mixpanelSecret = core.getInput('mixpanel-secret', { required: true })
const mixpanelProjectId = core.getInput('mixpanel-project-id', {
required: true,
})
const mixpanelProjectId = parseInt(
core.getInput('mixpanel-project-id', {
required: true,
})
)
const previousVersionCount = parseInt(
core.getInput('previous-version-count') || '2'
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function getMixpanelResourceMonitorDataFor({
where,
}) {
const params = new URLSearchParams({
project_id: parseInt(projectId),
project_id: projectId,
from_date: fromDate,
to_date: toDate,
event: '["resourceMonitorReport"]',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/odd-memory-usage-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
with:
mixpanel-user: ${{ secrets.MIXPANEL_INGEST_USER }}
mixpanel-secret: ${{ secrets.MIXPANEL_INGEST_SECRET }}
mixpanel-project-id: ${{ secrets.OT_APP_MIXPANEL_ID }}
mixpanel-project-id: ${{ secrets.OT_MIXPANEL_PROJECT_ID }}
previous-version-count: '2'
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function AlphanumericKeyboard({
return (
<Keyboard
keyboardRef={r => (keyboardRef.current = r)}
theme={'hg-theme-default oddTheme1 alphanumericKeyboard'}
theme="hg-theme-default oddTheme1 alphanumericKeyboard"
onChange={onChange}
onKeyPress={onKeyPress}
layoutName={layoutName}
Expand Down
2 changes: 1 addition & 1 deletion app/src/atoms/SoftwareKeyboard/FullKeyboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function FullKeyboard({
return (
<Keyboard
keyboardRef={r => (keyboardRef.current = r)}
theme={'hg-theme-default oddTheme1'}
theme="hg-theme-default oddTheme1"
onChange={onChange}
onKeyPress={onKeyPress}
layoutName={layoutName}
Expand Down
2 changes: 1 addition & 1 deletion app/src/atoms/SoftwareKeyboard/IndividualKey/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function IndividualKey({
*/
<Keyboard
keyboardRef={r => (keyboardRef.current = r)}
theme={'hg-theme-default oddTheme1 individual-key'}
theme="hg-theme-default oddTheme1 individual-key"
onChange={onChange}
layoutName="default"
display={customDisplay}
Expand Down
2 changes: 1 addition & 1 deletion app/src/atoms/SoftwareKeyboard/NumericalKeyboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function NumericalKeyboard({
*/
<Keyboard
keyboardRef={r => (keyboardRef.current = r)}
theme={'hg-theme-default oddTheme1 numerical-keyboard'}
theme="hg-theme-default oddTheme1 numerical-keyboard"
onInit={keyboard => {
keyboard.setInput(initialValue)
}}
Expand Down
2 changes: 1 addition & 1 deletion app/src/molecules/InstrumentCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function InstrumentCard(props: InstrumentCardProps): JSX.Element {
pipetteSpecs={instrumentDiagramProps.pipetteSpecs}
mount={instrumentDiagramProps.mount}
transform="scale(0.3)"
transformOrigin={'-5% 52%'}
transformOrigin="-5% 52%"
/>
</Flex>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion app/src/molecules/InterventionModal/ModalContentMixed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function ModalContentMixedSpinner(
return (
<Box
marginBottom={SPACING.spacing16}
width={'80px'}
width="80px"
css={`
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
width: 100px;
Expand Down
2 changes: 1 addition & 1 deletion app/src/molecules/InterventionModal/TwoColumn.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function Image({ imageUrl }: ImageProps): JSX.Element | null {
const hasComponent =
imageUrl != null && imageUrl.length > 0 && imageUrl[0].length > 0
return hasComponent ? (
<img src={new URL(imageUrl[0], import.meta.url).href} width={'100%'} />
<img src={new URL(imageUrl[0], import.meta.url).href} width="100%" />
) : null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('InterventionModal', () => {
it('renders headline', () => {
render(
<ModalContentOneColSimpleButtons
headline={'headline'}
headline="headline"
firstButton={{ label: 'first button', value: 'first' }}
secondButton={{ label: 'second button', value: 'second' }}
/>
Expand All @@ -27,7 +27,7 @@ describe('InterventionModal', () => {
it('renders buttons', () => {
render(
<ModalContentOneColSimpleButtons
headline={'headline'}
headline="headline"
firstButton={{ label: 'first button', value: 'first' }}
secondButton={{ label: 'second button', value: 'second' }}
furtherButtons={[
Expand All @@ -44,7 +44,7 @@ describe('InterventionModal', () => {
it('enforces single-item selection', () => {
render(
<ModalContentOneColSimpleButtons
headline={'headline'}
headline="headline"
firstButton={{ label: 'first button', value: 'first' }}
secondButton={{ label: 'second button', value: 'second' }}
furtherButtons={[{ label: 'third button', value: 'third' }]}
Expand All @@ -68,11 +68,11 @@ describe('InterventionModal', () => {
it('can start with a button selected', () => {
render(
<ModalContentOneColSimpleButtons
headline={'headline'}
headline="headline"
firstButton={{ label: 'first button', value: 'first' }}
secondButton={{ label: 'second button', value: 'second' }}
furtherButtons={[{ label: 'third button', value: 'third' }]}
initialSelected={'second'}
initialSelected="second"
/>
)
expect(inputElForButtonFromButtonText('first button').checked).toBeFalsy()
Expand All @@ -84,7 +84,7 @@ describe('InterventionModal', () => {
const onChange = vi.fn()
render(
<ModalContentOneColSimpleButtons
headline={'headline'}
headline="headline"
firstButton={{
label: 'first button',
value: 'first',
Expand All @@ -110,7 +110,7 @@ describe('InterventionModal', () => {
const onSelect = vi.fn()
render(
<ModalContentOneColSimpleButtons
headline={'headline'}
headline="headline"
firstButton={{ label: 'first button', value: 'first' }}
secondButton={{ label: 'second button', value: 'second' }}
furtherButtons={[{ label: 'third button', value: 'third' }]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function StandInContent({
}): JSX.Element {
return (
<Box
border={'4px dashed #A864FFFF'}
border="4px dashed #A864FFFF"
borderRadius={BORDERS.borderRadius8}
height="104px"
backgroundColor="#A864FF19"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('CalibrationTaskList', () => {
rerender(
<MemoryRouter>
<CalibrationTaskList
robotName={'otie'}
robotName="otie"
pipOffsetCalLauncher={mockPipOffsetCalLauncher}
tipLengthCalLauncher={mockTipLengthCalLauncher}
deckCalLauncher={mockDeckCalLauncher}
Expand All @@ -108,7 +108,7 @@ describe('CalibrationTaskList', () => {
rerender(
<MemoryRouter>
<CalibrationTaskList
robotName={'otie'}
robotName="otie"
pipOffsetCalLauncher={mockPipOffsetCalLauncher}
tipLengthCalLauncher={mockTipLengthCalLauncher}
deckCalLauncher={mockDeckCalLauncher}
Expand All @@ -133,7 +133,7 @@ describe('CalibrationTaskList', () => {
rerender(
<MemoryRouter>
<CalibrationTaskList
robotName={'otie'}
robotName="otie"
pipOffsetCalLauncher={mockPipOffsetCalLauncher}
tipLengthCalLauncher={mockTipLengthCalLauncher}
deckCalLauncher={mockDeckCalLauncher}
Expand All @@ -158,7 +158,7 @@ describe('CalibrationTaskList', () => {
rerender(
<MemoryRouter>
<CalibrationTaskList
robotName={'otie'}
robotName="otie"
pipOffsetCalLauncher={mockPipOffsetCalLauncher}
tipLengthCalLauncher={mockTipLengthCalLauncher}
deckCalLauncher={mockDeckCalLauncher}
Expand All @@ -182,7 +182,7 @@ describe('CalibrationTaskList', () => {
rerender(
<MemoryRouter>
<CalibrationTaskList
robotName={'otie'}
robotName="otie"
pipOffsetCalLauncher={mockPipOffsetCalLauncher}
tipLengthCalLauncher={mockTipLengthCalLauncher}
deckCalLauncher={mockDeckCalLauncher}
Expand All @@ -206,7 +206,7 @@ describe('CalibrationTaskList', () => {
rerender(
<MemoryRouter>
<CalibrationTaskList
robotName={'otie'}
robotName="otie"
pipOffsetCalLauncher={mockPipOffsetCalLauncher}
tipLengthCalLauncher={mockTipLengthCalLauncher}
deckCalLauncher={mockDeckCalLauncher}
Expand All @@ -228,7 +228,7 @@ describe('CalibrationTaskList', () => {
rerender(
<MemoryRouter>
<CalibrationTaskList
robotName={'otie'}
robotName="otie"
pipOffsetCalLauncher={mockPipOffsetCalLauncher}
tipLengthCalLauncher={mockTipLengthCalLauncher}
deckCalLauncher={mockDeckCalLauncher}
Expand All @@ -253,7 +253,7 @@ describe('CalibrationTaskList', () => {
rerender(
<MemoryRouter>
<CalibrationTaskList
robotName={'otie'}
robotName="otie"
pipOffsetCalLauncher={mockPipOffsetCalLauncher}
tipLengthCalLauncher={mockTipLengthCalLauncher}
deckCalLauncher={mockDeckCalLauncher}
Expand Down Expand Up @@ -281,7 +281,7 @@ describe('CalibrationTaskList', () => {
rerender(
<MemoryRouter>
<CalibrationTaskList
robotName={'otie'}
robotName="otie"
pipOffsetCalLauncher={mockPipOffsetCalLauncher}
tipLengthCalLauncher={mockTipLengthCalLauncher}
deckCalLauncher={mockDeckCalLauncher}
Expand Down
2 changes: 1 addition & 1 deletion app/src/organisms/Desktop/ChooseProtocolSlideout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ export function ChooseProtocolSlideoutComponent(
<LinkComponent
color={COLORS.blue55}
role="button"
to={''}
to=""
/>
),
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ export function AddFixtureModal({
}}
aria-label="back"
paddingX={SPACING.spacing16}
marginTop={'1.44rem'}
marginBottom={'0.56rem'}
marginTop="1.44rem"
marginBottom="0.56rem"
>
<LegacyStyledText css={GO_BACK_BUTTON_STYLE}>
{t('shared:go_back')}
Expand Down
6 changes: 3 additions & 3 deletions app/src/organisms/ODD/NetworkSettings/FailedToConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function FailedToConnect({
name="ot-alert"
size="3rem"
color={COLORS.red50}
aria-label={'failed_to_connect_invalidPassword'}
aria-label="failed_to_connect_invalidPassword"
/>
<Flex
flexDirection={DIRECTION_COLUMN}
Expand Down Expand Up @@ -83,13 +83,13 @@ export function FailedToConnect({
</Flex>
<Flex gridGap={SPACING.spacing8}>
<MediumButton
flex={'1'}
flex="1"
buttonType="secondary"
buttonText={t('change_network')}
onClick={handleChangeNetwork}
/>
<MediumButton
flex={'1'}
flex="1"
buttonText={i18n.format(t('shared:try_again'), 'capitalize')}
onClick={handleTryAgain}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const render = (longPress: UseLongPressResult) => {
<MemoryRouter>
<LongPressModal
longpress={longPress}
protocolId={'mockProtocol1'}
protocolId="mockProtocol1"
setShowDeleteConfirmationModal={mockFunc}
setTargetProtocolId={mockSetTargetProtocolId}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const render = (longPress: UseLongPressResult) => {
<MemoryRouter>
<LongPressModal
longpress={longPress}
transferId={'mockProtocol1'}
transferId="mockProtocol1"
setShowDeleteConfirmationModal={mockFunc}
setTargetTransferId={mockSetTargetTransferId}
/>
Expand Down
56 changes: 25 additions & 31 deletions components/src/molecules/DropdownMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ import { Tooltip } from '../../atoms/Tooltip'
import { StyledText } from '../../atoms/StyledText'
import { LiquidIcon } from '../LiquidIcon'

/** this is the max height to display 10 items */
const MAX_HEIGHT = 316

/** this is for adjustment variable for the case that the space of the bottom and the space of the top are very close */
const HEIGHT_ADJUSTMENT = 100

export interface DropdownOption {
name: string
value: string
Expand Down Expand Up @@ -115,34 +109,34 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {

const handlePositionCalculation = (): void => {
const dropdownRect = dropDownMenuWrapperRef.current?.getBoundingClientRect()
if (dropdownRect != null) {
const parentElement = dropDownMenuWrapperRef?.current?.parentElement
const grandParentElement = parentElement?.parentElement?.parentElement
let availableHeight = window.innerHeight
let scrollOffset = 0
if (!dropdownRect) return

const parentElement = dropDownMenuWrapperRef.current?.parentElement
const grandParentElement = parentElement?.parentElement?.parentElement

let availableHeight = window.innerHeight
let scrollOffset = 0

if (grandParentElement) {
const grandParentRect = grandParentElement.getBoundingClientRect()
availableHeight = grandParentRect.bottom - grandParentRect.top
scrollOffset = grandParentRect.top
} else if (parentElement) {
const parentRect = parentElement.getBoundingClientRect()
availableHeight = parentRect.bottom - parentRect.top
scrollOffset = parentRect.top
}

if (grandParentElement != null) {
const grandParentRect = grandParentElement.getBoundingClientRect()
availableHeight = grandParentRect.bottom - grandParentRect.top
scrollOffset = grandParentRect.top
} else if (parentElement != null) {
const parentRect = parentElement.getBoundingClientRect()
availableHeight = parentRect.bottom - parentRect.top
scrollOffset = parentRect.top
}
const dropdownHeight = filterOptions.length * 34 + 10 // note (kk:2024/12/06) need to modify the value since design uses different height in desktop and pd
const dropdownBottom = dropdownRect.bottom + dropdownHeight - scrollOffset

const downSpace =
filterOptions.length + 1 > 10
? MAX_HEIGHT
: (filterOptions.length + 1) * 34
const dropdownBottom = dropdownRect.bottom + downSpace - scrollOffset
const fitsBelow = dropdownBottom <= availableHeight
const fitsAbove = dropdownRect.top - dropdownHeight >= scrollOffset

setDropdownPosition(
dropdownBottom > availableHeight &&
Math.abs(dropdownBottom - availableHeight) > HEIGHT_ADJUSTMENT
? 'top'
: 'bottom'
)
if (menuPlacement === 'auto') {
setDropdownPosition(fitsBelow ? 'bottom' : fitsAbove ? 'top' : 'bottom')
} else {
setDropdownPosition(menuPlacement)
}
}

Expand Down
Loading

0 comments on commit 979241b

Please sign in to comment.