Skip to content

Commit

Permalink
Merge pull request #1544 from nickgros/PORTALS-2651-remaining
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgros authored Feb 4, 2025
2 parents 6d27b27 + cb20e09 commit df1c1d9
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 96 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box } from '@mui/material'
import { Meta, StoryObj } from '@storybook/react'
import { fn } from '@storybook/test'
import {
generatedEvaulations,
mockEvaluationQueue,
Expand All @@ -17,6 +18,9 @@ const meta: Meta = {
</Box>
),
],
args: {
onChangeSelectedEvaluation: fn(),
},
} satisfies Meta<typeof AvailableEvaluationQueueList>
export default meta
type Story = StoryObj<typeof meta>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ describe('DetailsView tests', () => {
]),
})

await screen.findByRole('listbox')
await screen.findByRole('combobox')

// We should have two versions and 'Always Latest Version' as options
expect((await screen.findAllByRole('option')).length).toBe(3)
Expand Down Expand Up @@ -715,7 +715,7 @@ describe('DetailsView tests', () => {
versionSelection: VersionSelectionType.REQUIRED,
})

await screen.findByRole('listbox')
await screen.findByRole('combobox')

// We should have two versions
expect(screen.getAllByRole('option').length).toBe(2)
Expand All @@ -731,7 +731,7 @@ describe('DetailsView tests', () => {
[entityHeaders[0].id, { targetId: entityHeaders[0].id }],
]),
})
const versionSelectBox = await screen.findByRole('listbox')
const versionSelectBox = await screen.findByRole('combobox')

// There are two versions, plus "Always Latest"
const options = await screen.findAllByRole('option')
Expand Down Expand Up @@ -775,7 +775,7 @@ describe('DetailsView tests', () => {
[entityHeaders[0].id, { targetId: entityHeaders[0].id }],
]),
})
expect(await screen.findByRole('listbox')).toBeDefined()
expect(await screen.findByRole('combobox')).toBeDefined()

expect(
(screen.getAllByRole('option')[0] as HTMLOptionElement).selected,
Expand Down Expand Up @@ -815,7 +815,7 @@ describe('DetailsView tests', () => {
],
]),
})
expect(await screen.findByRole('listbox')).toBeDefined()
expect(await screen.findByRole('combobox')).toBeDefined()

expect(
(screen.getAllByRole('option')[0] as HTMLOptionElement).selected,
Expand Down Expand Up @@ -850,7 +850,7 @@ describe('DetailsView tests', () => {
]),
versionSelection: VersionSelectionType.REQUIRED,
})
expect(await screen.findByRole('listbox')).toBeDefined()
expect(await screen.findByRole('combobox')).toBeDefined()

