From cbaffa7513777a5e82fa64c1ad9c5f7dd683ec02 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Mon, 13 Jan 2025 18:34:02 -0500 Subject: [PATCH] fix app details, rearrange buttons --- kinode/packages/app-store/ui/src/index.css | 3 +- .../app-store/ui/src/pages/AppPage.tsx | 60 +++++++++------- .../app-store/ui/src/pages/MyAppsPage.tsx | 69 +++++++++++-------- 3 files changed, 78 insertions(+), 54 deletions(-) diff --git a/kinode/packages/app-store/ui/src/index.css b/kinode/packages/app-store/ui/src/index.css index ee8c62ad7..5e09f6351 100644 --- a/kinode/packages/app-store/ui/src/index.css +++ b/kinode/packages/app-store/ui/src/index.css @@ -376,7 +376,8 @@ div.app-header { .app-warning { background: var(--orange) !important; color: var(--text-light); - padding: 1em; + padding: 1rem; + margin-bottom: 1rem; } .app-description { diff --git a/kinode/packages/app-store/ui/src/pages/AppPage.tsx b/kinode/packages/app-store/ui/src/pages/AppPage.tsx index d8bd6f6a6..42d7f09c9 100644 --- a/kinode/packages/app-store/ui/src/pages/AppPage.tsx +++ b/kinode/packages/app-store/ui/src/pages/AppPage.tsx @@ -13,7 +13,7 @@ export default function AppPage() { const [installedApp, setInstalledApp] = useState(null); const [currentVersion, setCurrentVersion] = useState(null); const [latestVersion, setLatestVersion] = useState(null); - const [upToDate, setUpToDate] = useState(true); + const [upToDate, setUpToDate] = useState(false); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); const [isUninstalling, setIsUninstalling] = useState(false); @@ -133,23 +133,41 @@ export default function AppPage() { return (
- {app.metadata?.image && ( - {app.metadata?.name - )} -
-

{app.metadata?.name || app.package_id.package_name}

-

{`${app.package_id.package_name}:${app.package_id.publisher_node}`}

+
+ {app.metadata?.name +
+

{app.metadata?.name || app.package_id.package_name}

+
  • Installed: - {installedApp ? : } + + {installedApp ? : } +
  • - {currentVersion && ( -
  • Current Version: {currentVersion}
  • - )} + {installedApp &&
  • + Auto Update: + + {app.auto_update ? : } + +
  • } {latestVersion && ( -
  • Latest Version: {latestVersion}
  • + <> +
  • Version: {latestVersion}
  • + + )} + {currentVersion && latestVersion && currentVersion !== latestVersion && ( +
  • Installed Version: {currentVersion}
  • + )} + {currentVersion && latestVersion && currentVersion === latestVersion && ( +
  • Up to date: + {upToDate ? : } +
  • )} {installedApp?.pending_update_hash && (
  • @@ -158,17 +176,13 @@ export default function AppPage() {
  • )}
  • Publisher: {app.package_id.publisher_node}
  • - {app.metadata?.properties?.license ?
  • License: app.metadata?.properties?.license
  • : <>} -
  • - Auto Update: - - {app.auto_update ? : } - -
  • + {app.metadata?.properties?.license + ?
  • License: {app.metadata?.properties?.license}
  • + : <>}
- {valid_wit_version ? <> :
THIS APP MUST BE UPDATED TO 1.0
} + {valid_wit_version ? <> :
This app must be updated to 1.0
}
{installedApp && ( @@ -187,9 +201,9 @@ export default function AppPage() { )} - + {valid_wit_version && !upToDate && }
{app.metadata?.properties?.screenshots && ( diff --git a/kinode/packages/app-store/ui/src/pages/MyAppsPage.tsx b/kinode/packages/app-store/ui/src/pages/MyAppsPage.tsx index 10fede162..a3c797597 100644 --- a/kinode/packages/app-store/ui/src/pages/MyAppsPage.tsx +++ b/kinode/packages/app-store/ui/src/pages/MyAppsPage.tsx @@ -308,36 +308,45 @@ export default function MyAppsPage() { - {Object.values(installed).map((app) => { - const packageId = `${app.package_id.package_name}:${app.package_id.publisher_node}`; - const listing = listings?.[packageId]; - const isCore = CORE_PACKAGES.includes(packageId); - - if (isCore) return null; - - return ( - - - - - ); - })} + {(() => { + const userspaceApps = Object.values(installed).filter(app => !CORE_PACKAGES.includes(`${app.package_id.package_name}:${app.package_id.publisher_node}`)); + if (userspaceApps.length === 0) { + return ( + + + + ); + } + return userspaceApps.map((app) => { + const packageId = `${app.package_id.package_name}:${app.package_id.publisher_node}`; + const listing = listings?.[packageId]; + + return ( + + + + + ); + }); + })()}
- {listing ? ( - - {listing.metadata?.name || packageId} - - ) : ( - packageId - )} - - -
+ No apps installed yet! +
+ {listing ? ( + + {listing.metadata?.name || packageId} + + ) : ( + packageId + )} + + +