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: show project preview #43967

Merged

Conversation

ojeytonwilliams
Copy link
Contributor

Shows a modal which previews the solution to the final step of a practice project.

Not all practice projects have solutions, yet, and so the modal doesn't appear for registration-form. Once they all do we should lock that down with a test.

@ahmadabdolsaheb if you've got a chance, could you look at smartening up the Modal? It... works, but it's not pretty.

@raisedadead since this is an upcoming feature, I disabled the tests with SHOW_UPCOMING_CHANGES so we can run them locally when we want and then in CI when we're ready. Does that seem reasonable?

@gitpod-io
Copy link

gitpod-io bot commented Oct 22, 2021

@github-actions github-actions bot added platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: i18n language translation/internationalization. Often combined with language type label scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. labels Oct 22, 2021
@ghost
Copy link

ghost commented Oct 22, 2021

👀 Review this PR in a CodeSee Review Map

Preview the Review Map

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@ahmaxed
Copy link
Member

ahmaxed commented Oct 25, 2021

So there are a couple of challenges with displaying the projects inside a modal.

  1. projects have different ratios. if we decide to show the whole finished project, the size of the modals will vary.
  2. we need to add the logic for that flash animation after the preview modal has been closed to the users can see.

@raisedadead
Copy link
Member

Does that seem reasonable?

Yes - absolutely.

@ojeytonwilliams
Copy link
Contributor Author

  1. projects have different ratios. if we decide to show the whole finished project, the size of the modals will vary.

Aren't they all responsive? They have to be shown in the preview pane and that's something that the user controls.

  1. we need to add the logic for that flash animation after the preview modal has been closed to the users can see.

Do you mean the 'Noticable Editor' animation? Yep, I'll track that in the issue.

@moT01
Copy link
Member

moT01 commented Nov 18, 2021

I rebased this, fixed the conflicts, and made the modal bigger - I hope you don't mind @ojeytonwilliams. I'm not sure if we want to try and get it in like this or add that animation @ahmadabdolsaheb mentioned to focus users attention. Is there any part of that done? Mocks or anything? I could try and come up with something if needed. I vote to do it on another PR, but either way works.

@ojeytonwilliams
Copy link
Contributor Author

Not at all, thanks Tom. I vote for handling those other features in another PR, too.

@ojeytonwilliams ojeytonwilliams marked this pull request as ready for review November 18, 2021 20:37
@ojeytonwilliams ojeytonwilliams requested a review from a team as a code owner November 18, 2021 20:37
@moT01 moT01 closed this Nov 18, 2021
@moT01 moT01 reopened this Nov 18, 2021
@ahmaxed
Copy link
Member

ahmaxed commented Nov 19, 2021

@moT01, nice touch with adjusting the height. I is very likely that users will initially develop the projects with the preview in a horizontal frame. On the other hand, I think we should keep the width to the standard modal with that we use elsewhere; otherwise the buttons are going to get stretched too much.

Here is a preview:

Screen Shot 2021-11-19 at 4 58 35 PM

Notice the white line on the bottom of the preview:

Here is Tom's downtown :)
Notice the lines to the left and bottom of the preview.

Screen Shot 2021-11-19 at 4 58 04 PM

One of the lines is associated with the margin we set in builders
<body id='display-body'style='margin:8px;'>

I have not figured out the bottom one :)

Finally, a loader might be a nice touch. But that could wait.

@ahmaxed
Copy link
Member

ahmaxed commented Nov 19, 2021

what do you think of a no padding modal for the preview?

Screen Shot 2021-11-19 at 5 08 56 PM

@moT01
Copy link
Member

moT01 commented Nov 19, 2021

I'll look into those margins.

I is very likely that users will initially develop the projects with the preview in a horizontal frame

I'm not sure what you mean by this.

what do you think of a no padding modal for the preview?

I'm in favor of that - I'll see what it looks like on a project with scroll bars.

I think we should keep the width to the standard modal with that we use elsewhere

I'm not against this - but we're trying to display a whole web page, some extra room might be nice.

@moT01
Copy link
Member

moT01 commented Nov 20, 2021

I did some things to fix up @ahmadabdolsaheb's suggestions. One of the issues was due to an 8px margin we add to all the previews. I added a second template, specific for the demo previews, that doesn't include the margin (see my last commit). I think we could use a little discussion on it.

