Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

export to json option added #20

Merged
merged 1 commit into from
Oct 25, 2021
Merged

Conversation

Sagargajare
Copy link
Contributor

requested feature
#19 Add export to JSON option successfully added

  1. After clicking the export icon in the left corner it downloads(export) the clipboard history to JSON format

  2. It also supports light and dark themes.

image

image

@saifabusaleh saifabusaleh linked an issue Oct 15, 2021 that may be closed by this pull request
Copy link
Owner

@saifabusaleh saifabusaleh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall

few changes needed only

src/browser_actions/popup.js Outdated Show resolved Hide resolved
src/browser_actions/popup.js Outdated Show resolved Hide resolved
src/browser_actions/popup.js Outdated Show resolved Hide resolved
var exportLink = document.createElement("a"),
exportBlob = new Blob([clipboardHistory], { type: "octet/stream" }),
exportName = "clipboard-history.json",
exportUrl = window.URL.createObjectURL(exportBlob);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use const here

src/browser_actions/main.css Show resolved Hide resolved
src/browser_actions/popup.html Outdated Show resolved Hide resolved
src/browser_actions/main.css Outdated Show resolved Hide resolved
src/browser_actions/popup.html Outdated Show resolved Hide resolved
@Sagargajare
Copy link
Contributor Author

@saifabusaleh I made the above changes. please check and let me know if anything remained to do or needs to fix.

const exportLink = document.createElement("a");
var exportBlob = new Blob([clipboardHistory], { type: "octet/stream" });
const todaysDate = new Date().toLocaleDateString("en-GB");
const exportName = `clipboard-history-${todaysDate}.json`;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to export exportFileName

const clipboardHistory = JSON.stringify(clippingsList);
const exportLink = document.createElement("a");
var exportBlob = new Blob([clipboardHistory], { type: "octet/stream" });
const todaysDate = new Date().toLocaleDateString("en-GB");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to todayDate

@@ -173,3 +176,15 @@ const setDarkTheme = () => {
htmlElement.classList.add("dark-theme");
themePath.setAttribute("d", sunSvgPath);
}

const exportJson = () => {
const clipboardHistory = JSON.stringify(clippingsList);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't take into account filtering

for example:

if user filtered the results and do export, all data will be exported instead of the filtered results

Can you take into consideration the filtering?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saifabusaleh is filtering feature is there already?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sagargajare You can filter by searching text with the search input

@Sagargajare
Copy link
Contributor Author

@saifabusaleh I made it working with filtering as well.

Copy link
Owner

@saifabusaleh saifabusaleh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final comments

After finishing please rebase into single commit and I will merge

src/browser_actions/popup.js Show resolved Hide resolved
const exportJson = () => {
let clipboardHistory = []
const filteredList = filterClippingsList(clippingsList, searchText);
if (filteredList.length == 0) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported data should be always based on the search
if there is no data after the search, it should export empty json

@Sagargajare
Copy link
Contributor Author

@saifabusaleh I fixed the above issues.

@saifabusaleh
Copy link
Owner

Thanks @Sagargajare

Please squash all commits into one commit and I will merge

to squash:

git rebase -i master
keep the first one as pick and rest as squash and save
update commit message if necessary
push

@Sagargajare
Copy link
Contributor Author

@saifabusaleh I rebased it. but it is saying "Everything up-to-date"

@Sagargajare
Copy link
Contributor Author

@saifabusaleh I rebased it please check.

@Sagargajare
Copy link
Contributor Author

@saifabusaleh Thanks for suggesting these sources. Finally, it worked and was rebased to 1 commit. Please review it. Sorry for the delay.

@saifabusaleh
Copy link
Owner

@Sagargajare Great, thanks
Please squash again into single commit so I can merge it

export to json feature added

export to json option added

spacing and export icon fixed

var name fixed

export filtered data

export filtered data

export to json feature added

export to json option added

spacing and export icon fixed
@saifabusaleh
Copy link
Owner

Thanks @Sagargajare

@saifabusaleh saifabusaleh merged commit 90567db into saifabusaleh:master Oct 25, 2021
@Sagargajare
Copy link
Contributor Author

Thank You @saifabusaleh for guiding me.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add export to json option
2 participants