generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { organizationImageCache } from "../fetch-github/fetch-issues-full"; | ||
|
||
export function renderOrgHeaderLabel(orgName: string): void { | ||
const brandingDiv = document.getElementById("branding"); | ||
if (!brandingDiv) return; | ||
|
||
// Fetch the organization logo from the cache | ||
const logoBlob = organizationImageCache.get(orgName); | ||
|
||
if (logoBlob) { | ||
// Convert Blob to a URL | ||
const logoUrl = URL.createObjectURL(logoBlob); | ||
|
||
const img = document.createElement("img"); | ||
img.src = logoUrl; | ||
img.alt = `${orgName} Logo`; | ||
img.id = "logo"; | ||
img.style.width = "24.469px"; // same size as default SVG | ||
img.style.height = "28px"; | ||
img.style.objectFit = "contain"; | ||
|
||
// Replace the existing SVG with the new image | ||
const svgLogo = brandingDiv.querySelector("svg#logo"); | ||
if (svgLogo) brandingDiv.replaceChild(img, svgLogo); | ||
} | ||
|
||
// Update the organization name inside the span with class 'full' | ||
const orgNameSpan = brandingDiv.querySelector("span.full"); | ||
if (orgNameSpan) orgNameSpan.textContent = `${orgName} | `; | ||
} |