mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
profile modal: always-visible "Acting as" identity card (#43)
Identity pill top-center on every pane, straddling the header divider, so users always see which profile they're acting as (e.g. before uploading). Populated in renderSavedProfiles (same resolveMeta path as the Account pane card, so it refreshes on profile switch), hidden when logged out, and click-through jumps to the Account pane. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
27be0301c5
commit
d1a578f3a2
4 files changed
+186
No files matched your search
@@ -669,6 +669,13 @@ export class ProfileModalController {
|
||||
this.profileAvatar = document.getElementById("profileModalAvatar") || null;
|
||||
this.profileName = document.getElementById("profileModalName") || null;
|
||||
this.profileNpub = document.getElementById("profileModalNpub") || null;
|
||||
// #43: always-visible identity card straddling the header divider.
|
||||
this.identityCard =
|
||||
document.getElementById("profileModalIdentityCard") || null;
|
||||
this.identityCardAvatar =
|
||||
document.getElementById("profileModalIdentityAvatar") || null;
|
||||
this.identityCardName =
|
||||
document.getElementById("profileModalIdentityName") || null;
|
||||
this.switcherList = document.getElementById("profileSwitcherList") || null;
|
||||
|
||||
this.profileModalAvatar = this.profileAvatar;
|
||||
@@ -1745,6 +1752,12 @@ export class ProfileModalController {
|
||||
});
|
||||
}
|
||||
|
||||
if (this.identityCard instanceof HTMLElement) {
|
||||
this.identityCard.addEventListener("click", () => {
|
||||
this.selectPane("account");
|
||||
});
|
||||
}
|
||||
|
||||
if (this.permissionPromptCtaButton instanceof HTMLElement) {
|
||||
this.permissionPromptCtaButton.addEventListener("click", () => {
|
||||
if (this.permissionPromptCtaButton?.dataset?.action === "retry-auth-sync") {
|
||||
@@ -2564,6 +2577,24 @@ export class ProfileModalController {
|
||||
: this.globalProfileAvatar.alt || "Profile avatar";
|
||||
}
|
||||
|
||||
// #43: keep the always-visible identity card in sync (hidden when logged
|
||||
// out so the modal doesn't claim an identity that isn't active).
|
||||
if (this.identityCard instanceof HTMLElement) {
|
||||
this.identityCard.classList.toggle("hidden", !hasActiveProfile);
|
||||
this.identityCard.setAttribute(
|
||||
"aria-hidden",
|
||||
hasActiveProfile ? "false" : "true",
|
||||
);
|
||||
}
|
||||
if (this.identityCardName instanceof HTMLElement) {
|
||||
this.identityCardName.textContent = activeDisplayName;
|
||||
}
|
||||
if (this.identityCardAvatar instanceof HTMLImageElement) {
|
||||
if (this.identityCardAvatar.src !== activeAvatarSrc) {
|
||||
this.identityCardAvatar.src = activeAvatarSrc;
|
||||
}
|
||||
}
|
||||
|
||||
const listEl = this.switcherList;
|
||||
if (listEl instanceof HTMLElement) {
|
||||
listEl.textContent = "";
|
||||
|
||||
Reference in new issue
Block a user