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: highlight keys when they're played via keyboard #133

Closed

Conversation

SURAJ-SHARMA27
Copy link

Description

This PR adds functionality to highlight piano keys when they are played via the keyboard.

Added highlighting feature: Implemented key highlighting by passing a prop and using useEffect to apply styles directly to the specific key element.

fixes #51

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • 📦 Chore
  • ⏩ Revert

Related Tickets & Documents

Fixes #51

Mobile & Desktop Screenshots/Recordings

screen-capture.41.webm

Steps to QA

  1. Go to a room
  2. Play the piano using keyboard

Added to documentation?

  • 📜 README.md
  • 📜 CONTRIBUTING.md
  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

Copy link

netlify bot commented Sep 9, 2024

Deploy Preview for pianoparty ready!

Name Link
🔨 Latest commit f17ecf1
🔍 Latest deploy log https://app.netlify.com/sites/pianoparty/deploys/66df0c47be343300086e167f
😎 Deploy Preview https://deploy-preview-133--pianoparty.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 84 (🔴 down 16 from production)
Accessibility: 95 (no change from production)
Best Practices: 92 (🔴 down 8 from production)
SEO: 91 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Owner

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

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

@SURAJ-SHARMA27, I was doing some cleanup this morning and didn't realize you had a PR up. You'll need to update before making the change requests.

import { BlackPianoKey, WhitePianoKey, type Note } from "./PianoKeys";

interface PianoKeyboardProps {
playNote: (note: Note) => void;
}

const keyNoteMap: { [key: string]: Note } = {
Copy link
Owner

Choose a reason for hiding this comment

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

@SURAJ-SHARMA27, there already is a keynote map. See

<KeyboardMap
keyMap={keyboardMap}
onKeyPress={(event: KeyboardEvent) => {
const note = keyboardMap[event.key];
if (note) {
playNote(note);
}
}}
/>

This is where the change in styling should happen. Also, for the colours, use the tailwind classes, e.g. bg-gray-300 from hover:bg-gray-300.

className="text-sm flex flex-col border border-black rounded-sm bg-color-white active:scale-95 hover:bg-gray-300 w-10 md:w-12 h-32 md:h-56"

@nickytonline
Copy link
Owner

I'm going to go ahead and close this for now. If you'd like to keep working on it @SURAJ-SHARMA27, feel free to reopen the PR.

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.

feat: highlight keys when they're played via keyboard
2 participants