GithubHelp home page GithubHelp logo

Losing draft posts since it stores multiple draft posts in the same auto-saved value in Local Storage when you draft multiple posts in parallel that may be from different Spaces about polkaverse HOT 4 OPEN

dappforce avatar dappforce commented on September 27, 2024
Losing draft posts since it stores multiple draft posts in the same auto-saved value in Local Storage when you draft multiple posts in parallel that may be from different Spaces

from polkaverse.

Comments (4)

olehmell avatar olehmell commented on September 27, 2024

Hello! Thanks for the report!

Tbh Polkaverse doesn't have the functionality of multiple drafts of posts yet.

I know how we can add one draft for each location. Will this be enough for you?

from polkaverse.

teodorus-nathaniel avatar teodorus-nathaniel commented on September 27, 2024

What I'm thinking of is having 1 draft for each type of editor
Right now we have modal editor (the popup one, which appears whether you click "New Post" or "Write Something...") and full editor

So I think it would make better sense to do these 2 things:

  1. Save content of modal editor in separate localstorage key
  2. Make modal editor loads the draft instead of having blank editor each time

What do you think? Will that solves the issue?

from polkaverse.

ltfschoen avatar ltfschoen commented on September 27, 2024

I think the all the following things have to be done:

1. Rename "Write Something..." to "Write New Post..."

2a.

  • If the user clicks "New Post" in the header, then default to using the SPACE_ID of their Profile Space, which it already does, but store that value of new post under the appropriate Key "ACCOUNT_ID-SPACE_ID" in local storage, where ACCOUNT_ID is the SS58 account address of the current user, and:
    • Update the routes so that the URL shows the RESTful route for Creating a post that has this pattern (that creates new post in a specific space associated with the current account): https://polkaverse.com/accounts/<ACCOUNT_ID>/spaces/<SPACE_ID>`
  • If there is already an existing value stored under that Key "ACCOUNT_ID-SPACE_ID", then display an "Edit Post" button as well in the header, and if they click that it will restore the value stored in local storage under that Key "ACCOUNT_ID-SPACE_ID" associated with their Profile Space. Whereas if they click the "New Post" button in the header then it resets the value stored in local storage under that Key "ACCOUNT_ID-SPACE_ID" associated with their Profile Space, where ACCOUNT_ID is the SS58 account address of the current user.
  • Note: that way if they switch between accounts it stores the draft posts associated with each different account and doesn't overwrite them.

2b. If the user clicks the "Write Something..." (which is currently shown in My Feed section, and Posts), then default to using the SPACE_ID of their Profile Space, which it already does, but store the value of that new post under the appropriate Key "ACCOUNT_ID-SPACE_ID" in local storage as mentioned above in 1), where ACCOUNT_ID is the SS58 account address of the current user, and:

  • Update the routes so that the URL shows the RESTful route for Creating a post that has this pattern (that creates new post in a specific space associated with the current account): https://polkaverse.com/accounts/<ACCOUNT_ID>/spaces/<SPACE_ID>`

3. If the user goes to My Spaces, where it lists their spaces, and they click the menu of a specific Space (i.e. their Profile space or one of their other Custom spaces) and choose "Write Post", then using the SPACE_ID of the specific space that they chose to create the post within, then default to using their Profile Space, which it already does, but store that new post under the appropriate Key "ACCOUNT_ID-SPACE_ID" in local storage as mentioned above in 1), where ACCOUNT_ID is the SS58 account address of the current user, and:

  • Update the routes so that the URL shows the RESTful route for Creating a post that has this pattern (that creates new post in a specific space associated with the current account): https://polkaverse.com/accounts/<ACCOUNT_ID>/spaces/<SPACE_ID>`

4. If the user goes to My Spaces, where it lists their spaces, and they click the menu of a specific Space (i.e. their Profile space or one of their other Custom spaces), then we want the user to have an extra item called "Edit Post" to be shown, but only if there is a Key "ACCOUNT_ID-SPACE_ID" in local storage where that ACCOUNT_ID matches the current user, and the SPACE_ID matches the menu of the specific Space that they are interacting with, and:

  • Update the routes so that the URL shows the RESTful route for Editing a post that has this pattern (that edits an existing post of a specific space associated with the current account by restoring the value stored under that Key in local storage): https://polkaverse.com/accounts/<ACCOUNT_ID>/spaces/<SPACE_ID>`.
  • Note: Despite what I mentioned previously here about having a different route for editing a draft post, I actually think that from the Single Responsibility Principle they share similar functionality of ultimately creating a post, only that we load the existing value from local storage if there is one if they click the "Edit Post" button.

from polkaverse.

teodorus-nathaniel avatar teodorus-nathaniel commented on September 27, 2024

Hey! thank you for the detailed explanation, but we are currently developing other big things 👀, so we will check this issue out after we finished the update

from polkaverse.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.