Skip to content

Commit

Permalink
improve widget, adjust nav bar
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-frmr committed Jan 7, 2025

Verified

This commit was signed with the committer’s verified signature.
1 parent 1bd2fc5 commit 402cf40
Showing 3 changed files with 22 additions and 4 deletions.
20 changes: 19 additions & 1 deletion kinode/packages/app-store/app-store/src/http_api.rs
Original file line number Diff line number Diff line change
@@ -90,6 +90,11 @@ fn make_widget() -> String {
overflow: hidden;
}
h3 {
padding-left: 1rem;
padding-top: 8px;
}
#latest-apps {
display: flex;
flex-wrap: wrap;
@@ -99,7 +104,7 @@ fn make_widget() -> String {
height: 100vh;
width: 100vw;
overflow-y: auto;
padding-bottom: 30px;
padding-bottom: 4rem;
}
.app {
@@ -143,6 +148,7 @@ fn make_widget() -> String {
</style>
</head>
<body>
<h3>Top Apps</h3>
<div id="latest-apps"></div>
<script>
document.addEventListener('DOMContentLoaded', function() {
@@ -152,6 +158,18 @@ fn make_widget() -> String {
.then(data => {
const container = document.getElementById('latest-apps');
container.innerHTML = '';
// Sort to ensure dial, memedeck, dartfrog are first in that order
const topApps = ['dial', 'memedeck', 'dartfrog'];
data.sort((a, b) => {
const aIndex = topApps.indexOf(a.package_id.package_name);
const bIndex = topApps.indexOf(b.package_id.package_name);
if (aIndex !== -1 && bIndex !== -1) {
return aIndex - bIndex;
}
if (aIndex !== -1) return -1;
if (bIndex !== -1) return 1;
return 0;
});
data.forEach(app => {
if (app.metadata) {
const a = document.createElement('a');
4 changes: 2 additions & 2 deletions kinode/packages/app-store/ui/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -18,12 +18,12 @@ const Header: React.FC = () => {
<button onClick={() => window.location.href = window.location.origin.replace('//app-store-sys.', '//') + '/'} className="home-button">
<FaHome />
</button>
<Link to={STORE_PATH} className={location.pathname === STORE_PATH ? 'active' : ''}>Apps</Link>
<Link to={PUBLISH_PATH} className={location.pathname === PUBLISH_PATH ? 'active' : ''}>Publish</Link>
<Link to={STORE_PATH} className={location.pathname === STORE_PATH ? 'active' : ''}>Store</Link>
<Link to={MY_APPS_PATH} className={location.pathname === MY_APPS_PATH ? 'active' : ''}>
My Apps
{updateCount > 0 && <span className="update-badge">{updateCount}</span>}
</Link>
<Link to={PUBLISH_PATH} className={location.pathname === PUBLISH_PATH ? 'active' : ''}>Publish</Link>
</nav>
</div>
<div className="header-right">
2 changes: 1 addition & 1 deletion kinode/packages/app-store/ui/src/index.css
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ a:hover {

.header-left nav {
display: flex;
gap: 1rem;
gap: 1.5rem;
}

.header-left nav a {

0 comments on commit 402cf40

Please sign in to comment.