diff --git a/addon/extension.js b/addon/extension.js index 7bc32cc..a01811a 100644 --- a/addon/extension.js +++ b/addon/extension.js @@ -4,6 +4,7 @@ export default { injectBrandStyles(); replaceFavicon(); overrideAppName(appInstance); + removeFleetbaseWidgets(appInstance); universe.extensionManager.ensureEngineLoaded('@biibaye/branding'); }, @@ -67,6 +68,10 @@ function injectBrandStyles() { /* Dark theme background */ body[data-theme="dark"]{background-color:#343538!important} + + /* Hide Fleetbase-branded user menu links */ + .support-user-nav-item,.docs-user-nav-item{display:none!important} + a[href*="discord.gg"]{display:none!important} `; document.head.appendChild(style); } @@ -129,3 +134,24 @@ function updateMetaTags() { document.head.appendChild(meta); }); } + +function removeFleetbaseWidgets(appInstance) { + try { + const widgetService = appInstance.lookup('service:universe/widget-service'); + if (!widgetService || !widgetService.registry) return; + + const fleetbaseWidgetKeys = ['dashboard#fleetbase-blog', 'dashboard#fleetbase-github-card']; + + ['widget', 'default-widget'].forEach((listName) => { + const items = widgetService.registry.getRegistry('dashboard:widgets', listName); + const toRemove = items.filter( + (item) => item._registryKey && fleetbaseWidgetKeys.includes(item._registryKey) + ); + if (toRemove.length) { + items.removeObjects(toRemove); + } + }); + } catch (e) { + // widget service or registry not available yet + } +}