tighten ui

This commit is contained in:
Julian Freeman
2026-04-16 13:07:58 -04:00
parent c8a3d92be4
commit 3a180fc5db
2 changed files with 143 additions and 73 deletions

View File

@@ -50,6 +50,8 @@ const error = ref("");
const response = ref<ScanResponse>({ browsers: [] });
const selectedBrowserId = ref("");
const activeSection = ref<"profiles" | "extensions" | "bookmarks">("profiles");
const expandedExtensionIds = ref<string[]>([]);
const expandedBookmarkUrls = ref<string[]>([]);
const browsers = computed(() => response.value.browsers);
const currentBrowser = computed(() =>
@@ -75,6 +77,11 @@ watch(
{ immediate: true },
);
watch(selectedBrowserId, () => {
expandedExtensionIds.value = [];
expandedBookmarkUrls.value = [];
});
async function scanBrowsers() {
loading.value = true;
error.value = "";
@@ -117,6 +124,26 @@ function sectionCount(section: "profiles" | "extensions" | "bookmarks") {
return currentBrowser.value.bookmarks.length;
}
function toggleExtensionProfiles(extensionId: string) {
expandedExtensionIds.value = expandedExtensionIds.value.includes(extensionId)
? expandedExtensionIds.value.filter((id) => id !== extensionId)
: [...expandedExtensionIds.value, extensionId];
}
function toggleBookmarkProfiles(url: string) {
expandedBookmarkUrls.value = expandedBookmarkUrls.value.includes(url)
? expandedBookmarkUrls.value.filter((value) => value !== url)
: [...expandedBookmarkUrls.value, url];
}
function extensionProfilesExpanded(extensionId: string) {
return expandedExtensionIds.value.includes(extensionId);
}
function bookmarkProfilesExpanded(url: string) {
return expandedBookmarkUrls.value.includes(url);
}
onMounted(() => {
void scanBrowsers();
});
@@ -260,7 +287,6 @@ onMounted(() => {
<span class="badge neutral">{{ profile.id }}</span>
</div>
<p class="profile-email">{{ profile.email || "No email found" }}</p>
<p class="profile-path" :title="profile.path">{{ profile.path }}</p>
</div>
</article>
</div>
@@ -300,14 +326,27 @@ onMounted(() => {
</span>
</div>
<p class="meta-line">{{ extension.id }}</p>
<div class="badge-row">
<span
v-for="profileId in extension.profileIds"
:key="`${extension.id}-${profileId}`"
class="badge"
<div class="source-disclosure">
<button
class="disclosure-button"
type="button"
@click="toggleExtensionProfiles(extension.id)"
>
{{ profileId }}
</span>
<span>Profiles</span>
<span class="badge neutral">{{ extension.profileIds.length }}</span>
</button>
<div
v-if="extensionProfilesExpanded(extension.id)"
class="disclosure-panel"
>
<span
v-for="profileId in extension.profileIds"
:key="`${extension.id}-${profileId}`"
class="badge"
>
{{ profileId }}
</span>
</div>
</div>
</div>
</article>
@@ -338,14 +377,27 @@ onMounted(() => {
<span class="badge neutral">{{ domainFromUrl(bookmark.url) }}</span>
</div>
<p class="bookmark-url" :title="bookmark.url">{{ bookmark.url }}</p>
<div class="badge-row">
<span
v-for="profileId in bookmark.profileIds"
:key="`${bookmark.url}-${profileId}`"
class="badge"
<div class="source-disclosure">
<button
class="disclosure-button"
type="button"
@click="toggleBookmarkProfiles(bookmark.url)"
>
{{ profileId }}
</span>
<span>Profiles</span>
<span class="badge neutral">{{ bookmark.profileIds.length }}</span>
</button>
<div
v-if="bookmarkProfilesExpanded(bookmark.url)"
class="disclosure-panel"
>
<span
v-for="profileId in bookmark.profileIds"
:key="`${bookmark.url}-${profileId}`"
class="badge"
>
{{ profileId }}
</span>
</div>
</div>
</div>
</article>