change history to clean
This commit is contained in:
@@ -6,14 +6,14 @@ import type {
|
||||
BookmarkSortKey,
|
||||
BrowserView,
|
||||
ExtensionSortKey,
|
||||
HistoryDomainSortKey,
|
||||
CleanupHistoryResult,
|
||||
PasswordSiteSortKey,
|
||||
ProfileSortKey,
|
||||
} from "../../types/browser";
|
||||
import AssociatedProfilesModal from "./AssociatedProfilesModal.vue";
|
||||
import BookmarksList from "./BookmarksList.vue";
|
||||
import ExtensionsList from "./ExtensionsList.vue";
|
||||
import HistoryDomainsList from "./HistoryDomainsList.vue";
|
||||
import HistoryCleanupList from "./HistoryCleanupList.vue";
|
||||
import PasswordSitesList from "./PasswordSitesList.vue";
|
||||
import ProfilesList from "./ProfilesList.vue";
|
||||
|
||||
@@ -24,17 +24,18 @@ defineProps<{
|
||||
extensionSortKey: ExtensionSortKey;
|
||||
bookmarkSortKey: BookmarkSortKey;
|
||||
passwordSiteSortKey: PasswordSiteSortKey;
|
||||
historyDomainSortKey: HistoryDomainSortKey;
|
||||
sortedProfiles: BrowserView["profiles"];
|
||||
sortedExtensions: BrowserView["extensions"];
|
||||
sortedBookmarks: BrowserView["bookmarks"];
|
||||
sortedPasswordSites: BrowserView["passwordSites"];
|
||||
sortedHistoryDomains: BrowserView["historyDomains"];
|
||||
historySelectedProfileIds: string[];
|
||||
cleanupHistoryBusy: boolean;
|
||||
cleanupHistoryError: string;
|
||||
cleanupHistoryResults: CleanupHistoryResult[];
|
||||
openProfileError: string;
|
||||
sectionCount: (section: ActiveSection) => number;
|
||||
isOpeningProfile: (browserId: string, profileId: string) => boolean;
|
||||
extensionMonogram: (name: string) => string;
|
||||
domainFromUrl: (url: string) => string;
|
||||
associatedProfilesModal: {
|
||||
title: string;
|
||||
browserId: string;
|
||||
@@ -49,12 +50,14 @@ const emit = defineEmits<{
|
||||
"update:extensionSortKey": [value: ExtensionSortKey];
|
||||
"update:bookmarkSortKey": [value: BookmarkSortKey];
|
||||
"update:passwordSiteSortKey": [value: PasswordSiteSortKey];
|
||||
"update:historyDomainSortKey": [value: HistoryDomainSortKey];
|
||||
openProfile: [browserId: string, profileId: string];
|
||||
showExtensionProfiles: [extensionId: string];
|
||||
showBookmarkProfiles: [url: string];
|
||||
showPasswordSiteProfiles: [url: string];
|
||||
showHistoryDomainProfiles: [domain: string];
|
||||
toggleHistoryProfile: [profileId: string];
|
||||
toggleAllHistoryProfiles: [];
|
||||
cleanupSelectedHistory: [];
|
||||
cleanupHistoryForProfile: [profileId: string];
|
||||
closeAssociatedProfiles: [];
|
||||
}>();
|
||||
</script>
|
||||
@@ -146,12 +149,19 @@ const emit = defineEmits<{
|
||||
@show-profiles="emit('showPasswordSiteProfiles', $event)"
|
||||
/>
|
||||
|
||||
<HistoryDomainsList
|
||||
<HistoryCleanupList
|
||||
v-else
|
||||
:history-domains="sortedHistoryDomains"
|
||||
:sort-key="historyDomainSortKey"
|
||||
@update:sort-key="emit('update:historyDomainSortKey', $event)"
|
||||
@show-profiles="emit('showHistoryDomainProfiles', $event)"
|
||||
:browser-id="currentBrowser.browserId"
|
||||
:browser-family-id="currentBrowser.browserFamilyId"
|
||||
:profiles="sortedProfiles"
|
||||
:selected-profile-ids="historySelectedProfileIds"
|
||||
:cleanup-busy="cleanupHistoryBusy"
|
||||
:cleanup-error="cleanupHistoryError"
|
||||
:cleanup-results="cleanupHistoryResults"
|
||||
@toggle-profile="emit('toggleHistoryProfile', $event)"
|
||||
@toggle-all-profiles="emit('toggleAllHistoryProfiles')"
|
||||
@cleanup-selected="emit('cleanupSelectedHistory')"
|
||||
@cleanup-profile="emit('cleanupHistoryForProfile', $event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
391
src/components/browser-data/HistoryCleanupList.vue
Normal file
391
src/components/browser-data/HistoryCleanupList.vue
Normal file
@@ -0,0 +1,391 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import type {
|
||||
CleanupHistoryResult,
|
||||
CleanupFileStatus,
|
||||
ProfileSummary,
|
||||
} from "../../types/browser";
|
||||
import { profileAvatarSrc } from "../../utils/icons";
|
||||
|
||||
const props = defineProps<{
|
||||
browserId: string;
|
||||
browserFamilyId: string | null;
|
||||
profiles: ProfileSummary[];
|
||||
selectedProfileIds: string[];
|
||||
cleanupBusy: boolean;
|
||||
cleanupError: string;
|
||||
cleanupResults: CleanupHistoryResult[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
toggleProfile: [profileId: string];
|
||||
toggleAllProfiles: [];
|
||||
cleanupSelected: [];
|
||||
cleanupProfile: [profileId: string];
|
||||
}>();
|
||||
|
||||
const selectableProfiles = computed(() =>
|
||||
props.profiles.filter((profile) =>
|
||||
hasAnyHistoryFile([
|
||||
profile.historyCleanup.history,
|
||||
profile.historyCleanup.topSites,
|
||||
profile.historyCleanup.visitedLinks,
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
||||
const allSelected = computed(
|
||||
() =>
|
||||
selectableProfiles.value.length > 0 &&
|
||||
selectableProfiles.value.every((profile) =>
|
||||
props.selectedProfileIds.includes(profile.id),
|
||||
),
|
||||
);
|
||||
|
||||
function statusLabel(status: CleanupFileStatus) {
|
||||
return status === "found" ? "Found" : "Missing";
|
||||
}
|
||||
|
||||
function statusClass(status: CleanupFileStatus) {
|
||||
return status === "found" ? "found" : "missing";
|
||||
}
|
||||
|
||||
function isSelected(profileId: string) {
|
||||
return props.selectedProfileIds.includes(profileId);
|
||||
}
|
||||
|
||||
function isSelectable(profile: ProfileSummary) {
|
||||
return hasAnyHistoryFile([
|
||||
profile.historyCleanup.history,
|
||||
profile.historyCleanup.topSites,
|
||||
profile.historyCleanup.visitedLinks,
|
||||
]);
|
||||
}
|
||||
|
||||
function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
|
||||
return statuses.some((status) => status === "found");
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="table-section">
|
||||
<div v-if="cleanupError" class="inline-error">
|
||||
{{ cleanupError }}
|
||||
</div>
|
||||
|
||||
<div v-if="cleanupResults.length" class="result-strip">
|
||||
<article
|
||||
v-for="result in cleanupResults"
|
||||
:key="result.profileId"
|
||||
class="result-chip"
|
||||
:class="{ error: result.error }"
|
||||
>
|
||||
<strong>{{ result.profileId }}</strong>
|
||||
<span v-if="result.error">{{ result.error }}</span>
|
||||
<span v-else-if="result.deletedFiles.length">
|
||||
Deleted {{ result.deletedFiles.join(", ") }}
|
||||
</span>
|
||||
<span v-else>
|
||||
Nothing to delete
|
||||
</span>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<div class="history-toolbar">
|
||||
<label class="toolbar-checkbox" :class="{ disabled: !selectableProfiles.length }">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="allSelected"
|
||||
:disabled="!selectableProfiles.length || cleanupBusy"
|
||||
@change="emit('toggleAllProfiles')"
|
||||
/>
|
||||
<span>Select All</span>
|
||||
</label>
|
||||
<button
|
||||
class="danger-button"
|
||||
type="button"
|
||||
:disabled="!selectedProfileIds.length || cleanupBusy"
|
||||
@click="emit('cleanupSelected')"
|
||||
>
|
||||
{{ cleanupBusy ? "Cleaning..." : `Clean Selected (${selectedProfileIds.length})` }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="profiles.length" class="data-table">
|
||||
<div class="data-table-header history-grid">
|
||||
<div class="header-cell checkbox-cell">Pick</div>
|
||||
<div class="header-cell icon-cell">Avatar</div>
|
||||
<div class="header-cell">Profile</div>
|
||||
<div class="header-cell">History</div>
|
||||
<div class="header-cell">Top Sites</div>
|
||||
<div class="header-cell">Visited Links</div>
|
||||
<div class="header-cell actions-cell">Action</div>
|
||||
</div>
|
||||
<div class="data-table-body styled-scrollbar">
|
||||
<article v-for="profile in profiles" :key="profile.id" class="data-table-row history-grid">
|
||||
<div class="row-cell checkbox-cell">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="isSelected(profile.id)"
|
||||
:disabled="!isSelectable(profile) || cleanupBusy"
|
||||
@change="emit('toggleProfile', profile.id)"
|
||||
/>
|
||||
</div>
|
||||
<div class="profile-avatar table-avatar">
|
||||
<img
|
||||
v-if="profileAvatarSrc(profile, browserFamilyId)"
|
||||
:src="profileAvatarSrc(profile, browserFamilyId) ?? undefined"
|
||||
:alt="`${profile.name} avatar`"
|
||||
/>
|
||||
<span v-else>{{ profile.avatarLabel }}</span>
|
||||
</div>
|
||||
<div class="row-cell primary-cell">
|
||||
<strong>{{ profile.name }}</strong>
|
||||
<span class="subtle-line">{{ profile.id }}</span>
|
||||
</div>
|
||||
<div class="row-cell">
|
||||
<span class="status-pill" :class="statusClass(profile.historyCleanup.history)">
|
||||
{{ statusLabel(profile.historyCleanup.history) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="row-cell">
|
||||
<span class="status-pill" :class="statusClass(profile.historyCleanup.topSites)">
|
||||
{{ statusLabel(profile.historyCleanup.topSites) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="row-cell">
|
||||
<span class="status-pill" :class="statusClass(profile.historyCleanup.visitedLinks)">
|
||||
{{ statusLabel(profile.historyCleanup.visitedLinks) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="row-cell actions-cell">
|
||||
<button
|
||||
class="danger-button action-button"
|
||||
type="button"
|
||||
:disabled="!isSelectable(profile) || cleanupBusy"
|
||||
@click="emit('cleanupProfile', profile.id)"
|
||||
>
|
||||
Clean
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-card">
|
||||
<p>No profile directories were found for this browser.</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.table-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.history-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.toolbar-checkbox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: var(--text);
|
||||
font-size: 0.88rem;
|
||||
}
|
||||
|
||||
.toolbar-checkbox.disabled {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.result-strip {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
overflow: auto;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.result-chip {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
min-width: 220px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid rgba(16, 185, 129, 0.2);
|
||||
border-radius: 14px;
|
||||
background: rgba(236, 253, 245, 0.92);
|
||||
color: #065f46;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.result-chip.error {
|
||||
border-color: rgba(239, 68, 68, 0.18);
|
||||
background: rgba(254, 242, 242, 0.96);
|
||||
color: #b42318;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||
border-radius: 22px;
|
||||
background: var(--panel);
|
||||
box-shadow: var(--shadow);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.data-table-body {
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.history-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 52px 56px minmax(170px, 1fr) 118px 118px 128px 108px;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.data-table-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
padding: 10px 24px 10px 14px;
|
||||
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
||||
background: rgba(248, 250, 252, 0.94);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.data-table-row {
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||
}
|
||||
|
||||
.data-table-row:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.data-table-row:hover {
|
||||
background: rgba(248, 250, 252, 0.65);
|
||||
}
|
||||
|
||||
.header-cell {
|
||||
color: var(--muted);
|
||||
font-size: 0.81rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.checkbox-cell {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.icon-cell {
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.row-cell {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.profile-avatar {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
flex-shrink: 0;
|
||||
background: linear-gradient(135deg, #dbeafe, #eff6ff);
|
||||
color: #1d4ed8;
|
||||
font-size: 0.96rem;
|
||||
font-weight: 700;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-avatar {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.profile-avatar img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.primary-cell strong {
|
||||
display: block;
|
||||
font-size: 0.93rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.subtle-line {
|
||||
display: block;
|
||||
margin-top: 3px;
|
||||
color: var(--muted-soft);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.status-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 78px;
|
||||
padding: 6px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 0.79rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status-pill.found {
|
||||
background: rgba(37, 99, 235, 0.12);
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.status-pill.missing {
|
||||
background: rgba(226, 232, 240, 0.7);
|
||||
color: var(--badge-text);
|
||||
}
|
||||
|
||||
.actions-cell {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.action-button {
|
||||
padding-inline: 12px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.history-grid {
|
||||
grid-template-columns: 52px 56px minmax(160px, 1fr) 110px 110px 118px 100px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.history-toolbar {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.history-grid {
|
||||
grid-template-columns: 52px 56px minmax(0, 1fr) 108px;
|
||||
}
|
||||
|
||||
.history-grid > :nth-child(5),
|
||||
.history-grid > :nth-child(6),
|
||||
.history-grid > :nth-child(7) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,165 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { HistoryDomainSortKey, HistoryDomainSummary } from "../../types/browser";
|
||||
|
||||
defineProps<{
|
||||
historyDomains: HistoryDomainSummary[];
|
||||
sortKey: HistoryDomainSortKey;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:sortKey": [value: HistoryDomainSortKey];
|
||||
showProfiles: [domain: string];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="table-section">
|
||||
<div v-if="historyDomains.length" class="data-table">
|
||||
<div class="data-table-header history-grid">
|
||||
<button class="header-cell sortable" :class="{ active: sortKey === 'domain' }" type="button" @click="emit('update:sortKey', 'domain')">Domain</button>
|
||||
<button class="header-cell sortable" :class="{ active: sortKey === 'visits' }" type="button" @click="emit('update:sortKey', 'visits')">Visits</button>
|
||||
<div class="header-cell actions-cell">Profiles</div>
|
||||
</div>
|
||||
<div class="data-table-body styled-scrollbar">
|
||||
<article
|
||||
v-for="historyDomain in historyDomains"
|
||||
:key="historyDomain.domain"
|
||||
class="data-table-row history-grid"
|
||||
>
|
||||
<div class="row-cell primary-cell">
|
||||
<strong>{{ historyDomain.domain }}</strong>
|
||||
</div>
|
||||
<div class="row-cell muted-cell">{{ historyDomain.visitCount.toLocaleString() }}</div>
|
||||
<div class="row-cell actions-cell">
|
||||
<button class="disclosure-button" type="button" @click="emit('showProfiles', historyDomain.domain)">
|
||||
<span>View</span>
|
||||
<span class="badge neutral">{{ historyDomain.profileIds.length }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-card">
|
||||
<p>No browsing history domains were discovered for this browser.</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.table-section {
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||
border-radius: 22px;
|
||||
background: var(--panel);
|
||||
box-shadow: var(--shadow);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.data-table-body {
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.history-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(240px, 1.2fr) 140px 154px;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.data-table-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
padding: 10px 24px 10px 14px;
|
||||
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
||||
background: rgba(248, 250, 252, 0.94);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.header-cell {
|
||||
color: var(--muted);
|
||||
font-size: 0.81rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.header-cell.sortable {
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.header-cell.sortable.active {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.data-table-row {
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||
}
|
||||
|
||||
.data-table-row:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.data-table-row:hover {
|
||||
background: rgba(248, 250, 252, 0.65);
|
||||
}
|
||||
|
||||
.row-cell {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.primary-cell strong {
|
||||
display: block;
|
||||
font-size: 0.93rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.muted-cell {
|
||||
color: var(--muted);
|
||||
font-size: 0.87rem;
|
||||
}
|
||||
|
||||
.disclosure-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
width: fit-content;
|
||||
min-width: 120px;
|
||||
padding: 7px 10px;
|
||||
border-radius: 12px;
|
||||
background: rgba(241, 245, 249, 0.9);
|
||||
color: var(--badge-text);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.actions-cell {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.history-grid {
|
||||
grid-template-columns: minmax(0, 1fr) 120px;
|
||||
}
|
||||
|
||||
.history-grid > :nth-child(2) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user