-
Notifications
You must be signed in to change notification settings - Fork 286
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
save map dropdown #1357
save map dropdown #1357
Conversation
@jywarren here's the dropdown button for the saveMaps |
<button id="downloadJSON" type="button" class="btn btn-sm dropdown-item" aria-label="Save map" > | ||
Download Map | ||
</button></li> | ||
<li title="Save map in browser in JSON format"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we added one more option, which uses alert() to provide a bit more text about the limitations and uses of each option? What might we say to let people understand the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that sounds reasonable, something like an info icon?
I believe we could give a write-up like:
Saving your map in the browser means you can continue knitting when you return to mapknitter.org
I believe the share modal provides succinct info on what the downloaded JSON file could be used for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great but instead of mapknitter.org, let's say "this page in your current browser" to really get specific about what's required to recover the state. Sound good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
Maybe we'd worry about recovering the state in another PR, but what would that flow be like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, one option could be to have this save in localstorage button open the history modal, and do it all in one PR, or do the history modal first, so there's something to open when we implement this button? That modal could have space to better explain things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it sounds strange that the second item in the Save button would then open the History modal, when there's another button for that. But consider this flow:
I think it makes sense to have the two forms of saving be together. But I also think that having the Saved Maps modal be the place where you can save or recover "in browser" maps makes sense. I can see how it's a little strange that Download
immediately does something while Save in browser
takes you somewhere else. But it also links saving and recovering together nicely.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not a bad idea, a tad confusing at the first glance but not bad.
I'll begin work on it, should it be done in this PR or another?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's OK to do here, if you like? After all, it also makes sense that we should introduce the ability to recover a map before we introduce the ability to save one, otherwise people may save maps but not be able to recover them, you know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you think of an improved way to do it, I'm happy to discuss! Thanks Malik!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's OK to do here, if you like? After all, it also makes sense that we should introduce the ability to recover a map before we introduce the ability to save one, otherwise people may save maps but not be able to recover them, you know?
Yea I totally agree
I'll get it on here
If you think of an improved way to do it, I'm happy to discuss! Thanks Malik!
Definitely
Thank you @jywarren
Hello @jywarren I'm moving to the aspect where the user clicks on recover to load the saved map I may need to extract the function to accomplish this What are your thoughts? |
Wow it looks great!! Which function are you referring to? Sorry, I don't
quite follow.
…On Fri, Feb 17, 2023, 12:28 PM Malik ***@***.***> wrote:
Hello @jywarren <https://github.com/jywarren>
This is coming out quite nicely, here's a GIF:
[image: saveMapModal]
<https://user-images.githubusercontent.com/75104021/219722382-7924e9be-5504-43d8-a78a-8c369c272592.gif>
I'm moving to the aspect where the user clicks on recover to load the
saved map
I stored each SavedMap's index as a dataset in the recover button, I
intend to use this to filter out the particular map to load.
I may need to extract the function to accomplish this
What are your thoughts?
—
Reply to this email directly, view it on GitHub
<#1357 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAF6J3WDL7YDTTDGTPZZM3WX6YLTANCNFSM6AAAAAAU5C3VHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I was referring to the I was thinking I'd need to extract just a piece of it, but for reusability I could refactor it, to accept an |
Ah I see. Yes I think making it a more general purpose function that accepts an object makes sense! |
Hello @jywarren What do you think? |
It looks great! Is this ready for review and merge then? Thanks!
…On Mon, Feb 20, 2023, 5:31 AM Malik ***@***.***> wrote:
Hello @jywarren <https://github.com/jywarren>
Here's the final look of the modal:
[image: recoverMap]
<https://user-images.githubusercontent.com/75104021/220080558-4d30a65f-8ecd-4d5c-854d-06c3959c985b.gif>
What do you think?
—
Reply to this email directly, view it on GitHub
<#1357 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAF6JZRMAAWGNJSM2ZSJJDWYNBYLANCNFSM6AAAAAAU5C3VHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@jywarren Yes it is ready for review and merge, Thank you! |
examples/js/archive.js
Outdated
const reconstructMapFromJson = async (jsonDownloadURL = false, savedMapObj) => { | ||
if (jsonDownloadURL) { | ||
const imageCollectionObj = await map.imgGroup.recreateImagesFromJsonUrl(jsonDownloadURL); | ||
console.log(imageCollectionObj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I see a log here, mind removing it? Thanks!
// share map modal | ||
const shareModal = document.getElementById('shareModal') | ||
const modality = new bootstrap.Modal(shareModal) | ||
shareMapBtn.addEventListener('click', () => { | ||
bootstrap.Modal.getInstance(shareModal).show() | ||
}); | ||
|
||
// history map modal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some complex but relatively self contained code which would be great to move into a module in a later PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thoughts exactly @jywarren
@jywarren I've removed all logs |
Great job!! |
grunt test
UI Changes