Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade Ant to version 5 #166

Merged
merged 69 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
781ba97
fix: Changed props for ImageViewerApp to match new w3cv API
ShrimpCryptid May 8, 2024
2a4c28c
refactor: Upgrade web-3d-viewer to 2.9.0
ShrimpCryptid May 28, 2024
88585e8
fix: Fix styling on channel settings tab due to ant version or font
ShrimpCryptid May 28, 2024
b4a70e8
fix: Fixed missing ant drawer
ShrimpCryptid May 28, 2024
881b654
fix: Icons in toolbar were off-center
ShrimpCryptid May 28, 2024
8cf5f14
fix: Missing type declaration in tests
ShrimpCryptid May 28, 2024
e47064f
test: Update CI action to node v20
ShrimpCryptid May 28, 2024
1b60ba1
test: Import type declarations
ShrimpCryptid May 28, 2024
1e6ae81
test: Use original type declaration import, change CI action ordering
ShrimpCryptid May 28, 2024
74978ef
fix: Fixed build issues caused by local w3cv project instance being i…
ShrimpCryptid May 28, 2024
ae2c0f0
refactor: Upgrade to Ant ^5.16.2, fix compile issues
ShrimpCryptid May 29, 2024
1787e6b
fix: Removed unsupported babel plugin
ShrimpCryptid May 30, 2024
020057c
fix: Text colors, title colors, header font weight
ShrimpCryptid May 30, 2024
372bc74
fix: Page background color, link color
ShrimpCryptid May 30, 2024
877f372
fix: Header alignment
ShrimpCryptid May 30, 2024
433c5db
fix: Button colors and shadows, landing page text size
ShrimpCryptid May 30, 2024
fef7e1f
fix: Title color, paragraph padding, table margins
ShrimpCryptid May 30, 2024
1f3f033
fix: Bad colon alignment on dataset descriptions
ShrimpCryptid May 30, 2024
8004c2b
fix: Layout issues on viewer page
ShrimpCryptid May 30, 2024
a1dca40
fix: Loading spinner color
ShrimpCryptid May 30, 2024
e029d8f
fix: Header colors, alignment
ShrimpCryptid May 30, 2024
6ca9243
feat: Increased tab icon sizes, alignment fixes
ShrimpCryptid May 30, 2024
d0422a9
refactor: Make palette colors a constant
ShrimpCryptid May 30, 2024
8ad0a01
fix: Fixed overlap of viewer title and menu tab buttons
ShrimpCryptid May 30, 2024
fd77766
fix: Header menu tab styling
ShrimpCryptid May 30, 2024
c89e8a2
fix: Incorrect font in cookie banner
ShrimpCryptid May 30, 2024
37bc4eb
fix: Sider background colors
ShrimpCryptid Jun 3, 2024
a2bb87b
fix: Card action formatting
ShrimpCryptid Jun 3, 2024
1c271b4
fix: Gallery background width, transparency
ShrimpCryptid Jun 3, 2024
0537334
fix: Button and icon styling on gallery sidebar
ShrimpCryptid Jun 3, 2024
30ee436
fix: Action list on button icons
ShrimpCryptid Jun 3, 2024
ffd7e99
fix: Menu header being the incorrect height
ShrimpCryptid Jun 4, 2024
be18836
fix: Album list hover and selection colors
ShrimpCryptid Jun 4, 2024
dd30974
fix: Removed extra margin at bottom of page caused by gallery sider
ShrimpCryptid Jun 4, 2024
4f3a361
fix: Unclickable gallery close button, searchbar overlapping scrollbar
ShrimpCryptid Jun 4, 2024
251f827
fix: Removed deprecated properties on menus, modals, and dropdowns
ShrimpCryptid Jun 4, 2024
56ab427
fix: Checkbox colors
ShrimpCryptid Jun 4, 2024
98d0b72
fix: Fixed 3d viewer and plot extending into gallery sider
ShrimpCryptid Jun 5, 2024
aa6025e
fix: Close button on selected set
ShrimpCryptid Jun 5, 2024
d6bfbc2
fix: Album text alignment
ShrimpCryptid Jun 5, 2024
ac98ffa
fix: Popconfirm background color, removed button shadows
ShrimpCryptid Jun 5, 2024
764224a
fix: Axis dropdown not changing on selection, showing keys instead of…
ShrimpCryptid Jun 5, 2024
992104c
feat: Adjusted selected set delete button style
ShrimpCryptid Jun 5, 2024
57f1b2f
fix: Style matching on thumbnail popover
ShrimpCryptid Jun 5, 2024
458d8ea
fix: Popover now follows mouse
ShrimpCryptid Jun 5, 2024
4043c34
refactor: Deleted unused style CSS
ShrimpCryptid Jun 5, 2024
0268ebc
feat: Adjusted margin on gallery buttons
ShrimpCryptid Jun 5, 2024
e0101f8
fix: Gallery card button spacing, fixed download dropdown
ShrimpCryptid Jun 5, 2024
b3fa257
fix: Dropdowns extending up into header and being unclickable
ShrimpCryptid Jun 6, 2024
2d8fc3e
fix: Temporarily fixed dropdowns by overriding width
ShrimpCryptid Jun 6, 2024
6074c51
fix: Linting
ShrimpCryptid Jun 6, 2024
79e3889
refactor: Restored .gitkeep
ShrimpCryptid Jun 6, 2024
cd073c0
refactor: Import sorting, renamed variables
ShrimpCryptid Jun 6, 2024
2a6eeab
refactor: Palette now has base colors to prevent reused strings
ShrimpCryptid Jun 6, 2024
5e4155a
refactor: Code cleanup, increased tab icon size
ShrimpCryptid Jun 11, 2024
33c3083
fix: Alignment of 3d viewer text, increased plot height
ShrimpCryptid Jun 11, 2024
6c9b43e
fix: Dropdown arrow color, dropdown width
ShrimpCryptid Jun 11, 2024
0883829
fix: Alignment on gallery header
ShrimpCryptid Jun 11, 2024
dd6c38c
refactor: Removed style overrides for CellViewer
ShrimpCryptid Jun 11, 2024
0b2f0fe
refactor: Removed unused less dependencies
ShrimpCryptid Jun 11, 2024
0fff136
refactor: Removed additional unused dependencies
ShrimpCryptid Jun 11, 2024
e1310dc
refactor: Sorted imports, moved CSS
ShrimpCryptid Jun 17, 2024
20b7368
refactor: Moved imports, prevented theme re-calculation
ShrimpCryptid Jun 17, 2024
98ee918
refactor: Use single JSX tag instead of opening + closing tags
ShrimpCryptid Jun 17, 2024
ac0bb28
refactor: More import sorting, removed unused CSS
ShrimpCryptid Jun 17, 2024
0010843
Merge branch 'feat/upgrade-ant' of https://github.com/allen-cell-anim…
ShrimpCryptid Jun 17, 2024
f366e61
fix: Disabled button styling in Gallery view
ShrimpCryptid Jun 17, 2024
345cbfc
fix: Linting
ShrimpCryptid Jun 17, 2024
f34d2f7
Merge branch 'main' into feat/upgrade-ant
ShrimpCryptid Jun 18, 2024
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
31 changes: 9 additions & 22 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
{
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/transform-runtime",
["babel-plugin-import", {
"camel2DashComponentName": false,
"libraryDirectory": "",
"libraryName": "lodash"
}, "lodash"
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/transform-runtime"],
"presets": [
"@babel/preset-react",
["@babel/preset-env", { "modules": false }],
"@babel/preset-typescript"
],
["import", { "libraryName": "antd", "libraryDirectory": "es", "style": true }, "ant"],
["import", { "libraryName": "antd-mobile", "libraryDirectory": "lib"}, "antd-mobile"]

],
"presets": [
"@babel/preset-react",
["@babel/preset-env", { "modules": false }],
"@babel/preset-typescript"
],
"env": {
"commonjs": {
"presets": [["@babel/preset-env", { "modules": true }]]
"env": {
"commonjs": {
"presets": [["@babel/preset-env", { "modules": true }]]
}
}
}
}

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- run: npm ci
- run: npm test --if-present
- run: npm run lint --if-present
- run: npm run typeCheck --if-present
- run: npm test --if-present
3,790 changes: 1,664 additions & 2,126 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
},
"dependencies": {
"@aics/browsing-context-messaging": "~1.1",
"@aics/web-3d-viewer": "^2.7.4",
"@aics/web-3d-viewer": "^2.9.0",
"@ant-design/icons": "^4.2.2",
"antd": "^3.26.20",
"antd": "^5.17.4",
"axios": "^0.21.1",
"classnames": "^2.2.5",
"core-js": "^2.5.5",
Expand Down
9 changes: 5 additions & 4 deletions src/components/AffixedNav/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Anchor, Icon } from "antd";
import { Anchor } from "antd";
import { DotChartOutlined, PictureOutlined, SyncOutlined } from "@ant-design/icons";
import React from "react";
const { Link } = Anchor;

