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

Music Play View - part 2 #58293

Merged
merged 24 commits into from
May 1, 2024
Merged

Music Play View - part 2 #58293

merged 24 commits into from
May 1, 2024

Conversation

fisher-alice
Copy link
Contributor

@fisher-alice fisher-alice commented Apr 26, 2024

This PR updates the Music Lab play view and follows up #58068.

Note that the adhoc based on this branch is available at https://adhoc-alice-play-view-updates-studio.cdn-code.org/home.
Example project in play view.

Updates in this PR include:

  • Adds MusicPlayView to MusicLabView so that when isShareView is set to true, the play view is rendered.
  • In MusicView, when isPlayView is set to true, a headless musicBlocklyWorkspace is initialized, i.e., the UI of the blockly workspace is not rendered. Thanks to @sanchitmalhotra126 for pairing with me on this! I based this part of the PR on Sanchit's WIP branch.
  • Adds functionality to the play/stop slider and shows progress as song plays.
  • Adds functionality to the 'View code' button (view/edit mode) and Make my Own' button (remix).
  • Adds redirectToView to projectsApi.
  • Adds the music play image from product.
  • Updated styling of play view based on product/design preferences.

The 'Share' button in play view is displayed on most mobile devices. But you can view this button if you add the query param '?canShare=true' to the end of the project play view url, e.g., https://adhoc-alice-play-view-updates-studio.cdn-code.org/projects/music/lpef7b3VcqvntTmBLG2c1w?canShare=true

After Update

Play view card on desk top:
Screenshot 2024-04-30 at 6 00 23 PM

Play view full screen on desk top:
Screenshot 2024-04-30 at 6 00 18 PM

Play view on mobile:
Screenshot 2024-04-30 at 6 02 24 PM

Screencast video of play view on desktop:

demo-design.mp4

Links

Testing story

Deployment strategy

Follow-up work

Follow-up will be to refactor the slider and include adding color to progress.

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

Copy link
Collaborator

@levadadenys levadadenys left a comment

Choose a reason for hiding this comment

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

LGTM overall! 😍
Couple non blocking comments.
Not approving only because PR is in Draft state


input[type='range'] {
overflow: hidden;
width: 100%;
height: 4px;
accent-color: $light_gray_200;
accent-color: yellow;
Copy link
Collaborator

Choose a reason for hiding this comment

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

please note: worth checking how it looks like in different browsers, since this won't affect all of the browsers. (when using $light_gray_200 it's just not that visible so to say, but still there's a difference between different browsers)

https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/

https://www.cssportal.com/style-input-range/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks so much! I've been noticing the differences so I appreciate the resources.

Copy link
Collaborator

Choose a reason for hiding this comment

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

 sorry, I've duplicated the links in the initial comment. Updated it. added https://www.cssportal.com/style-input-range/ which allows to generate cross-browser styles for input type range more easily

apps/src/music/views/MusicPlayView.tsx Outdated Show resolved Hide resolved
return nil unless @level.uses_lab2?

# If the user is on the play view '/projects/channel_id', set `response_content`.`
if params[:share] == true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is okay to do this for lab2 labs or should I only do for music lab projects for now? @sanchitmalhotra126

gap: 0.5rem;
gap: 1rem;

input[type=range] {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reference: https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/
Style range inputs so that styling is consistent across Firefox, Edge, Safari, and Chrome.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool stuff!

Copy link
Contributor

Choose a reason for hiding this comment

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

Slick, need this for AI Chat too!

return nil unless @level.uses_lab2?

# If the user is on the play view '/projects/channel_id', set `response_content`.`
if params[:share] == true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is checked in application.html.haml here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we should technically use the sharing value computed on line 374 so that we're consistent with what we pass into level_view_options. It shouldn't matter for now since we don't do anything special for embedded projects in lab2 currently, but just to be safe? Curious if @breville has thoughts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah - I was wondering about this earlier. Thanks! Will wait on Brendan to weigh in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline - I'll go ahead and update to use sharing.

@fisher-alice fisher-alice marked this pull request as ready for review April 30, 2024 23:06
@fisher-alice fisher-alice requested review from a team and sanchitmalhotra126 April 30, 2024 23:07
Copy link
Contributor

@sanchitmalhotra126 sanchitmalhotra126 left a comment

Choose a reason for hiding this comment

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

Looks pretty good overall! A few comments/questions

apps/src/lab2/views/Lab2Wrapper.module.scss Outdated Show resolved Hide resolved
apps/src/mixins.scss Outdated Show resolved Hide resolved
apps/src/music/views/MusicPlayView.tsx Outdated Show resolved Hide resolved
apps/src/music/views/MusicPlayView.tsx Outdated Show resolved Hide resolved
apps/src/music/views/MusicPlayView.tsx Outdated Show resolved Hide resolved
apps/src/music/views/MusicPlayView.tsx Outdated Show resolved Hide resolved
apps/src/music/views/MusicPlayView.tsx Outdated Show resolved Hide resolved
gap: 0.5rem;
gap: 1rem;

input[type=range] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool stuff!

return nil unless @level.uses_lab2?

# If the user is on the play view '/projects/channel_id', set `response_content`.`
if params[:share] == true
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we should technically use the sharing value computed on line 374 so that we're consistent with what we pass into level_view_options. It shouldn't matter for now since we don't do anything special for embedded projects in lab2 currently, but just to be safe? Curious if @breville has thoughts

Copy link
Contributor

@sanchitmalhotra126 sanchitmalhotra126 left a comment

Choose a reason for hiding this comment

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

A few minor things but LGTM! Nice work!

apps/src/lab2/views/Lab2Wrapper.tsx Outdated Show resolved Hide resolved
apps/src/mixins.scss Outdated Show resolved Hide resolved
apps/src/music/views/MusicPlayView.tsx Outdated Show resolved Hide resolved
apps/src/music/views/MusicPlayView.tsx Outdated Show resolved Hide resolved
@fisher-alice fisher-alice merged commit a50c045 into staging May 1, 2024
2 checks passed
@fisher-alice fisher-alice deleted the alice/play-view-updates branch May 1, 2024 23:26
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.

None yet

4 participants