<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: JJB9922</title>
    <description>The latest articles on DEV Community by JJB9922 (@jjb9922).</description>
    <link>https://dev.to/jjb9922</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1208070%2Fbee6a9e3-1b9e-4a21-9036-dcf8d13cc9d6.jpeg</url>
      <title>DEV Community: JJB9922</title>
      <link>https://dev.to/jjb9922</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jjb9922"/>
    <language>en</language>
    <item>
      <title>Muay Thaideas: A Roundhouse Kickstart</title>
      <dc:creator>JJB9922</dc:creator>
      <pubDate>Mon, 20 Nov 2023 00:34:22 +0000</pubDate>
      <link>https://dev.to/jjb9922/muay-thaideas-a-roundhouse-kickstart-1c5a</link>
      <guid>https://dev.to/jjb9922/muay-thaideas-a-roundhouse-kickstart-1c5a</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/JJB9922/MuayThaideas/" rel="noopener noreferrer"&gt;https://github.com/JJB9922/MuayThaideas/&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction: No Thoughts, Head Empty
&lt;/h3&gt;

&lt;p&gt;No thoughts, head empty; the only reason I decided to put this app together in the first place. &lt;/p&gt;

&lt;p&gt;For those of you who also enjoy recreationally getting punched in the head, you may also have had the joy of standing in front of a punching bag throwing shots/combinations at random while your mind drifts to thinking about whether 2 bears could beat a gorilla in a fight... (They definitely couldn't)&lt;/p&gt;

&lt;p&gt;The point of Muay Thaideas is to min-max bag work by providing both structure and content to the training. Almost like having a virtual coach feeding you stuff to try out and practice (without the &lt;del&gt;benefit of&lt;/del&gt; verbal abuse in the mix).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Project
&lt;/h3&gt;

&lt;p&gt;The initial idea for the app was super simple, pretty much CRUD without the CUD - I'd leave that to feed the cows.&lt;/p&gt;

&lt;p&gt;A user could set up a workout by inputting their overall workout time, round time and rest time. The app would grab a combo from a pre-built array, display it, hide it for the rest period, then display a new one on the next round.&lt;/p&gt;

&lt;p&gt;However, while looking at the actual design, some new features creeped in that would be useful and justified.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Ability for user to add their own combinations,as well as sorting by beginner/advanced. This would open the app up to fighters at a range of skill levels, and could help those with injuries or disabilities be picky with their session.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ability to import/export a user database. If a team is using the app, or friends who are comfortable in a similar style, they could workout to the same plan. This might be especially powerful leading up to a fight - a fighter knows what gameplan they need to execute, so they can dial in and work those combinations whenever they get free time for bag work.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  A (Somewhat) Non-Technical Overview
&lt;/h3&gt;

&lt;p&gt;Building this app went without a hitch for the most part. Reaching MVP took about 4 evenings after my normal 9-5, Usually building from 6-8pm until ~1am.&lt;/p&gt;

&lt;p&gt;I started by &lt;a href="https://coolors.co/" rel="noopener noreferrer"&gt;generating a colour palette&lt;/a&gt;, designing the UI as and when necessary - since I was expecting the app to be so small, there were no wireframes involved. This was probably a step I shouldn't have skipped, as having stared at the app for 20+ hours now, the small inconsistencies and imperfections are sticking out like a sore thumb.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5urwv47zt2u8s6ek8a0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5urwv47zt2u8s6ek8a0.png" alt="Image description" width="800" height="34"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The main 4 pages in this app are the home screen, the combo list, the workout setup and the workout itself. Getting the combo list working was the first hurdle - having not used &lt;strong&gt;React Native&lt;/strong&gt; before and trying to integrate it with &lt;strong&gt;SQLite&lt;/strong&gt; was an interesting challenge. Was &lt;strong&gt;SQLite&lt;/strong&gt; the best choice? Potentially... However I like the idea of a "&lt;em&gt;combination marketplace&lt;/em&gt;", so perhaps something like &lt;strong&gt;MongoDB&lt;/strong&gt; could have been employed to leave room for an even better method of sharing combinations. &lt;/p&gt;

&lt;p&gt;As for the workout screen itself - I do see space for a video/gif player. There's a Muay Thai instructional by Jean-Charles Skarbowsky, and one really nice detail is that after he details a combination, he shows a clip of the exact combination being used effectively in a professional fight. This visual concept could highly empower the built-in combinations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Visuals
&lt;/h3&gt;

&lt;p&gt;These screenshots are taken from the app as of &lt;strong&gt;November 20th 2023&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ajcjkjpo5meexeujqiy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ajcjkjpo5meexeujqiy.png" width="501" height="1047"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5gwykqyc3v128q75a62f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5gwykqyc3v128q75a62f.png" width="501" height="1047"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdbokjydpne2gw4bkay8r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdbokjydpne2gw4bkay8r.png" width="501" height="1047"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwo787wtogebwq1d1r5se.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwo787wtogebwq1d1r5se.png" width="501" height="1047"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25b3bh5oqsc5rjc4tqh7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25b3bh5oqsc5rjc4tqh7.png" width="506" height="1047"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Technical Details
&lt;/h3&gt;

&lt;p&gt;Initially, I debated between Kotlin, Flutter and React Native. Having some experience with React from &lt;a href="https://fullstackopen.com/en/" rel="noopener noreferrer"&gt;an excellent course&lt;/a&gt;, as well as building an internal tool for my job in React, it seemed like a great idea to try React Native. This came quite naturally, as Native is very similar to React, with setting up a screen being as easy as wrapping some content in a &lt;code&gt;&amp;lt;View&amp;gt;&lt;/code&gt; component. Other components also baked into react native such as &lt;code&gt;&amp;lt;Text&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;TextInput&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;Button&amp;gt;&lt;/code&gt; make prototyping a breeze.&lt;/p&gt;

&lt;p&gt;The CSS-like styling is also simple to use, making UI design and testing easy enough.&lt;/p&gt;

&lt;p&gt;For building and deployment, Expo was a dream - fast reloads for previewing, the ability to flip between web and android via hardware or an emulator, and even handling building of APKs through EAS - perfect for this small project. Expo also has it's own set of well-documented packages available for use, making things like using Android's file system for a built in SQLite database easy.&lt;/p&gt;

&lt;h6&gt;
  
  
  Homepage
&lt;/h6&gt;

&lt;p&gt;Simple - two buttons and a navigation container dealt with by react-navigation.&lt;/p&gt;

&lt;h6&gt;
  
  
  Combo List
&lt;/h6&gt;

&lt;p&gt;The first portion of this was setting up the SQLite database. This is split into two parts: the user and built in databases. The user portion just generates a .db file, and contains all of the CRUD operations as separate functions. &lt;/p&gt;

&lt;p&gt;Different buttons are linked to these so you can create combinations, read and output them as a list, update their names and delete them. This is also where import/export is handled - which simply uses the expo filesystem to push out and pull in .db files, replacing whatever was there before.&lt;/p&gt;

&lt;p&gt;The built-in database is much simpler - it uses filesystem to download the built-in DB from the app's assets folder, then uses a basic SQL query to print them out.&lt;/p&gt;

&lt;h6&gt;
  
  
  Workout Setup
&lt;/h6&gt;

&lt;p&gt;This is where the user sets up their Workout - in case you hadn't guessed. This is simply a set of buttons, toggles and text boxes - each parameter set here is then pushed over to the Workout screen.&lt;/p&gt;

&lt;h6&gt;
  
  
  Workout
&lt;/h6&gt;

&lt;p&gt;Most of the logic goes on here. A couple of timers tick down, with the round timer being switched with the rest timer as it hits 0, and vice versa.&lt;/p&gt;

&lt;p&gt;The combination visual works by putting the selected database combinations into an array, then using a random number to select an index in the array.&lt;/p&gt;

&lt;p&gt;The rest is quite simple - a pause/play which will stop/start the timer ticks, a skip feature which allows the user to instantly set the current round/rest timer to 0, an extend rest function which allows the user to add 10 seconds to the current rest timer, and a cancel workout button which returns the user to the set up page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Future
&lt;/h3&gt;

&lt;p&gt;Aside from the additional features already mentioned, I don't think this app needs to be overcomplicated - it does exactly what I needed it to and I can't see it becoming obsolete anytime soon.&lt;/p&gt;

&lt;p&gt;However, the code is all open source - if anyone has ideas, I'll continue maintaining the repo, looking at PRs, etc.&lt;/p&gt;

&lt;p&gt;Depending on how large the user base grows, hypothetically, it would also be cool to have a hub for uploading combo databases. This could even separate by sport - boxing, karate, TKD - anything that involves drilling could make use of the system. If users were able to head somewhere and grab, say, a largely populated advanced boxing database, that would be very cool.&lt;/p&gt;

&lt;p&gt;Another interesting idea for me is logging - having the app log how many workouts you've done, display statistics, maybe even some sort of achievement / badge system. Gamifying anything always turns out to be a great motivator in my case, and I'm sure it wouldn't be a feature that goes unappreciated!&lt;/p&gt;

&lt;p&gt;All said, please feel free to poke around the codebase and make the app work for you however you'd like to :) The GitHub does have a few releases attached where you can download and run the APK on your own Android device!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/JJB9922/MuayThaideas/releases" rel="noopener noreferrer"&gt;https://github.com/JJB9922/MuayThaideas/releases&lt;/a&gt;&lt;br&gt;
Discord: LesGretsch&lt;/p&gt;

&lt;h3&gt;
  
  
  Acknowledgements
&lt;/h3&gt;

&lt;p&gt;Thanks to &lt;a class="mentioned-user" href="https://dev.to/menilek"&gt;@menilek&lt;/a&gt; for giving the push to attach a blog to this project :) Do follow if you're interested in blogs from an experienced full-stack engineer!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>learning</category>
      <category>android</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
