fix(org): show org logo for favicon and OG image (#713)
When no custom favicon is set, fall back to the organization logo on public org-site pages instead of the default ClassroomIO icon. For OG images, only apply the theme-color background behind the logo when rendering initials; real logo images now render without the tint. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>
This commit is contained in:
co-authored by
Cursor Agent
Rotimi Best
parent
3d15bc0a01
commit
22a3e6484b
@@ -1,15 +1,20 @@
|
||||
import type { AccountOrg } from '$features/app/types';
|
||||
|
||||
export function getOrgFaviconHref(org: Pick<AccountOrg, 'favicon' | 'avatarUrl'> | null | undefined): string | null {
|
||||
export function getOrgFaviconHref(
|
||||
org: Pick<AccountOrg, 'favicon' | 'avatarUrl'> | null | undefined,
|
||||
pageOrigin?: string
|
||||
): string | null {
|
||||
const favicon = org?.favicon?.trim();
|
||||
if (favicon) {
|
||||
return favicon;
|
||||
}
|
||||
|
||||
const avatarUrl = org?.avatarUrl?.trim();
|
||||
if (avatarUrl) {
|
||||
return avatarUrl;
|
||||
const rawHref = favicon || avatarUrl;
|
||||
|
||||
if (!rawHref) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
try {
|
||||
return new URL(rawHref, pageOrigin || undefined).href;
|
||||
} catch {
|
||||
return rawHref;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user