Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased — desktop help and next steps

- Add **Help** to the desktop sidebar, linking the guide, the Darkbloom Slack and GitHub Discussions, and offer **Get help** next to failures: failed operation notifications, an unreachable runtime, failed sign-in (beside **Try again**), and a failed runtime install or repair.

## Unreleased — desktop hardware load

- Serve real whole-machine load to the desktop app over the authenticated loopback control API: per-core CPU load with the chip's tier and cluster layout (including M5 Super cores), GPU utilization and memory, ANE activity, memory use and pressure, thermal state, and Darkbloom's share of GPU time. Sampling runs in the desktop API process only while the app is looking, without root, and never reaches heartbeats, logs or the coordinator.
Expand Down
10 changes: 9 additions & 1 deletion desktop-app/src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Onboarding } from './components/Onboarding';
import { onboardingScenario } from './previewEligibility';
import { Earnings } from './features/Earnings';
import { Appearance } from './components/Appearance';
import { GetHelp, HelpControl } from './components/Help';
import { AccountControl } from './components/AccountControl';
import { SocialLinks } from './components/SocialLinks';
const navigation = [
Expand Down Expand Up @@ -71,6 +72,7 @@ export default function App() {
))}
</nav>
<div className="sidebar-bottom">
<HelpControl version={backend.state.version} />
<SocialLinks />
<AccountControl backend={backend} />
</div>
Expand All @@ -89,7 +91,13 @@ export default function App() {
className={`page-content ${machineRoute ? 'machine-page' : route === 'home' ? 'home-page' : ''}`}
>
{backend.status.state !== 'ready' && (
<Notice>{backend.status.message || 'Connecting to this Mac…'}</Notice>
<Notice>
{backend.status.message || 'Connecting to this Mac…'}
{/* Waiting needs no next step; a runtime that can't be reached does. */}
{backend.status.state !== 'connecting' && backend.status.state !== 'installing' && (
<GetHelp />
)}
</Notice>
)}
{route === 'home' && (
<Home backend={backend} navigate={navigate} openMachine={openMachine} />
Expand Down
74 changes: 74 additions & 0 deletions desktop-app/src/renderer/components/Help.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { ArrowUpRight, LifeBuoy } from 'lucide-react';
import { useCallback, useState } from 'react';
import { createPortal } from 'react-dom';
import type { DesktopAPI } from '../../shared/contracts';
import { api } from '../useBackend';
import { External, Modal } from './UI';
import styles from './help.module.css';

const resources: {
target: Parameters<DesktopAPI['openExternal']>[0];
title: string;
description: string;
}[] = [
{
target: 'docs',
title: 'Read the guide',
description: 'Setting up, serving, earnings, and troubleshooting.',
},
{
target: 'slack',
title: 'Ask in Slack',
description: 'Get help from the Darkbloom team and other providers.',
},
{
target: 'community',
title: 'Community discussions',
description: 'Search questions and answers on GitHub, or ask your own.',
},
];

// The next step for a failure the app can't fix by itself: the guide covers troubleshooting.
export function GetHelp() {
return <External target="docs">Get help</External>;
}

export function HelpControl({ version }: { version?: string }) {
const [open, setOpen] = useState(false);
const close = useCallback(() => setOpen(false), []);
return (
<>
<button
className={styles.trigger}
aria-haspopup="dialog"
aria-label="Help"
onClick={() => setOpen(true)}
>
<LifeBuoy size={18} strokeWidth={1.55} />
<span>Help</span>
</button>
{open &&
createPortal(
<Modal title="Help" onClose={close}>
<ul className={styles.list}>
{resources.map(({ target, title, description }) => (
<li key={target}>
<button className={styles.item} onClick={() => void api?.openExternal(target)}>
<span>
<strong>{title}</strong>
<small>{description}</small>
</span>
<ArrowUpRight size={15} />
</button>
</li>
))}
</ul>
{version && (
<p className={styles.version}>When you ask, mention Darkbloom {version}.</p>
)}
</Modal>,
document.body,
)}
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ArrowUpRight, Check, Copy, LoaderCircle } from 'lucide-react';
import { useState } from 'react';
import type { Operation } from '../../../shared/contracts';
import { api, type BackendState } from '../../useBackend';
import { GetHelp } from '../Help';
import styles from './account.module.css';

export function AccountSignInProgress({
Expand Down Expand Up @@ -74,9 +75,16 @@ export function AccountSignInProgress({
{backend.error}
</p>
)}
<button className="button primary" disabled={backend.busy || submitting} onClick={onRetry}>
Try again
</button>
<footer className={styles.signInActions}>
<button
className="button primary"
disabled={backend.busy || submitting}
onClick={onRetry}
>
Try again
</button>
<GetHelp />
</footer>
</div>
);
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@
width: 100%;
justify-content: center;
}
.signInActions > :global(.quiet) {
.signInActions > :global(.quiet),
.signInActions > :global(.text-link) {
justify-self: center;
}

Expand Down
79 changes: 79 additions & 0 deletions desktop-app/src/renderer/components/help.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
.trigger {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
min-height: 38px;
margin-bottom: 10px;
padding: 9px 14px;
border-radius: 6px;
color: var(--text-secondary);
font-size: 13px;
text-align: left;
-webkit-app-region: no-drag;
transition:
background 0.16s,
color 0.16s;
}
.trigger:hover {
background: rgba(var(--contrast-rgb), 0.027);
color: var(--text-primary);
}
.list {
display: grid;
gap: 8px;
margin: 18px 0 0;
padding: 0;
list-style: none;
}
.item {
display: flex;
align-items: center;
gap: 16px;
width: 100%;
padding: 13px 14px;
border: 1px solid var(--line);
border-radius: 8px;
text-align: left;
transition:
background var(--hover-duration),
border-color var(--hover-duration);
}
.item:hover {
border-color: rgba(var(--contrast-rgb), 0.2);
background: rgba(var(--contrast-rgb), 0.03);
}
.item > span {
flex: 1;
min-width: 0;
}
.item strong {
display: block;
font-size: 13px;
font-weight: 500;
}
.item small {
display: block;
margin-top: 4px;
color: var(--muted);
font-size: 11px;
}
.item > svg {
flex-shrink: 0;
color: var(--muted);
}
.list ~ .version {
margin: 16px 0 0;
color: var(--muted);
font-size: 11px;
}
@media (max-width: 760px) {
.trigger {
justify-content: center;
gap: 0;
padding: 12px;
}
.trigger > span {
display: none;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Download } from 'lucide-react';
import { useState } from 'react';
import type { BackendState } from '../../useBackend';
import { api } from '../../useBackend';
import { GetHelp } from '../Help';
import { Button, Notice } from '../UI';

export function RuntimeSetup({ backend }: { backend: BackendState }) {
Expand All @@ -28,6 +29,11 @@ export function RuntimeSetup({ backend }: { backend: BackendState }) {
<Button variant="primary" disabled={!api} onClick={() => void install()}>
<Download size={16} /> {missing ? 'Install runtime' : 'Repair runtime'}
</Button>
{error && (
<p className="get-help">
<GetHelp />
</p>
)}
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Check, LoaderCircle, X } from 'lucide-react';
import { createPortal } from 'react-dom';
import type { Operation } from '../../../shared/contracts';
import { GetHelp } from '../Help';

export function OperationToast({
state,
Expand All @@ -15,11 +16,12 @@ export function OperationToast({
onCancel?: () => void;
onClose?: () => void;
}) {
const failed = state === 'failed' || state === 'interrupted';
return createPortal(
<aside
className={`operation ${state}`}
aria-label="Operation notification"
role={state === 'failed' || state === 'interrupted' ? 'alert' : 'status'}
role={failed ? 'alert' : 'status'}
>
{state === 'running' ? (
<LoaderCircle className="spin" size={17} />
Expand All @@ -32,6 +34,7 @@ export function OperationToast({
<summary>{title}</summary>
<pre>{message}</pre>
</details>
{failed && <GetHelp />}
{onCancel && (
<button className="button quiet" onClick={onCancel}>
Cancel
Expand Down
10 changes: 10 additions & 0 deletions desktop-app/src/renderer/styles/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@
color: var(--text-primary);
}

/* Space a failure's Get help link from the full-width action above it. */
.get-help {
margin-top: 14px;
}

.text-link:not(.back):not(:disabled):hover svg:last-child {
transform: translateX(2px);
}
Expand Down Expand Up @@ -236,6 +241,11 @@
margin-bottom: 0;
}

.operation > .text-link {
font-size: 11px;
white-space: nowrap;
}

.operation > .button {
padding: 0 6px;
min-height: 18px;
Expand Down
Loading
Loading