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

Feature/16 - Sidebar, Nodes, Node selection move to meta-diagram theme, add variables #17

Merged
merged 28 commits into from
Aug 1, 2022

Conversation

vidhya-metacell
Copy link
Contributor

Closes #16

@vidhya-metacell vidhya-metacell requested a review from zsinnema July 26, 2022 10:07
Copy link
Contributor

@zsinnema zsinnema left a comment

Choose a reason for hiding this comment

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

@vidhya-metacell are you sure that the dist needs to be in git?

cursor: "pointer",
}

const customNodeStyles = {
Copy link
Contributor

Choose a reason for hiding this comment

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

@vidhya-metacell why did you choose to use certain local object attributes for styling instead of using a material ui theme that contains the style/styles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

const { style, engine, port } = this.props;
return (
<>
<Button className="node-button">
Copy link
Contributor

Choose a reason for hiding this comment

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

@afonsobspinto @vidhya-metacell I would like to see this refactored , this is not so DRY (see https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)

const node1 = new MetaNode('1', 'node1', 'default', new Position(250, 100),
new Map(Object.entries({color: 'rgb(0,192,255)'})))
const node1 = new MetaNode('1', 'Node 1', 'default', new Position(250, 100),
new Map(Object.entries(colorGreen)))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like this to be in the theme with theme provider like MUI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zsinnema if i add these variants to theme, then it limits us to use only specific variants like green, orange etc. I believe this should not be a restricted option, user should have an option to choose node color options from the project , also whatever color options he/she wants not just limited to the set theme options.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean create an "application specific" theme and use that theme. If the app wants orange nodes then make if in the theme orange. For variants we can use this: https://mui.com/material-ui/customization/theme-components/#creating-new-component-variants

<ListItemButton
selected={selected === '1'}
onClick={() => setSelected('1')}
>
<ListItemIcon>
Copy link
Contributor

Choose a reason for hiding this comment

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

@vidhya-metacell please refactor into DRY, e.g. use an array with the listitems and then loop, factor out the listitem jsx into a seperate file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zsinnema Yes i agree, i will change this

@@ -34,6 +34,16 @@ const vars = {

switchShadow:
'0 0.1875rem 0.5rem rgba(0, 0, 0, 0.15), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.06)',

Copy link
Contributor

Choose a reason for hiding this comment

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

@vidhya-metacell do we need this if we do the MUI theming?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zsinnema Yes, as with other style properties. User can change the color/shadows whatever as required by the project.

Copy link
Contributor

Choose a reason for hiding this comment

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

an instead of doing this let the user create a theme

@vidhya-metacell
Copy link
Contributor Author

@vidhya-metacell are you sure that the dist needs to be in git?

@zsinnema yes @afonsobspinto mentioned we need to have an updated dist folder


const node2 = new MetaNode('2', 'node2', 'default', new Position(500, 100),
new Map(Object.entries({color: 'rgb(255,192,0)'})))
const node2 = new MetaNode('2', 'Node 2', 'default', new Position(500, 100),
Copy link
Contributor

Choose a reason for hiding this comment

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

@afonsobspinto @vidhya-metacell I suggest to add variant to the interface as a parameter (like position) instead of using options. This gives a better usability and clearer programmatic interface. I suggest that we do that for all parameters that we "currently" know.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@afonsobspinto could you please add this to the node model.

@afonsobspinto
Copy link
Member

While applying some changes requested by @vidhya-metacell I noticed the following bug was happening in this branch:
#21

It's not clear to me why it's happening like that in the example application, but I was told it's not happening on psyneulink

# Conflicts:
#	dist/meta-diagram.cjs.development.js.map
#	dist/meta-diagram.cjs.production.min.js
#	dist/meta-diagram.cjs.production.min.js.map
#	dist/meta-diagram.esm.js.map
@afonsobspinto afonsobspinto requested a review from zsinnema August 1, 2022 10:36
Copy link
Contributor

@zsinnema zsinnema left a comment

Choose a reason for hiding this comment

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

@afonsobspinto in all files I'm missing the setter and getter for the new attribute 'variant'

also did you on purpose use == instead of ===

@afonsobspinto
Copy link
Member

Since the getters and setters are non essential in the context of the current issue + considering the fact that I'm doing some model changes that drops the use of MetaOptions I purpose we handle this new request in a different issue @zsinnema .

I did not put much thought in it. When using undefined I like to leave it flexible to also accept nulls but I'm ok with make it rigid. Just pushed a commit doing that.

@afonsobspinto afonsobspinto requested a review from zsinnema August 1, 2022 12:47
@zsinnema
Copy link
Contributor

zsinnema commented Aug 1, 2022

Since the getters and setters are non essential in the context of the current issue + considering the fact that I'm doing some model changes that drops the use of MetaOptions I purpose we handle this new request in a different issue @zsinnema .

Agree, see #22

@zsinnema zsinnema merged commit 60ee7bb into develop Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants