fix(shell): tidy the backend popover actions

About doona and Edit backend become two buttons on one end-aligned row, with Edit backend as the filled secondary button. The project page link is dropped; About already links to it.
This commit is contained in:
Zakk committed 2026-09-26 21:23:51 +10:00
1 parent c20b062e9d
commit bee9195da7
8 files changed
+10 -28

No files matched your search

-1
View File
@@ -14,7 +14,6 @@ test('the backend indicator shows the facts, opens About doona and closes on Esc
await indicator.click();
const popover = page.getByRole('dialog', {name: engine});
for (const fact of ['Connected', 'API', 'Build', 'Backend URL', 'Built-in demo data']) await expect(popover).toContainText(fact);
await expect(popover.getByRole('link', {name: `${version.engine.name} project page`})).toHaveAttribute('href', new RegExp(`/${version.engine.name}$`));
await page.keyboard.press('Escape');
await expect(popover).toBeHidden();
await expect(indicator).toBeFocused();
-1
View File
@@ -1184,7 +1184,6 @@ export const messages = {
'shell.backend.offline': 'Unreachable',
'shell.backend.degraded': 'Connected, version unknown',
'shell.backend.edit': 'Edit backend',
'shell.backend.project': '{engine} project page',
'palette.rosePine': 'Rosé Pine',
'palette.moon': 'Moon',
'palette.dawnMain': 'Dawn / Main',
-1
View File
@@ -1158,7 +1158,6 @@ export const messages = {
'shell.backend.offline': '无法连接',
'shell.backend.degraded': '已连接,版本未知',
'shell.backend.edit': '编辑后端',
'shell.backend.project': '{engine} 项目页面',
'palette.rosePine': 'Rosé Pine',
'palette.moon': 'Moon',
'palette.dawnMain': 'Dawn / Main',
-1
View File
@@ -1157,7 +1157,6 @@ export const messages = {
'shell.backend.offline': '無法連線',
'shell.backend.degraded': '已連線,版本不明',
'shell.backend.edit': '編輯後端',
'shell.backend.project': '{engine} 專案頁面',
'palette.rosePine': 'Rosé Pine',
'palette.moon': 'Moon',
'palette.dawnMain': 'Dawn / Main',
+5 -9
View File
@@ -1,20 +1,16 @@
import {useState, type ReactElement, type RefObject} from 'react';
import {Button, Divider, Kv, Light, Link, PopoverDialog} from '../ui/ui';
import {Button, Kv, Light, Link, PopoverDialog} from '../ui/ui';
import {About} from './About';
import type {BackendView} from './view';
// A hover card of what the shell knows about the backend, then editing it in Settings, About doona and the engine's
// project page as menu rows.
// A hover card of what the shell knows about the backend, then two buttons: About doona, and editing the backend in
// Settings as the main action. The engine's project page is in About, so it is not repeated here.
// The About action closes the popover before the dialog opens, so focus has one place to return to.
function BackendFacts({backend, close, openAbout}: {backend: BackendView; close: () => void; openAbout: () => void}) {
return (
<>
<Kv row items={backend.facts} />
<Divider orientation="horizontal" />
<div className="rp-backend-actions">
<Link appearance="button" quiet href={backend.edit.href} onPress={close}>
{backend.edit.label}
</Link>
<Button
quiet
onPress={() => {
@@ -24,8 +20,8 @@ function BackendFacts({backend, close, openAbout}: {backend: BackendView; close:
>
{backend.about}
</Button>
<Link appearance="button" quiet href={backend.project.href} external>
{backend.project.label}
<Link appearance="button" href={backend.edit.href} onPress={close}>
{backend.edit.label}
</Link>
</div>
</>
-3
View File
@@ -109,7 +109,6 @@ export const messages = defineMessages({
'shell.backend.offline': '無法連線',
'shell.backend.degraded': '已連線,版本不明',
'shell.backend.edit': '編輯後端',
'shell.backend.project': '{engine} 專案頁面',
'palette.rosePine': 'Rosé Pine',
'palette.moon': 'Moon',
'palette.dawnMain': 'Dawn / Main',
@@ -252,7 +251,6 @@ export const messages = defineMessages({
'shell.backend.offline': '无法连接',
'shell.backend.degraded': '已连接,版本未知',
'shell.backend.edit': '编辑后端',
'shell.backend.project': '{engine} 项目页面',
'palette.rosePine': 'Rosé Pine',
'palette.moon': 'Moon',
'palette.dawnMain': 'Dawn / Main',
@@ -395,7 +393,6 @@ export const messages = defineMessages({
'shell.backend.offline': 'Unreachable',
'shell.backend.degraded': 'Connected, version unknown',
'shell.backend.edit': 'Edit backend',
'shell.backend.project': '{engine} project page',
'palette.rosePine': 'Rosé Pine',
'palette.moon': 'Moon',
'palette.dawnMain': 'Dawn / Main',
+1 -4
View File
@@ -47,7 +47,6 @@ export type BackendView = {
facts: Array<[string, string]>;
about: string;
edit: {href: string; label: string};
project: {href: string; label: string};
};
export type PaletteSection = {title: string; items: Array<{id: string; label: string; desc?: string; className?: string}>};
export type AppearanceMenu = ReturnType<typeof appearanceMenu>;
@@ -113,7 +112,6 @@ export function shellView(
const build = version?.build?.revision ? ` (${version.build.revision.slice(0, 12)})` : '';
const apiText = version ? t('ui.apiVersion', {name: version.api.name, major: version.api.major, status: version.api.status}) : '—';
const contractText = import.meta.env.VITE_DOONA_CONTRACT_COMMIT;
const engineName = version?.engine.name ?? org.split('/').pop()!;
const api = profile?.api;
const address = isDemoApi(api) ? t('shell.backend.demo') : api;
const [tone, stateKey] = backendState(needsLogin, !capabilities && !capabilityError, capabilityError, versionError);
@@ -155,8 +153,7 @@ export function shellView(
...fact(t('shell.backend.profile'), profile?.name)
],
about: t('about.title'),
edit: {href: href('settings', {card: 'backend'}), label: t('shell.backend.edit')},
project: {href: version ? `${org}/${version.engine.name}` : org, label: t('shell.backend.project', {engine: engineName})}
edit: {href: href('settings', {card: 'backend'}), label: t('shell.backend.edit')}
},
shortcuts,
shortcutPaths: Object.fromEntries(shortcuts.map(item => [item.key, item.path])),
+4 -8
View File
@@ -393,14 +393,10 @@
/* The actions read as menu rows: full width, their text at the start edge, in line with the facts. */
.rp-backend-actions {
display: flex;
flex-direction: column;
margin-inline: -8px;
margin-block-end: -8px;
}
.rp-backend-actions > .rp-btn {
justify-content: flex-start;
inline-size: 100%;
padding-inline: 8px;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
margin-block-start: 8px;
}
.rp-main {
margin-inline-end: 0;