// Always Latest Version is not an option
expect(screen.getAllByRole('option').length).toBe(2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Select } from '@mui/material'
import { EntityType, Reference } from '@sage-bionetworks/synapse-types'
import { CellContext } from '@tanstack/react-table'
import { SyntheticEvent, useEffect } from 'react'
import { Form } from 'react-bootstrap'
import { useEffect } from 'react'
import { useGetVersionsInfinite } from '../../../../../synapse-queries/index'
import { isTableType } from '../../../../../utils/functions/EntityTypeUtils'
import IconSvg from '../../../../IconSvg/IconSvg'
Expand Down Expand Up @@ -111,17 +111,17 @@ export function EntityFinderVersionCell(props: EntityFinderVersionCellProps) {
return (
<div>
{versions && versions.length > 0 ? (
<Form.Control
role="listbox"
size="sm"
as="select"
<Select
native
fullWidth
value={currentSelectedVersionOptionValue}
onClick={(event: SyntheticEvent<HTMLSelectElement>) => {
onClick={event => {
event.stopPropagation()
}}
sx={{ height: '30px' }}
onChange={event => {
event.stopPropagation()
const version = parseInt(event.target.value)
const version = parseInt((event.target as HTMLInputElement).value)
toggleSelection({
targetId: id,
targetVersionNumber:
Expand All @@ -143,7 +143,7 @@ export function EntityFinderVersionCell(props: EntityFinderVersionCellProps) {
</option>
)
})}
</Form.Control>
</Select>
) : (
latestVersionText
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function MarkdownEditor({
}

return (
<div className="bootstrap-4-backport MarkdownEditor">
<div className="MarkdownEditor">
<div className="MarkdownEditorControls">
<div className="Tabs">
{MarkdownEditorTabs.map(tabName => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ import ProvenanceGraph, { ProvenanceProps } from './ProvenanceGraph'
const meta: Meta<ProvenanceProps> = {
title: 'Synapse/ProvenanceGraph',
component: ProvenanceGraph,
decorators: [
Story => (
<div className="bootstrap-4-backport">
<Story />
</div>
),
],
}

export default meta
type Story = StoryObj<typeof meta>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ const ProvenanceReactFlow = (props: ProvenanceProps) => {
)
return (
<div
className="bootstrap-4-backport ProvenanceWidget"
className="ProvenanceWidget"
role="graphics-doc" //https://www.w3.org/wiki/SVG_Accessibility/ARIA_roles_for_charts#Document_Roles
style={{ width: '100%', height: containerHeight }}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function QuerySortSelector({ sortConfig }: QuerySortSelectorProps) {
}

return (
<div className="QuerySortSelector bootstrap-4-backport">
<div className="QuerySortSelector">
<Typography variant="label" className="sort-by-label SRC-inlineBlock">
Sort by
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function SubsectionRowRenderer({
return friendlyValue ? friendlyValue : rawValue
}
return (
<div className="SubsectionRowRenderer bootstrap-4-backport">
<div className="SubsectionRowRenderer">
{isLoading && <SkeletonTable numRows={2} numCols={1} />}
{!isLoading &&
rowSet &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { Meta, StoryObj } from '@storybook/react'
import { SynapseContextConsumer } from '../../utils/context/SynapseContext'
import SynapseFormWrapper, {
SynapseFormWrapperProps,
} from './SynapseFormWrapper'

const meta = {
title: 'Synapse/SynapseFormWrapper',
component: SynapseFormWrapper,
render: args => (
<SynapseContextConsumer>
{synapseContext => (
<SynapseFormWrapper {...args} token={synapseContext?.accessToken} />
)}
</SynapseContextConsumer>
),
parameters: {
withRouter: true,
},
} satisfies Meta<SynapseFormWrapperProps>
export default meta
type Story = StoryObj<typeof meta>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { Badge, Drawer, List, ListItemButton, Tooltip } from '@mui/material'
import {
Badge,
Drawer,
InputAdornment,
List,
ListItemButton,
TextField,
Tooltip,
} from '@mui/material'
import {
Direction,
SubmissionSortField,
SubmissionState,
} from '@sage-bionetworks/synapse-types'
import { useState } from 'react'
import { Form } from 'react-bootstrap'
import { useState, KeyboardEvent } from 'react'
import SynapseIconWhite from '../../assets/icons/SynapseIconWhite'
import SynapseLogoName from '../../assets/icons/SynapseLogoName'
import SynapseClient from '../../synapse-client'
Expand Down Expand Up @@ -416,26 +423,32 @@ export function SynapseNavDrawer({
<IconSvg icon="addCircleOutline" />
</a>
</Tooltip>
<div className="searchInputWithIcon">
<IconSvg icon="searchOutlined" />
<Form.Control
type="search"
placeholder="Search All Projects"
value={projectSearchText}
onChange={event => {
setProjectSearchText(event.target.value)
}}
onKeyDown={(event: any) => {
if (event.key === 'Enter') {
if (event.target.value !== '') {
setProjectSearchText('')
handleDrawerClose()
onProjectSearch(event.target.value)
}
<TextField
type="search"
placeholder="Search All Projects"
value={projectSearchText}
onChange={event => {
setProjectSearchText(event.target.value)
}}
onKeyDown={(event: KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter') {
if ((event.target as HTMLInputElement).value !== '') {
setProjectSearchText('')
handleDrawerClose()
onProjectSearch(
(event.target as HTMLInputElement).value,
)
}
}}
/>
</div>
}
}}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<IconSvg icon="searchOutlined" />
</InputAdornment>
),
}}
/>
<div className="linkList" onClick={handleDrawerClose}>
<a
className="SRC-whiteText"
Expand Down Expand Up @@ -544,30 +557,35 @@ export function SynapseNavDrawer({
{selectedItem == NavItem.HELP && (
<>
<div className="header">Help</div>
<div className="searchInputWithIcon">
<IconSvg icon="searchOutlined" />
<Form.Control
type="search"
placeholder="Search Synapse Documentation"
value={docSiteSearchText}
onChange={event => {
setDocSiteSearchText(event.target.value)
}}
onKeyDown={(event: any) => {
if (event.key === 'Enter') {
if (event.target.value !== '') {
window.open(
`https://help.synapse.org/search.html?max=10&s=docs&q=${encodeURI(
event.target.value,
)}`,
)
setDocSiteSearchText('')
handleDrawerClose()
}
<TextField
type="search"
placeholder="Search Documentation"
value={docSiteSearchText}
onChange={event => {
setDocSiteSearchText(event.target.value)
}}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<IconSvg icon="searchOutlined" />
</InputAdornment>
),
}}
onKeyDown={event => {
if (event.key === 'Enter') {
if ((event.target as HTMLInputElement).value !== '') {
window.open(
`https://help.synapse.org/search.html?max=10&s=docs&q=${encodeURI(
(event.target as HTMLInputElement).value,
)}`,
)
setDocSiteSearchText('')
handleDrawerClose()
}
}}
/>
</div>
}
}}
/>

<div className="linkList" onClick={handleDrawerClose}>
<a
className="SRC-whiteText"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Select } from '@mui/material'
import { EntityRef } from '@sage-bionetworks/synapse-types'
import { CellContext } from '@tanstack/react-table'
import { SyntheticEvent, useEffect } from 'react'
import { Form } from 'react-bootstrap'
import { useEffect } from 'react'
import { useGetVersionsInfinite } from '../../../synapse-queries/index'
import { DatasetItemsEditorTableData } from './DatasetItemsEditor'

Expand Down Expand Up @@ -47,17 +47,17 @@ export function DatasetEditorVersionCell(props: DatasetEditorVersionCellProps) {
return (
<div>
{versions && versions.length > 0 && (
<Form.Control
role="listbox"
size="sm"
as="select"
<Select
native
fullWidth
value={versionNumber}
onClick={(event: SyntheticEvent<HTMLSelectElement>) => {
sx={{ height: '30px' }}
onClick={event => {
event.stopPropagation()
}}
onChange={event => {
event.stopPropagation()
const version = parseInt(event.target.value)
const version = parseInt((event.target as HTMLInputElement).value)
toggleSelection({
entityId: entityId,
versionNumber: version,
Expand All @@ -82,7 +82,7 @@ export function DatasetEditorVersionCell(props: DatasetEditorVersionCellProps) {
</option>
)
})}
</Form.Control>
</Select>
)}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ describe('Dataset Items Editor tests', () => {
)

// Call under test: select a different version
await user.selectOptions(await screen.findByRole('listbox'), '1')
await user.selectOptions(await screen.findByRole('combobox'), '1')

// The version passed to the icons should now be v1
await waitFor(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@
margin-left: 185px;
}

.markdown span.bootstrap-4-backport a {
margin: 20px 20px 20px 0px;
}

.markdown details {
cursor: pointer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
.synapseLogoNameContainer {
padding: 25px 0px 16px 5px;
}
.searchInputWithIcon {
padding-top: 30px;
.MuiTextField-root {
margin-top: 30px;
}
.header {
font-size: 20px;
Expand Down
Loading

0 comments on commit df1c1d9

Please sign in to comment.