Expand All @@ -12,7 +13,7 @@ const AffixedNav: React.SFC = () => {
href="#main-plot"
title={
<React.Fragment>
<Icon type="dot-chart" />
<DotChartOutlined />
<span> Plot </span>
</React.Fragment>
}
Expand All @@ -21,7 +22,7 @@ const AffixedNav: React.SFC = () => {
href="#gallery"
title={
<React.Fragment>
<Icon type="picture" />
<PictureOutlined />
<span> Gallery </span>
</React.Fragment>
}
Expand All @@ -30,7 +31,7 @@ const AffixedNav: React.SFC = () => {
href="#three-d-viewer"
title={
<React.Fragment>
<Icon type="sync" />
<SyncOutlined />
<span> 3D viewer </span>
</React.Fragment>
}
Expand Down
11 changes: 8 additions & 3 deletions src/components/AppHeader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Row } from "antd";
import * as React from "react";

import { AicsLogo } from "../Icons";
Expand All @@ -14,15 +15,19 @@ class AppHeader extends React.Component<AppHeaderProps> {

return (
<div className={styles.pageHeader}>
<div>
<a href="https://allencell.org" title="Allen Cell Explorer">
<Row align={"middle"}>
<a
href="https://allencell.org"
title="Allen Institute for Cell Science"
style={{ height: "41px" }}
>
{AicsLogo}
</a>
<span className={styles.verticalBar}>|</span>
<a href="/" className={styles.cfeHome}>
Cell Feature Explorer
</a>
</div>
</Row>
<div className={styles.viewerTitle}>{selectedDataset}</div>
<div className={styles.buttons}></div>
</div>
Expand Down
32 changes: 20 additions & 12 deletions src/components/AxisDropDown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Select, Tooltip } from "antd";
import { SelectValue } from "antd/es/select";
import { SelectProps, SelectValue } from "antd/es/select";
import React from "react";
import { ActionCreator } from "react-redux";

Expand All @@ -16,8 +16,6 @@ interface AxisDropDownProps {
tooltip: string;
}

const Option = Select.Option;

export default class AxisDropDown extends React.Component<AxisDropDownProps> {
constructor(props: AxisDropDownProps) {
super(props);
Expand All @@ -32,18 +30,28 @@ export default class AxisDropDown extends React.Component<AxisDropDownProps> {

public render() {
const { axisId, value, options, tooltip } = this.props;

const selectOptions: SelectProps["options"] = options.map((option) => {
return {
label: `${option.displayName} ${option.unit ? `(${option.unit})` : ""}`,
key: option.key,
value: option.key,
tooltip: option.tooltip,
};
});

const selectedOptionLabel = selectOptions
.find((option) => option.key === value)
?.label?.toString();

return (
<div className={styles[axisId]}>
<Tooltip title={tooltip}>
<Select onChange={this.handleChange} value={value}>
{options.map((option) => {
return (
<Option value={option.key} key={option.key}>
{option.displayName} {option.unit ? `(${option.unit})` : ""}
</Option>
);
})}
</Select>
<Select
onChange={this.handleChange}
value={selectedOptionLabel || value}
options={selectOptions}
></Select>
</Tooltip>
</div>
);
Expand Down
18 changes: 8 additions & 10 deletions src/components/CellViewer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ImageViewerApp } from "@aics/web-3d-viewer";
import React from "react";
// Need to import this stylesheet for the Drawer component used by the viewer
// TODO: Fix viewer so this is unnecessary?
import "antd/lib/drawer/style/index.less";

import styles from "./style.css";

import { VolumeViewerProps } from "../../containers/Cfe/selectors";

Expand All @@ -19,20 +18,19 @@ const CellViewer: React.FunctionComponent<VolumeViewerProps> = (props) => {
}

return (
<div style={CONTAINER_STYLE}>
<div className={styles.cellViewerContainer} style={CONTAINER_STYLE}>
<ImageViewerApp
cellId={props.cellId}
baseUrl={props.baseUrl}
cellPath={props.cellPath}
fovDownloadHref={props.fovDownloadHref}
cellDownloadHref={props.cellDownloadHref}
fovPath={props.fovPath}
imageUrl={props.baseUrl + props.cellPath}
parentImageDownloadHref={props.fovDownloadHref}
imageDownloadHref={props.cellDownloadHref}
parentImageUrl={props.baseUrl + props.fovPath}
viewerChannelSettings={props.viewerChannelSettings}
transform={props.transform}
onControlPanelToggle={props.onControlPanelToggle}
metadata={props.metadata}
appHeight="100%"
canvasMargin="0 120px 0 0"
canvasMargin="0 0 0 0"
/>
</div>
);
Expand Down
37 changes: 37 additions & 0 deletions src/components/CellViewer/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* Style overrides to fix alignment caused by an Ant version + font mismatch.
* TODO: Remove this when Ant version is upgraded?
*/

.cell-viewer-container {
/* Align header items; fix a bug where the entire div would show pointer-interactive
* when only the icon (span) was clickable.
*/
& :global(.ant-collapse-header) {
align-items: center !important;
cursor: auto !important;

& :global(.ant-collapse-arrow) > span {
cursor: pointer !important;
}

& :global(.ant-collapse-extra) {
width: 45% !important;
}
}

/* Remove outlines on channel settings toggles */
& :global(.channel-visibility-controls) > :global(.ant-btn-icon-only) {
border-color: transparent !important;
}

/* Fix missing bottom drawer */
& :global(.ant-drawer.ant-drawer-bottom) {
height: 100% !important;
position: relative !important;
}

/* Fix icons in toolbar not being centered */
& :global(.viewer-toolbar-group) > button:global(.ant-btn-icon-only) {
padding: 0 !important;
}
}
4 changes: 2 additions & 2 deletions src/components/ColorBySwitcher/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ColorBySwitcherProps {

const ColorBySwitcher: React.SFC<ColorBySwitcherProps> = (props) => {
return props.includeCol ? (
<Row className={styles.colorByRow} type="flex" align="middle">
<Row className={styles.colorByRow} align="middle">
<Col span={props.includeCol}>
<label className={styles.label}>Color by:</label>
<Switch
Expand All @@ -28,7 +28,7 @@ const ColorBySwitcher: React.SFC<ColorBySwitcherProps> = (props) => {
{props.children}
</Row>
) : (
<Row className={styles.colorByRow} type="flex" align="middle">
<Row className={styles.colorByRow} align="middle">
<label className={styles.label}>{props.label}</label>
<Switch
className={styles.colorBySwitch}
Expand Down
8 changes: 4 additions & 4 deletions src/components/DatasetCard/index.tsx
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed a bug where the colons would appear in strange places when the description stretched to multiple lines. This removes the auto-added colons and instead makes them part of the description itself.

Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ const DatasetCard: React.FunctionComponent<DatasetCardProps> = ({
/>
{/* Spacer div to push `Descriptions` to the bottom of the card */}
<div className={styles.spacer}/>
<Descriptions column={1} size="small">
{userData.totalCells && <Descriptions.Item label="Number of Cells">
<Descriptions column={1} size="small" colon={false}>
{userData.totalCells && <Descriptions.Item label="Number of Cells:">
Comment on lines +69 to +70
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes colons part of the label to prevent a weird alignment bug with multiline labels

{userData.totalCells.toLocaleString("en")}
</Descriptions.Item>}
{userData.totalFOVs && <Descriptions.Item label="Number of FOVs">
{userData.totalFOVs && <Descriptions.Item label="Number of FOVs:">
{userData.totalFOVs.toLocaleString("en")}
</Descriptions.Item>}
{userData.totalTaggedStructures && <Descriptions.Item label="Number of tagged structures">
{userData.totalTaggedStructures && <Descriptions.Item label="Number of tagged structures:">
{userData.totalTaggedStructures}
</Descriptions.Item>}
</Descriptions>
Expand Down
Loading
Loading