Feat v0.2.4: SDK Topbar, Schedules surface, manifest icons, UserMenu cleanup

Shell navigation:
- sw.shell.Topbar — composable nav bar (title + slot + bell + user menu)
- Topbar CSS in sw-shell.css, wired into SDK via dynamic import

Schedules surface (packages/schedules/):
- Wraps kernel /api/v1/schedules CRUD + run + logs
- Table view with cron badge, human-readable preview, enable toggle
- Create/edit dialog with live cron-to-english preview

Manifest icons:
- icon field in manifest.json (emoji string)
- Surfaces API returns icon from package manifest
- UserMenu renders per-surface icons

UserMenu cleanup:
- Removed dead Chat/Notes/Projects hardcoded links
- Menu now driven by /api/v1/surfaces API (installed surfaces only)
- Core surfaces filtered via CORE_IDS set

Bug fixes:
- isAdmin() in can.js now checks surface.admin.access RBAC grant
  instead of deprecated user.role column (v0.2.0 regression)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-27 10:16:37 +00:00
parent 57ccf19efb
commit 22c70034c6
25 changed files with 2212 additions and 37 deletions

View File

@@ -0,0 +1,277 @@
/* ── Schedules Surface ───────────────────── */
.sched-app {
display: flex;
flex-direction: column;
height: 100%;
background: var(--bg);
color: var(--text);
}
.sched-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
border-bottom: 1px solid var(--border);
}
.sched-header h1 {
font-size: 1rem;
font-weight: 600;
margin: 0;
}
.sched-body {
flex: 1;
overflow: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 16px;
}
.sched-count {
font-size: 0.8rem;
color: var(--text-3);
}
/* ── Table ────────────────────────────────── */
.sched-list__loading,
.sched-list__empty {
padding: 40px 16px;
text-align: center;
color: var(--text-3);
font-size: 0.85rem;
}
.sched-table {
width: 100%;
border-collapse: collapse;
font-size: 0.85rem;
}
.sched-table th {
text-align: left;
padding: 8px 12px;
font-weight: 600;
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-3);
border-bottom: 1px solid var(--border);
}
.sched-table td {
padding: 10px 12px;
border-bottom: 1px solid var(--border);
vertical-align: top;
}
.sched-row:hover {
background: var(--bg-hover);
}
.sched-row__name { min-width: 160px; }
.sched-link {
background: none;
border: none;
color: var(--accent);
cursor: pointer;
font-weight: 500;
font-size: 0.85rem;
padding: 0;
text-align: left;
}
.sched-link:hover { text-decoration: underline; }
.sched-row__desc {
font-size: 0.75rem;
color: var(--text-3);
margin-top: 2px;
}
.sched-row__cron { white-space: nowrap; }
.sched-cron-badge {
font-family: monospace;
font-size: 0.8rem;
background: var(--bg-raised);
padding: 2px 6px;
border-radius: 4px;
color: var(--text-2);
}
.sched-cron-human {
font-size: 0.75rem;
color: var(--text-3);
margin-top: 2px;
}
.sched-row__next {
font-size: 0.8rem;
color: var(--text-2);
white-space: nowrap;
}
.sched-row__actions {
display: flex;
gap: 4px;
white-space: nowrap;
}
/* ── Toggle button ────────────────────────── */
.sched-toggle-btn {
font-size: 0.75rem;
font-weight: 600;
padding: 2px 10px;
border-radius: 10px;
border: 1px solid var(--border);
cursor: pointer;
transition: background 0.15s, color 0.15s;
}
.sched-toggle-btn--on {
background: var(--success);
color: #fff;
border-color: var(--success);
}
.sched-toggle-btn--off {
background: var(--bg-raised);
color: var(--text-3);
}
.sched-toggle-btn:hover { opacity: 0.85; }
/* ── Action buttons ───────────────────────── */
.sched-btn {
background: none;
border: 1px solid var(--border);
color: var(--text-2);
border-radius: 4px;
cursor: pointer;
transition: background 0.15s;
}
.sched-btn:hover { background: var(--bg-hover); }
.sched-btn--sm {
padding: 3px 8px;
font-size: 0.8rem;
}
.sched-btn--danger:hover {
background: var(--danger-dim);
color: var(--danger);
border-color: var(--danger);
}
/* ── Form ─────────────────────────────────── */
.sched-form { display: flex; flex-direction: column; gap: 12px; }
.sched-form__row { display: flex; align-items: center; gap: 12px; }
.sched-form__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.sched-cron-input {
font-family: monospace;
}
.sched-cron-preview {
font-size: 0.8rem;
color: var(--accent);
margin-top: 4px;
font-style: italic;
}
.sched-script {
font-family: monospace;
font-size: 0.85rem;
resize: vertical;
}
.sched-toggle {
display: flex;
align-items: center;
gap: 8px;
font-size: 0.85rem;
cursor: pointer;
}
/* ── Logs panel ───────────────────────────── */
.sched-logs {
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: 8px;
overflow: hidden;
}
.sched-logs__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
border-bottom: 1px solid var(--border);
font-size: 0.85rem;
font-weight: 600;
}
.sched-logs__loading,
.sched-logs__empty {
padding: 20px 12px;
text-align: center;
color: var(--text-3);
font-size: 0.8rem;
}
.sched-log-entry {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 12px;
border-bottom: 1px solid var(--border);
font-size: 0.8rem;
}
.sched-log-entry:last-child { border-bottom: none; }
.sched-log-entry__status {
font-weight: 700;
width: 18px;
text-align: center;
}
.sched-log-entry__status--ok { color: var(--success); }
.sched-log-entry__status--fail { color: var(--danger); }
.sched-log-entry__time {
color: var(--text-2);
white-space: nowrap;
}
.sched-log-entry__duration {
color: var(--text-3);
font-family: monospace;
font-size: 0.75rem;
}
.sched-log-entry__error {
color: var(--danger);
font-size: 0.75rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 300px;
}
/* ── Responsive ───────────────────────────── */
@media (max-width: 768px) {
.sched-table th:nth-child(3),
.sched-table td:nth-child(3) {
display: none;
}
.sched-body { padding: 8px; }
}