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: added touch/slide on prematch option buttons (#1529) #2517

Merged
merged 6 commits into from
Oct 25, 2023

Conversation

Mandolinx
Copy link
Contributor

@Mandolinx Mandolinx commented Oct 22, 2023

This fixes issue: #1529

  • created a function called buttonSlide in button.ts for pre-match button game options to touch and slide
  • created a new html class in index.ejs called "dragIt"
  • made all radio labels have class "dragIt"
  • added the buttonSlide function to script.ts

clicking on a pre-match button game option and dragging to the next button will click that next button and reset original button.

@vercel
Copy link

vercel bot commented Oct 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
ancientbeast ✅ Ready (Inspect) Visit Preview Oct 24, 2023 5:02pm

@ghost
Copy link

ghost commented Oct 22, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

Copy link
Member

@DreadKnight DreadKnight left a comment

Choose a reason for hiding this comment

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

Heya! Some things that should probably be poked.

src/index.ejs Outdated
@@ -74,91 +74,121 @@
<h2>Player Mode&nbsp;<span id="playerModeType"></span></h2>
<div id="playerMode" class="typeRadio">
<input type="radio" id="p2" name="playerMode" value="2" checked>
<label for="p2">1 versus 1</label>
<label for ="p2" class="draggable-label">1 versus 1</label>
Copy link
Member

Choose a reason for hiding this comment

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

Space, the final frontier.

src/index.ejs Outdated
<input type="radio" id="p4" name="playerMode" value="4">
<label for="p4">2 versus 2</label>
<label for="p4" class="draggable-label">2 versus 2</label>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe class name should be way shorter, like "dragit" or so.

src/index.ejs Outdated
</div>
</div>
<!--Script to add sliding to prematch option buttons-->
<script>
Copy link
Member

Choose a reason for hiding this comment

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

Best to make index file smaller (as we even plan to split it into files). Would be best if script was separate file in src/ui and be imported using webpack or whatever.

src/index.ejs Outdated
selectedRadio = radio.previousElementSibling;
});

// check new dragged radio/button
Copy link
Member

Choose a reason for hiding this comment

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

Comment style consistency: capitalized first letter, // Check...

@DreadKnight
Copy link
Member

DreadKnight commented Oct 22, 2023

@Mandolinx I've tested this and works well, however, I've opened a review regarding the coding itself to polish things.

@DreadKnight DreadKnight marked this pull request as draft October 22, 2023 14:00
@Mandolinx
Copy link
Contributor Author

Mandolinx commented Oct 24, 2023

Hi @DreadKnight I've just updated my code such that the script is now in a separate file in UI called "slider.js", and fixed various syntax and style issues. During my process, I was not familiar with webpack so I'm not entirely sure if my method of importing is suitable for this issue so that may be an area of focus in the review. Also, my script file that does the slide is in a separate file but it only contains a function, so I was wondering whether it'd be better to just add the function directly to script.ts or add the function to Button.ts. Thanks!

p.s. interface.js is said to be changed but all I did was copy and paced the interface file from repo because git pull was not working.

@Mandolinx Mandolinx marked this pull request as ready for review October 24, 2023 07:38
@DreadKnight
Copy link
Member

Hi @DreadKnight I've just updated my code such that the script is now in a separate file in UI called "slider.js", and fixed various syntax and style issues. During my process, I was not familiar with webpack so I'm not entirely sure if my method of importing is suitable for this issue so that may be an area of focus in the review. Also, my script file that does the slide is in a separate file but it only contains a function, so I was wondering whether it'd be better to just add the function directly to script.ts or add the function to Button.ts. Thanks!

p.s. interface.js is said to be changed but all I did was copy and paced the interface file from repo because git pull was not working.

Moving the stuff in script.ts it doesn't make sense imo, because that's an initial set-up thingy, but it might make sense in button.ts if the file is about the pre-match screen buttons (wish it had some description), so feel free to move if so and also remove "Used for prematch button game options to slide" comment line if moving it there.

Regarding interface.js, you usually don't need to pull master to latest when it comes to PRs; you haven't touched that file in your commits and the copy-pasting that you did actually reverts a patch of mine that I might have missed. Just exclude your changes by reverting file to what it was ideally.

@Mandolinx
Copy link
Contributor Author

Mandolinx commented Oct 24, 2023

Moving the stuff in script.ts it doesn't make sense imo, because that's an initial set-up thingy, but it might make sense in button.ts if the file is about the pre-match screen buttons (wish it had some description), so feel free to move if so and also remove "Used for prematch button game options to slide" comment line if moving it there.

Regarding interface.js, you usually don't need to pull master to latest when it comes to PRs; you haven't touched that file in your commits and the copy-pasting that you did actually reverts a patch of mine that I might have missed. Just exclude your changes by reverting file to what it was ideally.

@DreadKnight As requested, I reverted to my original version of interface and I put the buttonSlider into the button file. I also changed the function to use jquery since I was having problems earlier copy and pasting my old function into the file without it, but it has the same functionality so everything should be fine for that. Thanks!

@DreadKnight DreadKnight merged commit 0e6b305 into FreezingMoon:master Oct 25, 2023
1 check passed
@DreadKnight
Copy link
Member

Moving the stuff in script.ts it doesn't make sense imo, because that's an initial set-up thingy, but it might make sense in button.ts if the file is about the pre-match screen buttons (wish it had some description), so feel free to move if so and also remove "Used for prematch button game options to slide" comment line if moving it there.
Regarding interface.js, you usually don't need to pull master to latest when it comes to PRs; you haven't touched that file in your commits and the copy-pasting that you did actually reverts a patch of mine that I might have missed. Just exclude your changes by reverting file to what it was ideally.

@DreadKnight As requested, I reverted to my original version of interface and I put the buttonSlider into the button file. I also changed the function to use jquery since I was having problems earlier copy and pasting my old function into the file without it, but it has the same functionality so everything should be fine for that. Thanks!

@Mandolinx Thanks way better, good job! 👍🏻

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.

2 participants