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: move template selection into modal UI #201

Merged

Conversation

boyney123
Copy link
Contributor

@boyney123 boyney123 commented Dec 6, 2021

Description

Related to issue #198

Moved the template selection into a modal now rather than it's own page.

To make this work I had some make some minor changes:

Changes

  • Changes to the UI to fit inside modal
  • Allow modal to accept custom classes so I could make it wider by default (lots to render on this page, max-w-2xl was not big enough, looked weird).
  • Removed a bug where two templates were getting rendered at the same time (currently in production)

UI: When user does not select anything

image

UI: When user selects something

image

Selecting a template then clicking "Create" will do as expected and render the new AsyncAPI file into the studio.

Let me know what you think @smoya , @magicmatatjahu @mcturco , hopefully this fixes the problem.

@netlify
Copy link

netlify bot commented Dec 6, 2021

✔️ Deploy Preview for modest-rosalind-098b67 ready!

🔨 Explore the source changes: 14273f1

🔍 Inspect the deploy log: https://app.netlify.com/sites/modest-rosalind-098b67/deploys/61fa9bafdd9a6b0007e98abb

😎 Browse the preview: https://deploy-preview-201--modest-rosalind-098b67.netlify.app/

@smoya
Copy link
Member

smoya commented Dec 6, 2021

Love it! Question: could we do a solid line instead of dash-style for the selected template so it becomes more visible (only for the selected template)?
Not sure if makes sense but for me it helps visualizing what I did select.

Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

First of all, awesome! Thanks for fast contribution! But I have two problems:

  • we shouldn't make active nav item in the navigation, when someone click on that nav item. It doesn't look good for me. We should only open modal.
  • we shouldn't indicates that we "create" new file by templates, but use template, atm we don't create new file but reuse templates, so please change all occurences of "creating file" to the "use" or "reuse" - I made suggestion for that :)

And also please propagate suggestion from @smoya

src/components/Modals/NewFileModal.tsx Outdated Show resolved Hide resolved
src/components/Modals/NewFileModal.tsx Outdated Show resolved Hide resolved
src/components/Modals/NewFileModal.tsx Outdated Show resolved Hide resolved
@mcturco
Copy link
Member

mcturco commented Dec 6, 2021

could we do a solid line instead of dash-style for the selected template

to add to this suggestion by @smoya, I would also prefer that the inactive template card have a solid line as well. The light gray alone will be enough for the user to know that it is inactive. :)

@boyney123
Copy link
Contributor Author

Thanks @smoya , @mcturco @magicmatatjahu

to add to this suggestion by @smoya, I would also prefer that the inactive template card have a solid line as well. The light gray alone will be enough for the user to know that it is inactive. :)

Thanks @smoya and @mcturco , good ideas. That has been changed.


we shouldn't make active nav item in the navigation, when someone click on that nav item. It doesn't look good for me. We should only open modal.

Thanks @magicmatatjahu , think I have fixed that returning false from Sidebar.tsx (is that alright?)

 {
      name: 'newFile',
      state: () => false,
      icon: <VscNewFile className="w-5 h-5" />,
    },

we shouldn't indicates that we "create" new file by templates, but use template, atm we don't create new file but reuse templates, so please change all occurences of "creating file" to the "use" or "reuse" - I made suggestion for that :)

Yeah good point mate. Changes made.


Let me know if you have any more thoughts folks 👍

@mcturco
Copy link
Member

mcturco commented Dec 13, 2021

Hey @boyney123! I am still seeing the dashed lines on the inactive templates. The solid border on the selected template looks great!! 😄 I was thinking that it would look more uniform if we kept the borders solid for all of them, but if we don't think that looks good we don't have to do that!!

@mcturco
Copy link
Member

mcturco commented Dec 13, 2021

Oh! Also I just noticed that the "beta" label is now black in the upper left where the logo is.

Screen Shot 2021-12-13 at 9 54 03 AM

Not sure if that was intentional, but just wanted to point it out either way. 😄

@magicmatatjahu
Copy link
Member

@mcturco Yeah, Fran created issue for that 😄 #209

@magicmatatjahu
Copy link
Member

@boyney123

Thanks @magicmatatjahu , think I have fixed that returning false from Sidebar.tsx (is that alright?)

