Skip to content

Commit 5dedf0a

Browse files
Show empty Pinned section with hint; fix stale Recent card on launch (#70)
* show pinned section with empty hint when no pins exist Display the Pinned section on the dashboard even when no installations are pinned, with a hint message guiding users to right-click an install to pin it. Uses a computed to avoid ref unwrapping issues in templates. Amp-Thread-ID: https://ampcode.com/threads/T-019ca6df-24c7-750c-bbc0-fdefff59f674 Co-authored-by: Amp <amp@ampcode.com> * fix: pinned section hint and stale Recent card after launch - Replace v-else-if='!hasAnyPins' with v-else so the hint always renders when no pinned cards are visible - Add allPinsInQuickLaunch computed to show a distinct message when all pins are already displayed in Quick Launch - Broadcast installations-changed after lastLaunchedAt update so the dashboard Recent card refreshes immediately on launch Amp-Thread-ID: https://ampcode.com/threads/T-019ca83b-24f9-746a-a55b-d5392c404bc9 Co-authored-by: Amp <amp@ampcode.com> --------- Co-authored-by: Amp <amp@ampcode.com>
1 parent f98d649 commit 5dedf0a

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"setPrimary": "Set as Primary",
1616
"cloudSection": "ComfyUI Cloud",
1717
"pinned": "Pinned",
18+
"noPinned": "No pinned installations. Right-click an install to pin it to the dashboard.",
19+
"pinnedInQuickLaunch": "Pinned installations are already shown in Quick Launch above.",
1820
"pinToDashboard": "Pin to Dashboard",
1921
"unpinFromDashboard": "Unpin from Dashboard"
2022
},

locales/zh.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"setPrimary": "设为主要",
1717
"cloudSection": "ComfyUI 云",
1818
"pinned": "已固定",
19+
"noPinned": "没有固定的安装。右键单击安装以将其固定到仪表盘。",
20+
"pinnedInQuickLaunch": "已固定的安装已在上方的快速启动中显示。",
1921
"pinToDashboard": "固定到仪表盘",
2022
"unpinFromDashboard": "从仪表盘取消固定"
2123
},

src/main/lib/ipc.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,11 @@ function _broadcastToRenderer(channel: string, data: Record<string, unknown>): v
245245
function _addSession(installationId: string, { proc, port, url, mode, installationName }: Omit<SessionInfo, 'startedAt'>): void {
246246
_runningSessions.set(installationId, { proc, port, url, mode, installationName, startedAt: Date.now() })
247247
_broadcastToRenderer('instance-started', { installationId, port, url, mode, installationName })
248-
installations.update(installationId, { lastLaunchedAt: Date.now() }).catch((err) => {
249-
console.error('Failed to update lastLaunchedAt:', err)
250-
})
248+
installations.update(installationId, { lastLaunchedAt: Date.now() })
249+
.then(() => _broadcastToRenderer('installations-changed', {}))
250+
.catch((err) => {
251+
console.error('Failed to update lastLaunchedAt:', err)
252+
})
251253
}
252254

253255
function _removeSession(installationId: string): void {

src/renderer/src/assets/main.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ input[type="checkbox"]:checked::after { transform: translateX(16px); }
410410
.channel-preview-value { font-size: 13px; color: var(--text); }
411411
.channel-switch-btn { margin-top: 10px; }
412412
.channel-actions { display: flex; gap: 8px; margin-top: 10px; }
413+
.dashboard-empty-hint { font-size: 14px; color: var(--text-faint); padding: 12px 0; }
413414
.detail-item-list {
414415
background: var(--surface); border: 1px solid var(--border);
415416
border-radius: 8px; margin-bottom: 8px;

src/renderer/src/views/DashboardView.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ const pinnedInstalls = computed(() => {
8383
.filter((i): i is Installation => !!i && i.sourceCategory !== 'cloud' && !excludeIds.has(i.id))
8484
})
8585
86+
const allPinsInQuickLaunch = computed(() => {
87+
if (pinnedInstalls.value.length > 0) return false
88+
const quickLaunchIds = new Set<string>()
89+
if (primaryInstall.value) quickLaunchIds.add(primaryInstall.value.id)
90+
if (showLatestCard.value && latestInstall.value) quickLaunchIds.add(latestInstall.value.id)
91+
return prefs.pinnedInstallIds.value.some((id) => quickLaunchIds.has(id))
92+
})
93+
8694
// --- Actions for cards (separate generation counters) ---
8795
const primaryActions = ref<ListAction[]>([])
8896
const latestActions = ref<ListAction[]>([])
@@ -335,12 +343,12 @@ async function changePrimary(): Promise<void> {
335343
</div>
336344

337345
<!-- Pinned section -->
338-
<div v-if="pinnedInstalls.length > 0" class="dashboard-section">
346+
<div v-if="primaryInstall" class="dashboard-section">
339347
<div class="dashboard-section-label">
340348
<Pin :size="14" style="vertical-align: -2px; margin-right: 4px;" />
341349
{{ $t('dashboard.pinned') }}
342350
</div>
343-
<div class="dashboard-quick-launch">
351+
<div v-if="pinnedInstalls.length > 0" class="dashboard-quick-launch">
344352
<div
345353
v-for="pinned in pinnedInstalls"
346354
:key="pinned.id"
@@ -363,6 +371,9 @@ async function changePrimary(): Promise<void> {
363371
</DashboardCard>
364372
</div>
365373
</div>
374+
<div v-else class="dashboard-empty-hint">
375+
{{ $t(allPinsInQuickLaunch ? 'dashboard.pinnedInQuickLaunch' : 'dashboard.noPinned') }}
376+
</div>
366377
</div>
367378

368379
<!-- Cloud section -->

0 commit comments

Comments
 (0)