@@ -17,6 +17,7 @@ import {
1717} from "./core/part_context.js" ;
1818
1919const DEFAULT_SOURCE_PART_LABEL = "Part" ;
20+ const SAMACSYS_PREVIEW_IMAGE_CLASS = "samacsys-preview-image" ;
2021const chromeApi = globalThis . chrome ;
2122const popupWindow = globalThis . window ;
2223const popupDocument = globalThis . document ;
@@ -75,6 +76,18 @@ function updateDownloadEnabled() {
7576 ! currentPartContext ?. provider || isBlockedProvider ( ) || ! hasSelection ( ) ;
7677}
7778
79+ function setPreviewProviderStyle ( partContext ) {
80+ const isSamacsysPreview = isSamacsysProviderShared ( partContext ?. provider ) ;
81+ symbolPreviewEl . classList . toggle (
82+ SAMACSYS_PREVIEW_IMAGE_CLASS ,
83+ isSamacsysPreview
84+ ) ;
85+ footprintPreviewEl . classList . toggle (
86+ SAMACSYS_PREVIEW_IMAGE_CLASS ,
87+ isSamacsysPreview
88+ ) ;
89+ }
90+
7891function setPreviewLoading ( fallbackEl , imgEl ) {
7992 fallbackEl . textContent = "Loading..." ;
8093 fallbackEl . classList . remove ( "hidden" ) ;
@@ -135,6 +148,7 @@ function setIdentifierDisplay(sourcePartLabel, sourcePartNumber, manufacturerPar
135148function setUnavailableDisplay ( statusMessage ) {
136149 currentPartContext = null ;
137150 currentSourceTabId = null ;
151+ setPreviewProviderStyle ( null ) ;
138152 sourcePartLabelEl . textContent = DEFAULT_SOURCE_PART_LABEL ;
139153 manufacturerPartNumberEl . textContent = "Unavailable" ;
140154 partNumberEl . textContent = "Unavailable" ;
@@ -211,6 +225,7 @@ function openSettingsPage() {
211225// Update UI state based on whether a supported provider was found.
212226function setPartContext ( partContext ) {
213227 currentPartContext = partContext ?. provider ? partContext : null ;
228+ setPreviewProviderStyle ( currentPartContext ) ;
214229
215230 if ( ! currentPartContext ) {
216231 setIdentifierDisplay ( DEFAULT_SOURCE_PART_LABEL , null , null ) ;
0 commit comments