Yeah, it should works :)

@boyney123
Copy link
Contributor Author

I am still seeing the dashed lines on the inactive templates

Sorry @mcturco I forgot to push up my changes 😅 , try again 🤞 🙏

magicmatatjahu
magicmatatjahu previously approved these changes Dec 16, 2021
Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

LGTM!

@magicmatatjahu
Copy link
Member

@boyney123 You should rebase your PR with master branch to resolve merge conflicts (package-lock.json) :)

@smoya
Copy link
Member

smoya commented Dec 16, 2021

@boyney123 You should rebase your PR with master branch to resolve merge conflicts (package-lock.json) :)

This is due to npm version mismatch. Just checkout package-lock.json from source (meaning should be exact same content).

More about this: asyncapi/parser-js#427

@mcturco
Copy link
Member

mcturco commented Dec 16, 2021

Awesome @boyney123!! Looks great 🎉

@sonarcloud
Copy link

sonarcloud bot commented Dec 17, 2021

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
38.9% 38.9% Duplication

@boyney123
Copy link
Contributor Author

Thanks folks.

Thanks @smoya , yeah I have no idea what is going on with the lock file, as nothing has changed, I just reused the file from the master branch as suggested.

@magicmatatjahu
Copy link
Member

magicmatatjahu commented Dec 17, 2021

@boyney123 I bumped npm to v8 and from v7 there is a new version and structure of package-lock (you probably use npm v6), Sergio created issue for that asyncapi/parser-js#427 Please also fix the duplication of code - https://sonarcloud.io/component_measures?id=asyncapi_studio&metric=new_duplicated_lines_density&pullRequest=201&selected=asyncapi_studio%3Asrc%2Fcomponents%2FModals%2FNewFileModal.tsx&view=list - and I will accept :)

@boyney123
Copy link
Contributor Author

Fixed duplication thanks for the review @magicmatatjahu and @BOLT04

Think it's ready for review again.

I bumped npm to v8 and from v7 there is a new version and structure of package-lock (you probably use npm v6)

Also another node.... I upgraded to npm 8.3.2 which makes the lock file better, but it has added "dev": true to some packages, is this expected? Any idea @magicmatatjahu ?

@magicmatatjahu
Copy link
Member

@boyney123 That label is added to packages installed from devDependencies list :)

https://stackoverflow.com/questions/49809490/what-is-dev-true-in-package-lock-json-for

Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

Awesome!

I found two bugs:

  • when I don't have selected template I can click Use Template and it replaces my current AsyncAPI spec with empty content, you can test it :) We should disable the Use Template button when user doesn't select template.
  • another is described in the separate comment.

Just these two things for me aren't acceptable, rest is ok :)

src/components/Modals/NewFileModal.tsx Outdated Show resolved Hide resolved
{viewType === 'visualiser' && <VisualiserTemplate />}
</SplitPane>
}
{newFileEnabled && <NewFileModal />}
Copy link
Member

@magicmatatjahu magicmatatjahu Jan 26, 2022

Choose a reason for hiding this comment

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

All our modals has that nice enter animation (like settings on the bottom left corner) but templates hasn't and here is a problem. You always destroy and create new React node when user will open that model. I think that we should fix that by:

Suggested change
{newFileEnabled && <NewFileModal />}
<NewFileModal />

but we have to "watch" for change newFileEnabled in the NewFileModal component and change show prop to the show={newFileEnabled}.

@sonarcloud
Copy link

sonarcloud bot commented Feb 2, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@magicmatatjahu
Copy link
Member

@boyney123 I applied my suggestions :) Could you check if you accept it and we can merge it :)

@boyney123
Copy link
Contributor Author

Thank you @magicmatatjahu yeah looks OK to me, just checked your changes and happy with them.

I can't approve the PR as I'm the author so guess this comment is the approval 🤣👍

Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

LGTM! 😆

@magicmatatjahu
Copy link
Member

@mcturco Do you accept current solution?

@mcturco
Copy link
Member

mcturco commented Feb 2, 2022

@magicmatatjahu yes, I actually just tested it and was about to write a comment that it looks good to me!! 🎉

@magicmatatjahu
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit ff1222c into asyncapi:master Feb 2, 2022
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants