From 888599a7227a0d3d06be5498cdc4556b34f9e0f5 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Fri, 7 Jun 2024 17:56:28 -0600 Subject: [PATCH] app store widget fix --- .../app_store/app_store/src/http_api.rs | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index a6b761f6..e6c1696a 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -100,26 +100,28 @@ fn make_widget() -> String { .then(data => { const container = document.getElementById('latest-apps'); data.forEach(app => { - const a = document.createElement('a'); - a.className = 'app p-2 grow flex items-stretch rounded-lg shadow bg-white/10 hover:bg-white/20 font-sans cursor-pointer'; - a.href = `/main:app_store:sys/app-details/${app.package}:${app.publisher}` - a.target = '_blank'; - a.rel = 'noopener noreferrer'; - const iconLetter = app.metadata_hash.replace('0x', '')[0].toUpperCase(); - a.innerHTML = `
-
-

${app.metadata.name}

-

${app.metadata.description}

-
`; - container.appendChild(a); + if (app.metadata) { + const a = document.createElement('a'); + a.className = 'app p-2 grow flex items-stretch rounded-lg shadow bg-white/10 hover:bg-white/20 font-sans cursor-pointer'; + a.href = `/main:app_store:sys/app-details/${app.package}:${app.publisher}` + a.target = '_blank'; + a.rel = 'noopener noreferrer'; + const iconLetter = app.metadata_hash.replace('0x', '')[0].toUpperCase(); + a.innerHTML = `
+
+

${app.metadata.name}

+

${app.metadata.description}

+
`; + container.appendChild(a); + } }); }) .catch(error => console.error('Error fetching apps:', error));