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

[UI] add teacher preview mode #4822

Merged
merged 6 commits into from
Dec 18, 2023

Conversation

jtwaleson
Copy link
Collaborator

@jtwaleson jtwaleson commented Nov 29, 2023

Description

Adds a preview mode for teachers, so when they create a class they can view Hedy as if they were a student in this class.

Fixes #3374

This is a draft PR, please let me know if this is roughly the right direction. Once we confirm that I'll add:

  • some tests
  • make the banner "Preview Mode" look nicer
  • add translation keys

How to test

Step 1 - Go to For Teacher page. Make sure you have a class with some customizations, like less programs for level 1. Press the "Preview" button.

Screenshot from 2023-11-29 12-09-57

Step 2 - You should go to /hedy and see the loaded class including a banner "Preview mode".

Screenshot from 2023-12-18 13-45-47

The previous version of this design is here.

Step 3 - You can complete the programs and puzzles as if you were a student

Step 4 - When you exit preview mode the banner should disappear and you should go back to the /for-teachers page.

Checklist
Done? Check if you have it all in place using this list: (mark with x if done)

  • Contains one of the PR categories in the name
  • Describes changes in the format above
  • Links to an existing issue or discussion
  • Has a "How to test" section

{% if session.preview_class %}
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4" role="alert">
<p class="font-bold">Preview mode</p>
<p>You are previewing a class as a teacher. <a href="/for-teachers/clear-preview-class">Exit preview mode</a></p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we add the class name here? Just to know which class you're viewing without having to go to the customization and figure out which one!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes!

website/for_teachers.py Outdated Show resolved Hide resolved
website/database.py Outdated Show resolved Hide resolved
app.py Outdated Show resolved Hide resolved
@Felienne
Copy link
Member

Felienne commented Dec 9, 2023

Thanks @jtwaleson and sorry for being a bit late with the feedback, I was traveling last 2 weeks.

I love that we are making this work!! I think the preview looks great, the banner is clear and it is awesome that it is really working where you can see and try examples!

I was wondering though about the placement of the button to reach this feature. The overview page is fine, we can totally leave it there, but... I think the most natural workflow for teachers would be to want to review the class when they are customizing, and not when they are in the overview. Now if I want to preview after customization I have to click back twice, and if I ant to make a change based on the preview, I have to click again twice to reach the customization again.

So can we also add a preview button here?
image

@Felienne
Copy link
Member

Felienne commented Dec 9, 2023

Ow and I think #4870 might cause some conflicts but I can deal with these for you

@jtwaleson
Copy link
Collaborator Author

Thanks @jtwaleson and sorry for being a bit late with the feedback, I was traveling last 2 weeks.

I love that we are making this work!! I think the preview looks great, the banner is clear and it is awesome that it is really working where you can see and try examples!

I was wondering though about the placement of the button to reach this feature. The overview page is fine, we can totally leave it there, but... I think the most natural workflow for teachers would be to want to review the class when they are customizing, and not when they are in the overview. Now if I want to preview after customization I have to click back twice, and if I ant to make a change based on the preview, I have to click again twice to reach the customization again.

So can we also add a preview button here? image

Great, will do! I'll wrap up the new button and the tests this week.

@jtwaleson jtwaleson marked this pull request as ready for review December 17, 2023 16:45
@jtwaleson
Copy link
Collaborator Author

@hasan-sh @Felienne ready for review!

@Felienne
Copy link
Member

Hi @hasan-sh!

Can you review this in terms of the code? I am totally happy with the way it works, if you are ok too, we can ship this!

@jtwaleson the test that you added now break, can you take a look at this?

@jtwaleson
Copy link
Collaborator Author

jtwaleson commented Dec 18, 2023

@jtwaleson the test that you added now break, can you take a look at this?

Fixed! Note that I updated the design of the header in the code a couple weeks back, the screenshot above was not the latest version. I've now updated it in the description above. If you much prefer the old version let me know!

Copy link
Collaborator

@hasan-sh hasan-sh left a comment

Choose a reason for hiding this comment

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

Everything works great and as expected!

Copy link
Contributor

mergify bot commented Dec 18, 2023

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit f6457d8 into hedyorg:main Dec 18, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

[UI] "preview as student" option for teachers
3 participants