Skip to content

Commit 98875b2

Browse files
committed
Add nest icon to sidebar server cards and move status dot layout
1 parent 96fec9e commit 98875b2

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

public/css/style.css

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,8 +1070,6 @@ cap-widget {
10701070
position: relative;
10711071
z-index: 2;
10721072
white-space: nowrap;
1073-
overflow: hidden;
1074-
text-overflow: ellipsis;
10751073
}
10761074

10771075
.nav-sub-item:hover {
@@ -1083,6 +1081,19 @@ cap-widget {
10831081
color: var(--accent-1);
10841082
}
10851083

1084+
.nav-sub-server-name {
1085+
flex: 1;
1086+
overflow: hidden;
1087+
text-overflow: ellipsis;
1088+
}
1089+
1090+
.nav-sub-nest-icon {
1091+
flex-shrink: 0;
1092+
display: flex;
1093+
align-items: center;
1094+
margin-left: auto;
1095+
}
1096+
10861097
.nav-sub-item .nav-sub-dot {
10871098
width: 6px;
10881099
height: 6px;

public/js/app.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,13 @@ function initSidebarTooltip() {
16721672
});
16731673
}
16741674

1675+
function renderNestLogoSmall(logo) {
1676+
if (!logo) return html`<i data-lucide="box" style="width:14px;height:14px;opacity:0.4"></i>`;
1677+
if (logo.startsWith('si:')) return html`<img src="${siUrl(logo.slice(3))}" alt="" style="width:14px;height:14px;opacity:0.5" />`;
1678+
if (logo.startsWith('lucide:')) return html`<i data-lucide="${logo.slice(7)}" style="width:14px;height:14px;opacity:0.5"></i>`;
1679+
return html`<img src="${logo}" alt="" style="width:14px;height:14px;opacity:0.5;border-radius:2px" />`;
1680+
}
1681+
16751682
function buildServerSubList() {
16761683
if (state.sidebarServersLoading) return html`<div class="nav-sub-empty"><span class="spinner"></span> Loading...</div>`;
16771684
if (state.servers.length === 0) return html`<div class="nav-sub-empty">No servers</div>`;
@@ -1683,7 +1690,8 @@ function buildServerSubList() {
16831690
return html`
16841691
<a class="nav-sub-item ${isActive ? 'active' : ''}" data-server-nav="${s.id}" href="/server/${s.id}">
16851692
<span class="nav-sub-dot ${dotClass}"></span>
1686-
${escapeHtml(s.name)}
1693+
<span class="nav-sub-server-name">${escapeHtml(s.name)}</span>
1694+
<span class="nav-sub-nest-icon">${renderNestLogoSmall(s.nestLogo)}</span>
16871695
</a>
16881696
`;
16891697
}).join('');

routes/servers.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ router.get('/list', authenticateToken, async (req, res) => {
9696
}
9797
}
9898

99+
const nestRows = await query('SELECT ptero_nest_id, logo FROM nests').catch(() => []);
100+
const nestLogoMap = {};
101+
for (const nr of nestRows) nestLogoMap[nr.ptero_nest_id] = nr.logo || null;
102+
for (const s of servers) {
103+
s.nestLogo = nestLogoMap[s.nest] || null;
104+
}
105+
99106
// Fetch live power state from Pyrodactyl Client API
100107
const userRows = await query('SELECT ptero_client_api_key FROM users WHERE id = ?', [req.user.userId]);
101108
const clientApiKey = userRows[0]?.ptero_client_api_key;

0 commit comments

Comments
 (0)