Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Feature/Bug] History tab #26

Merged
merged 8 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More renamings
  • Loading branch information
Serhii-DV committed Apr 23, 2024
commit 80b266bb47f5e8d41e6961acc34219cd51e013a0
10 changes: 5 additions & 5 deletions src/popup/content/history_tab.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<h2 class="display-6 px-2">History</h2>
<releases-list id="storageReleasesLIst"></releases-list>
<releases-list id="historyReleasesList"></releases-list>

<div class="modal fade" id="storageTabDeleteAllModal" tabindex="-1" aria-labelledby="storageTabDeleteAllModalTitle" aria-hidden="true">
<div class="modal fade" id="historyTabDeleteAllModal" tabindex="-1" aria-labelledby="historyTabDeleteAllModalTitle" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="storageTabDeleteAllModalTitle">Delete all storage data</h1>
<h1 class="modal-title fs-5" id="historyTabDeleteAllModalTitle">Delete all history data</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Are you sure you want to delete all storage data?
Are you sure you want to delete all history data?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-danger" id="storageTabDeleteAllModal_btnYes" data-bs-dismiss="modal">YES</button>
<button type="button" class="btn btn-danger" id="historyTabDeleteAllModal_btnYes" data-bs-dismiss="modal">YES</button>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</div>
<!-- CSV data -->
<div class="tab-pane fade small content-text" id="csvData" role="tabpanel" aria-labelledby="csvData-tab" tabindex="0"></div>
<!-- Storage data -->
<!-- History data -->
<div class="tab-pane fade small" id="history" role="tabpanel" aria-labelledby="history-tab" tabindex="0">
<external-content href="content/history_tab.html"></external-content>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getCurrentTab, getExtensionManifest } from "../modules/chrome.js";
import { loadDiscogsGenres } from "../discogs/modules/genres.js";
import { loadKeywordMapping } from "../bandcamp/modules/mapping.js";
import config from "../config.js";
import { setupStorageTab as setupHistoryTab } from "./tabs/storage_tab.js";
import { setupHistoryTab } from "./tabs/storage_tab.js";
import { disable, enable, hide, show, click } from "../modules/html.js";
import { setupReleasesTab } from "./tabs/releases_tab.js";
import { setupReleaseTab } from "./tabs/release_tab.js";
Expand Down
10 changes: 5 additions & 5 deletions src/popup/tabs/storage_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { populateReleasesList, removeButtonLoadingState, setButtonInLoadingState
/**
* @param {Element} btnDownloadCsv
*/
export function setupStorageTab(tab, btnDownloadCsv) {
const releasesList = document.querySelector('#storageReleasesLIst');
export function setupHistoryTab(tab, btnDownloadCsv) {
const releasesList = document.querySelector('#historyReleasesList');

if (!hasDataAttribute(tab, 'buttons-initialized')) {
setupReleasesList(tab, releasesList, btnDownloadCsv);
Expand All @@ -31,11 +31,11 @@ function updateReleasesListData(releasesList) {
*/
function setupReleasesList(tab, releasesList, btnDownloadCsv) {
const btnClearSelected = createElementFromHTML(`
<button id="storageDataClearSelected" type="button" class="btn btn-danger" data-status-update title="Clear selected storage data">
<button id="historyDataClearSelected" type="button" class="btn btn-danger" data-status-update title="Clear selected history">
<b2d-icon name="database-dash"></b2d-icon>
</button>`);
const btnClearAll = createElementFromHTML(`
<button id="storageDataClear" type="button" class="btn btn-dark" title="Remove all items from the storage" data-bs-toggle="modal" data-bs-target="#storageTabDeleteAllModal">
<button id="historyDataClear" type="button" class="btn btn-dark" title="Remove all items from the history" data-bs-toggle="modal" data-bs-target="#historyTabDeleteAllModal">
<b2d-icon name="database-x"></b2d-icon>
</button>`);

Expand Down Expand Up @@ -63,7 +63,7 @@ function setupReleasesList(tab, releasesList, btnDownloadCsv) {
});
});

tab.querySelector('#storageTabDeleteAllModal_btnYes').addEventListener('click', () => {
tab.querySelector('#historyTabDeleteAllModal_btnYes').addEventListener('click', () => {
clearStorage();
updateReleasesListData(releasesList);
});
Expand Down