Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Store the mint fields in local storage #4

Closed
kylegrover opened this issue Feb 3, 2022 · 1 comment · Fixed by #24
Closed

Store the mint fields in local storage #4

kylegrover opened this issue Feb 3, 2022 · 1 comment · Fixed by #24
Assignees
Labels
enhancement New feature or request

Comments

@kylegrover
Copy link
Member

People regularly have issues with a mint failing, and then losing the description they typed out. Two steps to fix this:

  1. Set proper name on mint form elements. Currently they display name=input-name-not-set
  2. Save form input in localStorage? Here's an untested snippet I've adapted from other work that could be applied once step 1 is taken.
var form_els = document.querySelectorAll('input, textarea');

if (localStorage.getItem('mint_'+form_els[0].name) != null) {
    for (var i = 0; i < form_els.length; i++) {
        var el = form_els[i];
        el.value = localStorage.getItem('mint_'+el.name);
    }
}
function saveForm() {
    for (var i = 0; i < form_els.length; i++) {
        var el = form_els[i];
        localStorage.setItem('mint_'+el.name, el.value);
    }
}
setInterval(saveForm, 5000);
function clearForm(){
    for (var i = 0; i < form_els.length; i++) {
        var el = form_els[i];
        localStorage.setItem('mint_'+el.name, '');
        el.value = '';
    }
}
xat pushed a commit that referenced this issue Feb 16, 2022
xat pushed a commit that referenced this issue Feb 16, 2022
@melMass
Copy link
Member

melMass commented Feb 19, 2022

I've also made a test here, the logic is there but UX/UI could be better
https://teia-store-mint-infos.vercel.app/
https://github.com/melMass/teia-ui/tree/feature/store-mint-infos

@melMass melMass changed the title Mint form should save inputs Store the mint fields in local storage Mar 5, 2022
@melMass melMass added the enhancement New feature or request label Mar 5, 2022
@melMass melMass linked a pull request Mar 13, 2022 that will close this issue
@xat xat closed this as completed in #24 Mar 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants