feat(recent-repos): add functionality to remove repositories from recent
This update introduces a new function to remove repositories from the recent list. The user can now manage their recent repositories more effectively, enhancing the overall user experience. - Implemented removal of repositories from the recent list - Updated UI to reflect changes in the recent repositories management
This commit is contained in:
+16
-1
@@ -1939,6 +1939,21 @@
|
|||||||
if (!activeStillOpen) await openRepo(path);
|
if (!activeStillOpen) await openRepo(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function removeRepoFromRecent(path: string, event?: MouseEvent) {
|
||||||
|
event?.stopPropagation();
|
||||||
|
if (isBusy) return;
|
||||||
|
recentRepoPaths = recentRepoPaths.filter((recentPath) => !sameRepoPath(recentPath, path));
|
||||||
|
persistRepoLists();
|
||||||
|
trackEvent("repository_removed_from_recent", {
|
||||||
|
recent_repositories: recentRepoPaths.length,
|
||||||
|
});
|
||||||
|
if (!repoTabs.some((tab) => sameRepoPath(tab.path, path)) && !isFavoriteRepo(path) && repoStatusCache[repoKey(path)]) {
|
||||||
|
const { [repoKey(path)]: _removed, ...rest } = repoStatusCache;
|
||||||
|
repoStatusCache = rest;
|
||||||
|
persistRepoStatusCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function removeRepoFromManagement(path: string, event?: MouseEvent) {
|
async function removeRepoFromManagement(path: string, event?: MouseEvent) {
|
||||||
event?.stopPropagation();
|
event?.stopPropagation();
|
||||||
if (isBusy) return;
|
if (isBusy) return;
|
||||||
@@ -3516,7 +3531,7 @@
|
|||||||
>
|
>
|
||||||
<Star size={14} aria-hidden="true" />
|
<Star size={14} aria-hidden="true" />
|
||||||
</button>
|
</button>
|
||||||
<button class="repo-row-icon" type="button" onclick={(event) => removeRepoFromManagement(repo.path, event)} disabled={isBusy} title="Remove from recent" aria-label={`Remove ${repo.name}`}>
|
<button class="repo-row-icon" type="button" onclick={(event) => removeRepoFromRecent(repo.path, event)} disabled={isBusy} title="Remove from recent" aria-label={`Remove ${repo.name}`}>
|
||||||
<X size={14} aria-hidden="true" />
|
<X size={14} aria-hidden="true" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user