rmkane / gbgwcalculator.github.io

A calculator for Gunpla Battle Gunpla Warfare builds →
https://rmkane.github.io/pages/gbgwcalculator
Mozilla Public License 2.0
5 stars 5 forks source link

Share Gupnla by link #35

Open anthonychwong opened 4 years ago

anthonychwong commented 4 years ago

Other players usually share their Gunpla as a screen capture, which consume mobile data, takes time to show, and is hard for other to change their Gunpla.

This PR adds ability to share selected Gunpla parts and gears by link, also allow others to modify with the link.

image

example link

NOTE: this PR comes with GitHub Action to deploy to GitHub pages, let me know if it is not suitable for you.

rmkane commented 4 years ago

Hmm, this git workflow thing looks nice.

Looks like you changed dest to 'dist/deploy', but when referenced, it will be expanded to:

dist/deploy/dist/js/bundle.min.js

What's with that? So the root is "dist/deploy" for the git workflow?

anthonychwong commented 4 years ago

Yes, the root is dist/deploy with index.html there. Using that path for bundle.min.js is because index.html seems load the script from there.

    <link rel="stylesheet" href="dist/css/bundle.min.css"/>
    <script src="dist/js/bundle.min.js" type="text/javascript"></script>

But I'm new to npm and grunt, maybe I was wrong about that.

rmkane commented 4 years ago

I created a self-contained commit for the share functionality here:

https://github.com/rmkane/gbgwcalculator.github.io/commit/16d038a44fbe251bfde45e50d57bdec3aab7f710

I noticed it does not account for marks. It's a great idea, but I haven't tried to pass IDs into the data set. It would be easier if each part had an ID in the data. I have that information, but it changes sometimes, so it's very volatile...

The Git workflow stuff is cool. Maybe I will mess around with it. I would probably build the link behind the scenes and add a share button to copy the link.

anthonychwong commented 4 years ago

I have that information, but it changes sometimes, so it's very volatile...

Maybe stick with name as ID, or hash the name would be easier for maintenance. How do you think about that?

I noticed it does not account for marks.

My first attempt to encode data into URL parameter resulting URL with 6xxxx characters which IE won't support, so I only encode the name and parts. I'm not sure if including marks would be okay.