timofeysie / khipu

Electron PWA starter
MIT License
4 stars 1 forks source link

Get the description of a detail page and add it as the item list description #25

Closed timofeysie closed 3 years ago

timofeysie commented 3 years ago

Example: https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&titles=Stack%20Overflow

timofeysie commented 3 years ago

It would be nice to know other things about the Wikidata/Wikipedia details such as if they even have a description, a modified description, a link, and particular languages available. Keep in mind we want to be able to select a small portion of the detail description to use in the sliding item options.

timofeysie commented 3 years ago

As a sub item to this issue, https://github.com/timofeysie/khipu/issues/26

timofeysie commented 3 years ago

We now have three different descriptions to deal with:

  1. the description from the wikidata category items element
  2. the description added using the 'explaintext' api call
  3. the wikipedia markup description

The main page currently has a slide component to expose the first one. Many have no description, or one that is not appropriate. If it does exist it needs to be sent to the detail page to start off as the editable description. The other two can then provide cut and paste ability to add and edit the description or create a new one. The result of this can then replace the default wikidata list. The main problem here is how to persist this data so the user has control over their changes.

beige-zookeeper commented 3 years ago

The problem with sending the description to the detail page is that an item is selected and the details of the selection are added to the route like this:

this.router.navigate([`/categories/item-details/${this.categoryName}/${qCode}`]);

Obviously a long description can not be sent this way. And, we want users to be able to share these description urls. So we really need to be recreating what we need in the details page based on the url.

For example, this url: http://localhost:4200/categories/item-details/fallacies/Q310486

If one user sends this to another user, and they don't have the fallacies category in the same language with that q-code, then can we find a description for it? It doesn't really make sense that the recipient would want to edit the definition, as the item is not yet part of any list they have. So it only makes sense to worry about this if this item does in fact exist on the fallacies list that they should have in their store. If it's on a new device, then there will be a whole host of issues and 'what should we do in this case?' questions to answer.

timofeysie commented 3 years ago

I get that there is a lot to do in this issue. But one step at a time. What is the simplest next step here? Look in the categories list for the categoryName in the url, then try and find the qCode in that list. Also, it's pretty clear that the url should be something like one of these:

/categories/fallacies/item-details/Q310486
/categories/fallacies/details/Q310486
/categories/fallacies/Q310486

Any opinions?

timofeysie commented 3 years ago

A few issues with getting the selected item. The feature module has a separate state for each folder. We can of course import that and declare it in the module, but then it's going to be a new instance I think. Also, if the user refreshes the page, that wouldn't be there anyway. When the state is in the local storage, we need a way to re-hydrate that when needed, which would be in this case.

timofeysie commented 3 years ago

Seeming small issues were hard to fix, and a refactor was needed. Re-opening this to capture that work. The two remaining issues are:

  1. the Wikipedia description is showing up as a truncated version of the Wikimedia description, which it shouldn't do. The form is getting pre-filled also with that value, which we do want, so then we just have to complete the update if a user edits the field.
  2. the first time the user visits the detail that has no description, the wiki description is not being added to the input field. If the description is then added back to the firebase meta data user-description field, then the next time you visit the details page, the field is pre-filled with that user-description.