Some options:

  1. Do what I added here - use the template with the 8px margin when viewing the preview of the editor code (challenges), and the template without the margin for the demo preview (modal)
  2. Use the template without the margin for everything
  3. Use the template with the margin for everything

Some pros and cons:

Option 1:
👍 The editor preview behaves more like a real browser - which, I'm guessing, is why it was added in the first place?
👍 Doesn't affect existing curriculum/practice projects
👍 Demo modal looks good
👎 Uses two different templates. A web page will likely look different when in the editor vs the demo. I assume we will have a modal like this on the cert page to display user's cert solutions, as well - something to keep in mind

Option 2:
👍 Consistent across the different previews
👍 Demo modal looks good
👎 It made a number of the practice projects and existing lessons look a little worse, since some text and other things hug the side of the preview
👎 Potentially breaks tests or instructions from making sense? It probably wouldn't be many if it does.

Option 3:
👍 Consistent across the different previews
👍 Doesn't affect existing curriculum/practice projects
👍 The editor preview behaves more like a real browser
👎 The demo modal looks rough

I would appreciate your thoughts on this @nhcarrigan & @ShaunSHamilton

Side note - I believe these projects are missing solutions on the last step so the modal doesn't show up:
Ferris wheel
Grid Magazine
Photo Gallery
Registration Form
Nutrition Label

Probably something for another PR.

@gikf gikf added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Nov 20, 2021
@naomi-lgbt
Copy link
Member

I assume we will have a modal like this on the cert page to display user's cert solutions, as well - something to keep in mind

Honestly, if we could rig it up so that their project opens in a new tab I think that would be ideal.

Side note - I believe these projects are missing solutions on the last step so the modal doesn't show up:

I will open a PR to fix this today. 🙂

I think going with option 1 is the best - two templates is not ideal, but if it produces the best end result then 🤷🏻

@ShaunSHamilton
Copy link
Member

As for the margin, I believe this falls under the same discussion about whether we keep using normalize.css or not. I was largely for removing it, because it alters the page such that it could look different on a Camper's local development, and we have at least two practice projects going over the common use of:

* {
  margin: 0;
  padding: 0;
}

Which normalize.css defeats the purpose of.

My Current Thinking

  • Remove anything that makes the layout look different to a Camper developing locally. If this includes the 8px margin, then so be it.

I believe these projects are missing solutions on the last step so the modal doesn't show up:

I will open a PR to fix this today. 🙂

@nhcarrigan There is a PR, we should handle first: #43971 - same idea

@ojeytonwilliams
Copy link
Contributor Author

I was largely for removing it, because it alters the page such that it could look different on a Camper's local development

If challenges/projects look slightly different on different browsers, that's fine, I think. We want it to feel as real as possible.

Remove anything that makes the layout look different to a Camper developing locally. If this includes the 8px margin, then so be it.

That's my thinking, too. That's what I did in #42195

Copy link
Contributor Author

@ojeytonwilliams ojeytonwilliams left a comment

Choose a reason for hiding this comment

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

I can't review my own PRs, but I'm happy with Tom's changes.

@naomi-lgbt
Copy link
Member

naomi-lgbt commented Nov 24, 2021

I'm still seeing the margins on the preview.

Nevermind - helps if I do a git pull. 🤦🏻

naomi-lgbt
naomi-lgbt previously approved these changes Nov 24, 2021
Copy link
Member

@naomi-lgbt naomi-lgbt left a comment

Choose a reason for hiding this comment

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

This looks good to me.

Copy link
Member

@ShaunSHamilton ShaunSHamilton left a comment

Choose a reason for hiding this comment

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

I cannot say I fully followed the framer.js logic, but this appears to be working.

Otherwise, I worry about my personal confusion between the preview and the practice project preview - might be something I get over.

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
Copy link
Member

@ShaunSHamilton ShaunSHamilton left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ahmaxed
Copy link
Member

ahmaxed commented Nov 29, 2021

This is LGMT if we are fine with removing the style='margin:8px;'>

Copy link
Member

@naomi-lgbt naomi-lgbt left a comment

Choose a reason for hiding this comment

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

I'm happy with this.

@ShaunSHamilton ShaunSHamilton merged commit bb7893d into freeCodeCamp:main Nov 29, 2021
@ojeytonwilliams ojeytonwilliams deleted the feat/show-project-preview branch November 29, 2021 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: i18n language translation/internationalization. Often combined with language type label scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants