Skip to content

feat(edge-apps-library): add default Screenly logo fallback to brand-logo#737

Open
nicomiguelino wants to merge 3 commits intomasterfrom
feat/brand-logo-default-fallback
Open

feat(edge-apps-library): add default Screenly logo fallback to brand-logo#737
nicomiguelino wants to merge 3 commits intomasterfrom
feat/brand-logo-default-fallback

Conversation

@nicomiguelino
Copy link
Contributor

@nicomiguelino nicomiguelino commented Mar 14, 2026

User description

Summary

  • Add screenly.svg to edge-apps-library assets
  • Return the default Screenly logo from setupBrandingLogo() when screenly_logo_light/screenly_logo_dark are not set or all fetch attempts fail
  • Simplify setupBranding() since logoUrl is now always defined

PR Type

Bug fix, Enhancement, Tests


Description

  • Add default Screenly logo fallback

  • Normalize theme-based logo selection

  • Always return logoUrl in branding

  • Add fallback logo behavior tests


Diagram Walkthrough

flowchart LR
  settings["Theme and logo settings"]
  resolver["Resolve primary or secondary logo"]
  fetch["Fetch via proxy, then direct URL"]
  fallback["Use bundled `screenly.svg` fallback"]
  branding["Return branding config with `logoUrl`"]

  settings -- "selects inputs for" --> resolver
  resolver -- "provides URL to" --> fetch
  fetch -- "fails or missing config" --> fallback
  fetch -- "returns resolved logo to" --> branding
  fallback -- "supplies default to" --> branding
Loading

File Walkthrough

Relevant files
Bug fix
theme.ts
Default logo fallback for branding setup                                 

edge-apps/edge-apps-library/src/utils/theme.ts

  • Import bundled screenly.svg as default logo
  • Return default logo when no branding logos exist
  • Simplify logo resolution using primary/secondary selection
  • Always return logoUrl from setupBranding()
+16/-18 
Tests
theme.test.ts
Tests for branding logo fallback behavior                               

edge-apps/edge-apps-library/src/utils/theme.test.ts

  • Import setupBrandingLogo and bundled default logo
  • Add test for missing configured logos
  • Mock fetch failure to verify default fallback
  • Preserve and restore global fetch between tests
+35/-1   

…logo

- Copy screenly.svg from blueprint into edge-apps-library assets
- Return default logo from setupBrandingLogo() when no logo is configured or all fetches fail
- Simplify setupBranding() to always set logoUrl

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nicomiguelino nicomiguelino self-assigned this Mar 14, 2026
@nicomiguelino nicomiguelino requested a review from Copilot March 14, 2026 00:00
@nicomiguelino nicomiguelino marked this pull request as ready for review March 14, 2026 00:00
@github-actions
Copy link

github-actions bot commented Mar 14, 2026

PR Reviewer Guide 🔍

(Review updated until commit e3a6676)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Packaging Risk

Validate that the imported screenly.svg fallback is emitted and resolved correctly in the published library and in downstream consumers, otherwise the new fallback path may return a broken asset URL instead of an actual image.

import defaultLogoUrl from '../assets/images/screenly.svg'
API Contract

setupBranding() now always includes logoUrl. Confirm that callers, serializers, and UI logic do not depend on logoUrl being omitted or undefined when no custom branding is configured.

return {
  colors,
  logoUrl,

@github-actions
Copy link

Persistent review updated to latest commit 3cfa7ed

@github-actions
Copy link

github-actions bot commented Mar 14, 2026

PR Code Suggestions ✨

Latest suggestions up to 3cfa7ed
Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Skip empty fallback fetches

Avoid calling fetchLogoImage with an empty fallbackUrl, which can trigger a fetch to
an unintended URL and noisy warnings. If fallbackUrl is falsy, return the default
logo directly.

edge-apps/edge-apps-library/src/utils/theme.ts [213-222]

+if (!fallbackUrl) return defaultLogoUrl
+
 try {
   return await fetchLogoImage(fallbackUrl)
 } catch (err) {
   console.warn(
     'Failed to fetch logo image from fallback URL:',
     fallbackUrl,
     err,
   )
 }
 // Return default logo if all fetches fail
 return defaultLogoUrl
Suggestion importance[1-10]: 6

__

Why: This correctly prevents calling fetchLogoImage with an empty fallbackUrl, avoiding noisy warnings and unintended fetch behavior while keeping the new default-logo fallback semantics intact.

Low
Make SVG fallback URL-safe

Ensure the default SVG resolves to a URL string across build setups (some toolchains
import SVGs as modules/components, not a string). Construct the asset URL via new
URL(..., import.meta.url) to guarantee setupBrandingLogo() returns a string URL.

edge-apps/edge-apps-library/src/utils/theme.ts [2]

-import defaultLogoUrl from '../assets/images/screenly.svg'
+const defaultLogoUrl = new URL(
+  '../assets/images/screenly.svg',
+  import.meta.url,
+).toString()
Suggestion importance[1-10]: 4

__

Why: Using new URL(..., import.meta.url).toString() can improve portability across toolchains where SVG imports aren’t plain strings, but it’s somewhat build-system-dependent and may not be necessary if the current bundler already provides a URL string for screenly.svg.

Low

Previous suggestions

Suggestions up to commit 3cfa7ed
CategorySuggestion                                                                                                                                    Impact
General
Preserve optional logo semantics

Returning defaultLogoUrl through setupBranding() changes prior semantics where
logoUrl could be omitted, which may be used to detect "custom branding" elsewhere.
Preserve compatibility by only setting logoUrl when it’s not the default fallback.

edge-apps/edge-apps-library/src/utils/theme.ts [232-235]

 return {
   colors,
-  logoUrl,
+  logoUrl: logoUrl === defaultLogoUrl ? undefined : logoUrl,
 }
Suggestion importance[1-10]: 4

__

Why: This correctly identifies a potential behavior change: setupBranding() now always returns a logoUrl value, whereas previously it could be omitted via logoUrl: logoUrl || undefined. However, it’s speculative whether consumers rely on “missing logoUrl means unbranded,” and the PR may intentionally standardize on always returning a default, so the impact is moderate.

Low

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a built-in Screenly logo asset and updates branding utilities so brand-logo can fall back to a default logo when no custom logos are configured or when logo fetch attempts fail.

Changes:

  • Add screenly.svg to the library’s image assets.
  • Update setupBrandingLogo() to return the default logo when no logo is configured or when all fetch attempts fail.
  • Simplify setupBranding() to always return a defined logoUrl.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.

File Description
edge-apps/edge-apps-library/src/utils/theme.ts Imports the default SVG and updates branding logo fallback + return shape.
edge-apps/edge-apps-library/src/assets/images/screenly.svg Adds the default Screenly SVG logo asset.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nicomiguelino nicomiguelino marked this pull request as draft March 16, 2026 13:24
- Fix `!logoUrl` guard to `!fallbackUrl` in `setupBrandingLogo` to
  correctly detect unconfigured logos (logoUrl is always non-empty
  due to template literal construction)
- Update JSDoc to accurately reflect default logo fallback behavior
- Add tests for branding logo fallback cases (no logos configured,
  all fetches fail)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a built-in Screenly logo asset and uses it as a guaranteed fallback for branding logo resolution, so consumers (notably the brand-logo component) always have a usable logoUrl.

Changes:

  • Added screenly.svg to library assets and imported it as the default logo fallback.
  • Updated setupBrandingLogo() to return the default logo when no custom logo is configured or when all fetch attempts fail.
  • Simplified setupBranding() to always return a defined logoUrl, and added unit tests for the new fallback behavior.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
edge-apps/edge-apps-library/src/utils/theme.ts Imports the default Screenly logo and updates branding-logo fallback behavior / return shape.
edge-apps/edge-apps-library/src/utils/theme.test.ts Adds coverage for default-logo fallback cases in setupBrandingLogo().
edge-apps/edge-apps-library/src/assets/images/screenly.svg New default logo asset used as the fallback branding logo.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +199 to +203
fallbackUrl = darkLogo || lightLogo || ''
}

// Return early if logoUrl is empty
if (!logoUrl) return ''
// Return default logo if no logo is configured
if (!fallbackUrl) return defaultLogoUrl
- Treat any non-dark theme value as light to avoid skipping logo config
- Resolve primary/secondary logo in a single conditional instead of if/else if branches

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nicomiguelino nicomiguelino marked this pull request as ready for review March 16, 2026 23:04
@github-actions
Copy link

Persistent review updated to latest commit e3a6676

@github-actions
Copy link

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants