r3bl-org / shortlink

This Chrome extension provides a browser action that simply allows the user to create a shortlink for all the selected tabs in the current window. It can be activated via a keyboard shortcut Alt + L. To use it, in the omnibar, type go then press Tab, then type the phrase you have created a shortlink for earlier & it will open the tab(s).
https://chrome.google.com/webstore/detail/shorty/ffhfkgcfbjoadmhdmdcmigopbfkddial?hl=en-US&gl=US
MIT License
10 stars 13 forks source link

Implement `import` and `export` commands #9

Closed nazmulidris closed 8 months ago

nazmulidris commented 11 months ago

Currently all the shortlinks are saved in a key-value store in Chrome Sync for the user's logged in account. It would be useful to be able to export and import all these links.

Add an export command that simply takes the entire hashmap of shortlinks, turns them into JSON, and then copies them to the clipboard.

Add an import command that does the reverse (clipboard -> JSON text -> shortlinks).

Use case

Here's a user journey:

amitx13 commented 9 months ago

Hey @nazmulidris sir can i work on this too

nazmulidris commented 9 months ago

@soykot2910 Can you make a comment on this issue or accept the invite, so I can assign you to this issue?

nazmulidris commented 9 months ago

Hey @nazmulidris sir can i work on this too

@amitx13 Thank you for your interest. This one is already been spoken for. However we have other open issues that you are welcome to take 👍🏽 https://github.com/r3bl-org/shortlink/issues

soykot2910 commented 9 months ago

@nazmulidris Yeah. why not

nazmulidris commented 9 months ago

@soykot2910 1) I think we can have an export command to export the content as JSON object (and then just copy that to the clipboard). So the user can just type export and the shortlinks can be turned to JSON & copied to the clipboard.

2) I think we can also add an import command ... and for this one we can probably show the user a text area for them to paste JSON content into?

nazmulidris commented 8 months ago

@soykot2910 I think the most effective way to allow import is to use something like this

https://uiwjs.github.io/react-textarea-code-editor/

It allows the content to be syntax highlighted, which makes for a great user experience.

image

soykot2910 commented 8 months ago

@nazmulidris where we can place the code editor? when some one type import. image

nazmulidris commented 8 months ago

@soykot2910 I was thinking that we can replace the entire box containing "Your shortlinks:" with the react-textarea-code-editor.

image

The thinking here is that the user will edit the JSON that will become their entire shortlink data set. In a way, this can be a programmatic way of "Edit Shortlinks" 😄

Perhaps when the user types import, all the existing shortlink data should be loaded into the react-textarea-code-editor, so that the user can start from that place and edit whatever they have. Or just copy / paste it from somewhere else.

soykot2910 commented 8 months ago

That would be nice. However, if someone doesn't want to edit an existing shortlink and simply wishes to add a new shortlink from export, they would need to modify the shortlink rather than just pasting it.

nazmulidris commented 8 months ago

That would be nice.

I agree! It's a very developer-first / friendly approach :)

However, if someone doesn't want to edit an existing shortlink and simply wishes to add a new shortlink from export, they would need to modify the shortlink rather than just pasting it

That's right. Since this isn't the primary use case for this feature, I think it is ok 👍🏽

nazmulidris commented 8 months ago

@soykot2910 Hi 👋🏽 If you don't have time to work on this issue, please let me know and I can assign it to someone else. Thank you for spending your time contributing.

soykot2910 commented 8 months ago

@nazmulidris sorry for late. I wast busy last few days. Here is the PR. let me know if need to change anything.

nazmulidris commented 8 months ago

@soykot2910 No worries! Thank you for taking the time to contribute ❤️ . I was just checking to see (since some of the other issues have been dropped by contributors and there were some new contributors looking to take on new issues) 🙏🏽