From feee8df94e7fe225707704a72e986abd2e1e07cd Mon Sep 17 00:00:00 2001 From: Zakk Date: Fri, 30 Oct 2026 08:17:49 +0000 Subject: [PATCH] feat(shell): add a bug-report button that opens the issue tracker Show a bug icon first among the standard top-bar actions and in lite's sidebar footer. It opens the doona issue list in a new tab; the issue chooser routes backend problems to honk or dae. --- apps/lite/UI-RULES.md | 2 +- apps/lite/scripts/features-routing.cjs | 3 +- apps/lite/scripts/layout-rhythm.cjs | 32 +++++++++ apps/lite/src/AboutDialog.tsx | 95 ++++++++++++++++++++++++++ apps/lite/src/CopyMembers.tsx | 2 + apps/lite/src/DnsUpstreams.tsx | 5 +- apps/lite/src/GroupEditPanel.tsx | 4 +- apps/lite/src/GroupInspector.tsx | 4 +- apps/lite/src/Groups.tsx | 2 +- apps/lite/src/Nodes.tsx | 11 ++- apps/lite/src/RuleList.tsx | 12 +++- apps/lite/src/Shell.tsx | 13 +++- apps/lite/src/Subscriptions.tsx | 2 +- apps/lite/src/docs.ts | 5 +- apps/lite/src/i18n/en.ts | 13 ++++ apps/lite/src/i18n/zh-CN.ts | 13 ++++ apps/lite/src/i18n/zh-TW.ts | 13 ++++ apps/lite/src/themes/site/site.css | 1 + apps/lite/src/themes/site/site.js | 1 + apps/lite/src/themes/site/siteTheme.ts | 5 +- apps/lite/src/ui/ReportShortcut.tsx | 23 +++++++ apps/lite/src/ui/icons/Bug.tsx | 14 ++++ apps/lite/src/ui/icons/index.ts | 1 + changes/feat-about-report-links.md | 5 ++ e2e/keyboard.spec.ts | 2 +- e2e/mobile.spec.ts | 9 ++- e2e/single-entry-shell.spec.ts | 40 +++++++++++ src/api/problemReport.ts | 1 + src/i18n/locales/en.json | 1 + src/i18n/locales/zh-CN.json | 1 + src/i18n/locales/zh-TW.json | 1 + src/shell/TopBar.tsx | 7 +- src/ui/Link.tsx | 15 +++- src/ui/icons/Bug.tsx | 14 ++++ 34 files changed, 346 insertions(+), 26 deletions(-) create mode 100644 apps/lite/src/AboutDialog.tsx create mode 100644 apps/lite/src/ui/ReportShortcut.tsx create mode 100644 apps/lite/src/ui/icons/Bug.tsx create mode 100644 changes/feat-about-report-links.md create mode 100644 src/api/problemReport.ts create mode 100644 src/ui/icons/Bug.tsx diff --git a/apps/lite/UI-RULES.md b/apps/lite/UI-RULES.md index 5d50fcd2..d19473b7 100644 --- a/apps/lite/UI-RULES.md +++ b/apps/lite/UI-RULES.md @@ -21,7 +21,7 @@ Changes must satisfy these rules and the browser checks in the same milestone. ## 2. Components and actions - Primary and destructive buttons share the other controls' 8 px element radius, never pills. Existing borders use the emphasized border token. Ghost and icon-only buttons stay borderless. Segmented controls use size md everywhere: the 36 px frame matches the size md action button and the selected segment sits inset on the track; size tokens stay unchanged. -- Selected routing cards, group rows and segmented thumbs use a 1 px emphasized neutral border and a subtle neutral tint, without an extra ring or selection bar. Selected navigation items use neutral fills and icons. Duck yellow is reserved for keyboard focus rings; decorative artwork and search highlights are neutral, and warnings use orange. Primary buttons use a dark neutral fill with light text in light mode, and a light neutral fill with dark text in dark mode. Destructive actions keep their red tone. Sidebar and content share white in light mode and the same dark surface in dark mode; cards and overlays retain their own surface tokens. +- Selected routing cards, group rows and segmented thumbs use a 1 px emphasized neutral border and a subtle neutral tint, without an extra ring or selection bar. Selected navigation items use neutral fills and icons. Focus uses Astryx's default accent, never yellow or mustard; decorative artwork and search highlights are neutral, and warnings use orange. Primary buttons use a dark neutral fill with light text in light mode, and a light neutral fill with dark text in dark mode. Destructive actions keep their red tone. Sidebar and content share white in light mode and the same dark surface in dark mode; cards and overlays retain their own surface tokens. - Same job, same component: TextInput for search, Selector for a scalar choice, Tokenizer/Token for removable values, CheckboxInput for text mode, MoreMenu `variant="ghost" size="sm"` for row actions. Loading text uses `ui/LoadingText`, forwarding Text props while retaining its measured content; its `loadingControl` export supplies overlays through existing control slots without wrapper DOM. - Settings uses TabList/Tab for narrow panel navigation and SideNav for wide navigation. Keep the package's default overflow handling, tab/panel associations and keyboard focus; disable tabs with `aria-disabled` while validation, review or apply blocks section changes. - A list toolbar is `CollectionToolbar`: optional search/filter at the start; text-mode toggle and Add together at the end, `gap={pageRhythm.controls}` with whole-control wrapping. Every control uses size md; labels stay on one line. Sort triggers show only the value and retain an accessible Sort label. Search and the first collection row share their start inset. Add is the primary action of that list until a page draft exists; Review changes then becomes the page's only primary. diff --git a/apps/lite/scripts/features-routing.cjs b/apps/lite/scripts/features-routing.cjs index 258ffc95..3006025c 100644 --- a/apps/lite/scripts/features-routing.cjs +++ b/apps/lite/scripts/features-routing.cjs @@ -233,7 +233,8 @@ async function download(p, action) { } await p.locator('[data-backend-status]').click(); await shot(p, 'status-export'); - await expect(p.getByRole('menuitem').last()).toHaveText(l.export); + // About follows the backend actions; export stays the last of them. + expect((await p.getByRole('menuitem').allTextContents()).map(text => text.trim()).at(-2)).toBe(l.export); expect(await download(p, () => p.getByRole('menuitem', {name: l.export, exact: true}).click())).toBe(content); await p.getByRole('button', {name: l.add, exact: true}).click(); const form = p.getByRole('dialog'); diff --git a/apps/lite/scripts/layout-rhythm.cjs b/apps/lite/scripts/layout-rhythm.cjs index 9fffad83..94492c95 100644 --- a/apps/lite/scripts/layout-rhythm.cjs +++ b/apps/lite/scripts/layout-rhythm.cjs @@ -71,6 +71,25 @@ async function controls(p) { } } } +async function aboutDialog(p, locale) { + await p.locator('[data-backend-status]').click(); + await p.getByRole('menuitem', {name: locale === 'en' ? 'About doona' : '关于 doona', exact: true}).click(); + const dialog = p.getByRole('dialog'); + await expect(dialog).toBeVisible(); + // Opening focuses the dialog's own close control, never a link inside it. + await expect.poll(() => p.evaluate(() => document.activeElement?.tagName)).not.toBe('A'); + // The report button lives in the sidebar footer, not here. + await expect(dialog.getByRole('link')).toHaveCount(3); + const hrefs = [`https://doona.daeuniverse.org/${locale}/`, 'https://github.com/Zakkaus/doona', 'https://github.com/Zakkaus/doona/releases']; + for (const [index, href] of hrefs.entries()) { + const link = dialog.getByRole('link').nth(index); + await expect(link).toHaveAttribute('href', href); + await expect(link).toHaveAttribute('target', '_blank'); + await expect(link).toHaveAttribute('rel', /noopener noreferrer/); + } + await p.keyboard.press('Escape'); + await expect(dialog).toHaveCount(0); +} async function footer(p, width, locale) { if (width === 390) { await p.getByRole('button', {name: locale === 'en' ? 'Open navigation' : '打开导航', exact: true}).click(); @@ -84,6 +103,18 @@ async function footer(p, width, locale) { b = await language.boundingBox(); expect(Math.abs(a.height - b.height)).toBeLessThanOrEqual(1); expect(Math.abs(a.y - b.y)).toBeLessThanOrEqual(1); + const report = nav.getByRole('link', {name: locale === 'en' ? 'Report a problem' : '报告问题', exact: true}); + await expect(report).toHaveCount(1); + await expect(report).toBeVisible(); + await expect(report).toHaveAttribute('href', 'https://github.com/Zakkaus/doona/issues'); + await expect(report).toHaveAttribute('target', '_blank'); + await expect(report).toHaveAttribute('rel', 'noopener noreferrer'); + await expect(report).toHaveText(''); + await expect(report.locator('svg')).toBeVisible(); + const c = await report.boundingBox(); + expect(Math.abs(a.height - c.height)).toBeLessThanOrEqual(1); + expect(Math.abs(a.y - c.y)).toBeLessThanOrEqual(1); + expect(c.x).toBeGreaterThan(b.x); if (width === 1440) { const collapse = await nav.getByRole('button', {name: locale === 'en' ? 'Collapse sidebar' : '折叠侧边栏', exact: true}).boundingBox(); expect(Math.abs(a.height - collapse.height)).toBeLessThanOrEqual(1); @@ -322,6 +353,7 @@ async function subscriptionActionInset(p) { ); await p.goto(base); await waitForDemo(p); + if (width === 1440) await aboutDialog(p, locale); const rhythm = []; for (const route of routes) { await p.evaluate(route => (location.hash = route), route); diff --git a/apps/lite/src/AboutDialog.tsx b/apps/lite/src/AboutDialog.tsx new file mode 100644 index 00000000..5ff8906c --- /dev/null +++ b/apps/lite/src/AboutDialog.tsx @@ -0,0 +1,95 @@ +import {Badge} from '@astryxdesign/core/Badge'; +import {Card} from '@astryxdesign/core/Card'; +import {Dialog, DialogHeader} from '@astryxdesign/core/Dialog'; +import {Divider} from '@astryxdesign/core/Divider'; +import {Icon} from '@astryxdesign/core/Icon'; +import {HStack, Layout, LayoutContent, StackItem, VStack} from '@astryxdesign/core/Layout'; +import {Link} from '@astryxdesign/core/Link'; +import {Heading, Text} from '@astryxdesign/core/Text'; +import {useCallback, useContext} from 'react'; +import type {Connection} from './api'; +import {docsHref} from './docs'; +import {LocaleContext, useMessages} from './i18n'; +import {useRead} from './state'; +import {Feedback} from './ui'; +import {BrandMark} from './ui/BrandMark'; +import {RowEntrance} from './ui/motion'; + +const repository = 'https://github.com/Zakkaus/doona'; + +export function AboutDialog({connection, close}: {connection: Connection; close: () => void}) { + const t = useMessages(); + const locale = useContext(LocaleContext); + const version = useRead(useCallback(() => connection.api.version(), [connection])); + const engine = version.data?.engine; + const rows = [ + {label: t.address, value: connection.address === 'mock' ? t.demoName : connection.address}, + {label: t.aboutBackend, value: engine ? `${engine.name} ${engine.version}` : version.loading ? t.loading : t.unknown} + ]; + return ( + { + if (!open) close(); + }} + > + } + content={ + + + + + + + {t.app} + + + + {t.aboutTagline} + + + + + + {t.aboutGuide} + + + GitHub + + + {t.aboutReleases} + + + + {t.aboutConnection} + + + + {rows.map((row, index) => ( + + {index > 0 && } + + + {row.label} + + + {row.value} + + + + ))} + + + + {!!version.error && } + + + + } + /> + + ); +} diff --git a/apps/lite/src/CopyMembers.tsx b/apps/lite/src/CopyMembers.tsx index 3f9e9a32..23642977 100644 --- a/apps/lite/src/CopyMembers.tsx +++ b/apps/lite/src/CopyMembers.tsx @@ -36,6 +36,7 @@ export default function CopyMembers({ pending={false} label={t.save} disabled={!after || !current.writable} + disabledReason={!current.writable ? t.readOnly : entries.some(item => item.name !== name) ? t.chooseGroup : t.copyMembersEmpty} confirm={() => { if (after) { stage(draft?.source ?? currentSource, after, target); @@ -48,6 +49,7 @@ export default function CopyMembers({ label={t.targetGroup} value={target} onChange={setTarget} + isDisabled={!entries.some(item => item.name !== name)} options={entries.filter(item => item.name !== name).map(item => ({value: item.name, label: item.name}))} /> {after && ( diff --git a/apps/lite/src/DnsUpstreams.tsx b/apps/lite/src/DnsUpstreams.tsx index befd81ab..5fd05203 100644 --- a/apps/lite/src/DnsUpstreams.tsx +++ b/apps/lite/src/DnsUpstreams.tsx @@ -1,6 +1,7 @@ import {useProgressiveRows} from './ui/useProgressiveRows'; import {CollectionLoading, RowPlaceholder} from './ui/CollectionLoading'; import {Button} from '@astryxdesign/core/Button'; +import {EmptyState} from '@astryxdesign/core/EmptyState'; import {VStack} from '@astryxdesign/core/Layout'; import {Link} from '@astryxdesign/core/Link'; import {List, ListItem} from '@astryxdesign/core/List'; @@ -220,7 +221,9 @@ export function DnsUpstreams({ ))} - {!fields.length && {t.noUpstreams}} + {!loading && blocks.length <= 1 && !fields.length && ( + + )} diff --git a/apps/lite/src/GroupEditPanel.tsx b/apps/lite/src/GroupEditPanel.tsx index c9441607..3a6c2331 100644 --- a/apps/lite/src/GroupEditPanel.tsx +++ b/apps/lite/src/GroupEditPanel.tsx @@ -321,9 +321,7 @@ export function GroupEditPanel({ onChange={value => stage(writeGroupEntry(content, name, {policy: entry.policy, filters: value ? [] : [EMPTY_GROUP_FILTER]}))} isDisabled={!editable} /> - {!before && !allNodes && chosen.length === 0 && ( - - )} + {!allNodes && chosen.length === 0 && } diff --git a/apps/lite/src/GroupInspector.tsx b/apps/lite/src/GroupInspector.tsx index 2c871b21..2f919df6 100644 --- a/apps/lite/src/GroupInspector.tsx +++ b/apps/lite/src/GroupInspector.tsx @@ -521,9 +521,7 @@ export function GroupInspector({ )} ) : ( - - {t.noMatches} - + )} )} diff --git a/apps/lite/src/Groups.tsx b/apps/lite/src/Groups.tsx index 2c9bab67..ec5eb64e 100644 --- a/apps/lite/src/Groups.tsx +++ b/apps/lite/src/Groups.tsx @@ -592,7 +592,7 @@ export function Groups({connection, setBusy}: {connection: Connection; setBusy: {deleting} - {t.deleteDescription} + {t.deleteDraftDescription} {bulkReferenced ? t.referenced : t.deleteDescription} - {selectedNodes.map(node => node.name).join(', ')} + {t.selectedCount.replace('{n}', String(selectedNodes.length))} + + + {selectedNodes.map(node => ( + + {node.name} + + ))} + + {share && ( diff --git a/apps/lite/src/RuleList.tsx b/apps/lite/src/RuleList.tsx index be53a4cc..cef606b8 100644 --- a/apps/lite/src/RuleList.tsx +++ b/apps/lite/src/RuleList.tsx @@ -5,6 +5,7 @@ import {CollectionLoading, RowPlaceholder} from './ui/CollectionLoading'; import {Button} from '@astryxdesign/core/Button'; import {CheckboxInput} from '@astryxdesign/core/CheckboxInput'; import {Collapsible} from '@astryxdesign/core/Collapsible'; +import {EmptyState} from '@astryxdesign/core/EmptyState'; import {HStack, StackItem, VStack} from '@astryxdesign/core/Layout'; import {Link} from '@astryxdesign/core/Link'; import {List, ListItem} from '@astryxdesign/core/List'; @@ -265,7 +266,13 @@ export function RuleList({ ))} - {!loading && !visible.length && {rows.length ? t.noMatches : t.noRules}} + {!loading && !visible.length && ( + + )} )} @@ -288,6 +295,7 @@ export function RuleList({ change(setFallback(text, kind, fallback!.target.replace(/\(must\)$/, '') + (force ? '(must)' : '')))} @@ -510,7 +518,7 @@ function RuleForm({ {kind === 'routing' && ( {t.advanced}}> - + )} diff --git a/apps/lite/src/Shell.tsx b/apps/lite/src/Shell.tsx index 9bbfdb7d..783da09a 100644 --- a/apps/lite/src/Shell.tsx +++ b/apps/lite/src/Shell.tsx @@ -15,7 +15,7 @@ import {StatusDot} from '@astryxdesign/core/StatusDot'; import {Text} from '@astryxdesign/core/Text'; import {Tooltip} from '@astryxdesign/core/Tooltip'; import {useMediaQuery} from '@astryxdesign/core/hooks'; -import {useCallback, useContext, useRef, useState, type ComponentProps, type ReactNode} from 'react'; +import {lazy, Suspense, useCallback, useContext, useRef, useState, type ComponentProps, type ReactNode} from 'react'; import {errorKey, type Connection} from './api'; import {docsHref} from './docs'; import {DraftContext} from './ui/draftGuard'; @@ -30,6 +30,9 @@ import {BrandMark} from './ui/BrandMark'; import {EditDialog} from './ui/EditDialog'; import {useCommand} from './ui/commands'; import {GlobeGrid, Layers, Link, Location, Path, Search, Settings} from './ui/icons'; +import {ReportShortcut} from './ui/ReportShortcut'; + +const AboutDialog = lazy(() => import('./AboutDialog').then(module => ({default: module.AboutDialog}))); export type Screen = 'nodes' | 'groups' | 'subscriptions' | 'routing' | 'dns'; const sections = [ @@ -108,6 +111,7 @@ function ShellContent({ const task = useTask(setBusy); useNoticeToast(task.notice); const [pauseOpen, setPauseOpen] = useState(false); + const [aboutOpen, setAboutOpen] = useState(false); const resources = connection.capabilities.resources; const applicable = (kind: 'suspend' | 'resume' | 'reload') => resources.operations.available && @@ -140,6 +144,7 @@ function ShellContent({ onClick: () => (kind === 'suspend' ? setPauseOpen(true) : act(kind)) })); if (resources.config.available && !busy && !exporter.pending) actions.push({label: t.exportConfig, onClick: exporter.start}); + actions.push({label: t.about, onClick: () => setAboutOpen(true)}); useCommand(command => { const kind = command.replace('backend:', ''); if (command.startsWith('backend:') && ['suspend', 'resume', 'reload'].includes(kind) && applicable(kind as 'suspend' | 'resume' | 'reload')) { @@ -195,6 +200,7 @@ function ShellContent({ <> + } footer={ @@ -243,6 +249,11 @@ function ShellContent({ > {children} {exporter.dialog} + {aboutOpen && ( + + setAboutOpen(false)} /> + + )} {name} - {t.deleteDescription} + {t.deleteDraftDescription} ) : ( <> diff --git a/apps/lite/src/docs.ts b/apps/lite/src/docs.ts index 1eeed80a..b7c3878a 100644 --- a/apps/lite/src/docs.ts +++ b/apps/lite/src/docs.ts @@ -4,6 +4,7 @@ import type {Locale} from './i18n'; // The standard edition's anchor map, so both editions open the same section and doona-docs checks lite's links too. export type DocsAnchor = keyof typeof anchors; -export function docsHref(locale: Locale, anchor: DocsAnchor): string { - return `https://doona.daeuniverse.org/${locale}/${anchors[anchor]}.html#${anchor}`; +// Without an anchor it opens the guide's start page. +export function docsHref(locale: Locale, anchor?: DocsAnchor): string { + return `https://doona.daeuniverse.org/${locale}/${anchor ? `${anchors[anchor]}.html#${anchor}` : ''}`; } diff --git a/apps/lite/src/i18n/en.ts b/apps/lite/src/i18n/en.ts index 08da6ca3..29364402 100644 --- a/apps/lite/src/i18n/en.ts +++ b/apps/lite/src/i18n/en.ts @@ -24,6 +24,19 @@ export const en = { 'login.check': 'Continue', connectionSaveError: 'Cannot save the connection in this browser. Allow site storage and try again.', locale: 'en', + about: 'About doona', + reportProblem: 'Report a problem', + aboutBackend: 'Backend', + aboutConnection: 'Connection details', + aboutTagline: 'Web UI for daeuniverse', + aboutGuide: 'Guide', + aboutReleases: 'Releases', + noMatchesHelp: 'Change or clear the filters to see more results.', + noRulesHelp: 'Add a rule to choose how matching traffic is handled.', + noUpstreamsHelp: 'Add a DNS server to use it in request rules.', + forceTargetHelp: 'Keep matching DNS traffic on this outbound instead of intercepting it for DNS processing.', + deleteDraftDescription: 'This removes the item from the draft. Review and apply the changes to update the active configuration.', + copyMembersEmpty: 'Create another editable group before copying members.', conditionWebsites: 'Websites', conditionIps: 'IP addresses', conditionPorts: 'Ports and protocols', diff --git a/apps/lite/src/i18n/zh-CN.ts b/apps/lite/src/i18n/zh-CN.ts index 461b7ea8..fbc4770b 100644 --- a/apps/lite/src/i18n/zh-CN.ts +++ b/apps/lite/src/i18n/zh-CN.ts @@ -25,6 +25,19 @@ export const zhCN: Messages = { 'login.check': '继续', connectionSaveError: '无法在此浏览器中保存连接,请允许网站存储后重试。', locale: 'zh-CN', + about: '关于 doona', + reportProblem: '报告问题', + aboutBackend: '后端', + aboutConnection: '连接信息', + aboutTagline: 'daeuniverse 的 Web 界面', + aboutGuide: '指南', + aboutReleases: '发行版', + noMatchesHelp: '请修改或清除筛选条件以查看其他结果。', + noRulesHelp: '请添加规则,指定匹配流量的处理方式。', + noUpstreamsHelp: '请添加 DNS 服务器,以便在请求规则中使用。', + forceTargetHelp: '匹配的 DNS 流量仍使用此出站,不再被拦截并交由 DNS 模块处理。', + deleteDraftDescription: '此操作会从草稿中删除该项。审核并应用变更后,当前配置才会更新。', + copyMembersEmpty: '请先创建另一个可编辑的策略组,再复制成员。', conditionWebsites: '网站', conditionIps: 'IP', conditionPorts: '端口与协议', diff --git a/apps/lite/src/i18n/zh-TW.ts b/apps/lite/src/i18n/zh-TW.ts index 31dbc6fd..958e96f3 100644 --- a/apps/lite/src/i18n/zh-TW.ts +++ b/apps/lite/src/i18n/zh-TW.ts @@ -25,6 +25,19 @@ export const zhTW: Messages = { 'login.check': '繼續', connectionSaveError: '無法在此瀏覽器中儲存連線,請允許網站儲存資料後重試。', locale: 'zh-TW', + about: '關於 doona', + reportProblem: '回報問題', + aboutBackend: '後端', + aboutConnection: '連線資訊', + aboutTagline: 'daeuniverse 的 Web 介面', + aboutGuide: '指南', + aboutReleases: '發行版本', + noMatchesHelp: '請修改或清除篩選條件以檢視其他結果。', + noRulesHelp: '請新增規則,指定符合條件的流量處理方式。', + noUpstreamsHelp: '請新增 DNS 伺服器,以便在請求規則中使用。', + forceTargetHelp: '符合條件的 DNS 流量仍使用此出站,不再被攔截並交由 DNS 模組處理。', + deleteDraftDescription: '此操作會從草稿中刪除該項。檢視並套用變更後,目前的設定才會更新。', + copyMembersEmpty: '請先建立另一個可編輯的策略群組,再複製成員。', conditionWebsites: '網站', conditionIps: 'IP', conditionPorts: '連接埠與協定', diff --git a/apps/lite/src/themes/site/site.css b/apps/lite/src/themes/site/site.css index 03727708..8a2a6522 100644 --- a/apps/lite/src/themes/site/site.css +++ b/apps/lite/src/themes/site/site.css @@ -237,6 +237,7 @@ --size-element-sm: 32px; --size-element-md: 36px; --size-element-lg: 40px; + --focus-outline-color: light-dark(#0064E0, #2694FE); --lite-primary-background: light-dark(#292929, #DFE2E5); --lite-primary-text: light-dark(var(--color-on-dark), var(--color-on-light)); --color-brand: light-dark(#225BFF, #3D87FF); diff --git a/apps/lite/src/themes/site/site.js b/apps/lite/src/themes/site/site.js index 569f360c..55566f2d 100644 --- a/apps/lite/src/themes/site/site.js +++ b/apps/lite/src/themes/site/site.js @@ -110,6 +110,7 @@ export const siteTheme = { "--size-element-sm": "32px", "--size-element-md": "36px", "--size-element-lg": "40px", + "--focus-outline-color": "light-dark(#0064E0, #2694FE)", "--lite-primary-background": "light-dark(#292929, #DFE2E5)", "--lite-primary-text": "light-dark(var(--color-on-dark), var(--color-on-light))", "--color-brand": "light-dark(#225BFF, #3D87FF)", diff --git a/apps/lite/src/themes/site/siteTheme.ts b/apps/lite/src/themes/site/siteTheme.ts index 1e46ca72..234004ba 100644 --- a/apps/lite/src/themes/site/siteTheme.ts +++ b/apps/lite/src/themes/site/siteTheme.ts @@ -1,5 +1,5 @@ -// Based on Astryx's site theme, with the console's typography and duck accent. -import {defineTheme, type TokenValue} from '@astryxdesign/core/theme'; +// Based on Astryx's site theme, with the console's typography and neutral controls. +import {colorDefaults, defineTheme, type TokenValue} from '@astryxdesign/core/theme'; import {appIconRegistry, cjkFallbacks, systemMono, panelScale, panelShared} from '../shared'; const PRIMARY = 'light-dark(#15110C, #DFE2E5)'; @@ -53,6 +53,7 @@ export const siteTheme = defineTheme({ '--radius-container': '16px', '--radius-page': '32px', ...panelShared.tokens, + '--focus-outline-color': colorDefaults['--color-accent'], ...customTokens }, typography: { diff --git a/apps/lite/src/ui/ReportShortcut.tsx b/apps/lite/src/ui/ReportShortcut.tsx new file mode 100644 index 00000000..0a199268 --- /dev/null +++ b/apps/lite/src/ui/ReportShortcut.tsx @@ -0,0 +1,23 @@ +import {Icon} from '@astryxdesign/core/Icon'; +import {IconButton} from '@astryxdesign/core/IconButton'; +import {Tooltip} from '@astryxdesign/core/Tooltip'; +import {issuesUrl} from '../../../../src/api/problemReport'; +import {useMessages} from '../i18n'; +import {Bug} from './icons'; + +export function ReportShortcut() { + const t = useMessages(); + return ( + + } + href={issuesUrl} + target="_blank" + rel="noopener noreferrer" + /> + + ); +} diff --git a/apps/lite/src/ui/icons/Bug.tsx b/apps/lite/src/ui/icons/Bug.tsx new file mode 100644 index 00000000..a35657e0 --- /dev/null +++ b/apps/lite/src/ui/icons/Bug.tsx @@ -0,0 +1,14 @@ +// Adobe Spectrum icon, Apache-2.0; fill adapted to currentColor. +import type {SVGProps} from 'react'; +import IconSvg from './IconSvg'; + +export default function Bug(props: SVGProps) { + return ( + + + + ); +} diff --git a/apps/lite/src/ui/icons/index.ts b/apps/lite/src/ui/icons/index.ts index e2a832e5..a4013fd9 100644 --- a/apps/lite/src/ui/icons/index.ts +++ b/apps/lite/src/ui/icons/index.ts @@ -2,6 +2,7 @@ export {default as Add} from './Add'; export {default as AlertTriangle} from './AlertTriangle'; export {default as ArrowDown} from './ArrowDown'; export {default as ArrowUp} from './ArrowUp'; +export {default as Bug} from './Bug'; export {default as CheckmarkCircle} from './CheckmarkCircle'; export {default as Checkmark} from './Checkmark'; export {default as ChevronDown} from './ChevronDown'; diff --git a/changes/feat-about-report-links.md b/changes/feat-about-report-links.md new file mode 100644 index 00000000..40dfc38a --- /dev/null +++ b/changes/feat-about-report-links.md @@ -0,0 +1,5 @@ +Added + +- A bug-icon report button opens doona's issue tracker in a new tab: first among the standard app's top-bar actions and at the bottom left of the lite sidebar, next to the theme and language buttons. It has no text; the accessible name and tooltip say "Report a problem". +- Lite About shows the name, version, guide, GitHub and release links, and the connection address and backend. +- Empty rule, DNS, group-member and copy-member states now offer guidance; the routing `must` control has supporting text. Group and subscription deletion text explains staged changes, and bulk node deletion lists the selected names. diff --git a/e2e/keyboard.spec.ts b/e2e/keyboard.spec.ts index 67f190ca..715c069e 100644 --- a/e2e/keyboard.spec.ts +++ b/e2e/keyboard.spec.ts @@ -210,7 +210,7 @@ test('charts are named and icon buttons show their tooltip on keyboard focus', a } await page.locator('.rp-search').focus(); await page.keyboard.press('Tab'); - await expect(page.locator('.rp-actions button[aria-label]:focus')).toHaveCount(1); + await expect(page.locator('.rp-actions :is(a, button)[aria-label]:focus')).toHaveCount(1); await expect(page.getByRole('tooltip')).toBeVisible(); }); diff --git a/e2e/mobile.spec.ts b/e2e/mobile.spec.ts index 41c6b9e4..22b2079d 100644 --- a/e2e/mobile.spec.ts +++ b/e2e/mobile.spec.ts @@ -141,8 +141,11 @@ test('language, theme and palette are each two taps away in the overflow menu', await expect(top.getByRole('button', {name: 'Reload honk'})).toBeHidden(); for (const name of ['Language', 'Palette']) await expect(top.getByRole('button', {name, exact: true})).toBeHidden(); const more = top.getByRole('button', {name: 'More options'}); - const rect = await box(more); - expect(rect.x + rect.width).toBeGreaterThan((await box(top)).width - 24); + const report = top.getByRole('link', {name: 'Report a problem', exact: true}); + await expect(report).toHaveText(''); + const [moreRect, reportRect, firstRect] = [await box(more), await box(report), await box(top.locator('.rp-actions button:visible').first())]; + expect(moreRect.x + moreRect.width).toBeGreaterThan((await box(top)).width - 24); + expect(reportRect.x + reportRect.width).toBeLessThanOrEqual(firstRect.x); // The menu is three short rows, each naming its current value, then Reload honk and the Backend row; a row opens its // choices in the same popover. await more.click(); @@ -708,7 +711,7 @@ const pressCases: {name: string; width: number; route: string; target: string; l layer: '.rp-hubbar-pill', shape: '.rp-hubbar > [aria-current] .rp-hubbar-pill' }, - {name: 'menu item', width: 390, route: 'overview', open: '.rp-top .rp-btn.icon[aria-haspopup]', target: '[role=menuitem].rp-item'}, + {name: 'menu item', width: 390, route: 'overview', open: '.rp-top button[aria-label="More options"]', target: '[role=menuitem].rp-item'}, {name: 'list row', width: 390, route: 'connections?tab=list', target: '.rp-table [role=row][data-react-aria-pressable]'}, {name: 'picker', width: 390, route: 'settings', target: '.rp-selectbtn:not([disabled])'} ]; diff --git a/e2e/single-entry-shell.spec.ts b/e2e/single-entry-shell.spec.ts index 8bf557de..3aad5ee8 100644 --- a/e2e/single-entry-shell.spec.ts +++ b/e2e/single-entry-shell.spec.ts @@ -1,6 +1,46 @@ import {expect, mockBackend, test, box} from './fixtures'; import {writeMode} from '../src/dae/outboundMode'; +const issues = 'https://github.com/Zakkaus/doona/issues'; + +for (const width of [1440, 390]) { + for (const [lang, label] of [ + ['en', 'Report a problem'], + ['zh-CN', '报告问题'], + ['zh-TW', '回報問題'] + ] as const) { + test.describe(`${width}px ${lang} report button`, () => { + test.use({viewport: {width, height: 900}, storage: {'doona-lang': lang}}); + test('is an icon-only link to the issue tracker at the start of the top bar actions, and About has no report links', async ({page}) => { + await mockBackend(page); + await page.goto('/#/activity'); + const top = page.locator('.rp-top'); + const report = top.getByRole('link', {name: label, exact: true}); + await expect(report).toHaveCount(1); + await expect(report).toBeInViewport(); + await expect(report).toHaveAttribute('href', issues); + await expect(report).toHaveAttribute('target', '_blank'); + await expect(report).toHaveAttribute('rel', 'noopener noreferrer'); + await expect(report).toHaveText(''); + await expect(report.locator('svg')).toBeVisible(); + // The same size as the icon buttons beside it, and the first of the bar's actions. + const [link, neighbour] = [await box(report), await box(top.locator('.rp-actions button:visible').first())]; + expect(link.height).toBe(neighbour.height); + expect(link.width).toBe(neighbour.width); + expect(link.x + link.width).toBeLessThanOrEqual(neighbour.x); + await page.context().route('https://github.com/**', route => route.fulfill({body: ''})); + const popup = page.waitForEvent('popup'); + await report.click(); + const opened = await popup; + await expect.poll(() => opened.url()).toBe(issues); + await opened.close(); + await page.locator('button.rp-brand').click(); + await expect(page.getByRole('dialog').locator(`a[href^="${issues}"]`)).toHaveCount(0); + }); + }); + } +} + test('the desktop theme shortcut stays in sync with the appearance editor', async ({page}) => { await page.emulateMedia({colorScheme: 'light'}); await page.goto('/#/activity'); diff --git a/src/api/problemReport.ts b/src/api/problemReport.ts new file mode 100644 index 00000000..9b235245 --- /dev/null +++ b/src/api/problemReport.ts @@ -0,0 +1 @@ +export const issuesUrl = 'https://github.com/Zakkaus/doona/issues'; diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index c81ee8e3..58adc12f 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -2037,6 +2037,7 @@ "shell.reloadEngine": "Reload honk", "shell.reloadHelp": "honk reads its config files again and reloads. Held rules are not written.", "shell.reloadTitle": "Reload honk?", + "shell.report": "Report a problem", "shell.search": "Search pages, connections, nodes, groups, node sources and config files", "shell.searchUnavailable": "Could not open search: it did not load.", "shell.shortcut": "Ctrl K", diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index 07166e9c..eddeab10 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -1827,6 +1827,7 @@ "shell.reloadEngine": "重载 honk", "shell.reloadHelp": "honk 会重新读取配置文件并重载。暂存的规则不会写入。", "shell.reloadTitle": "重载 honk?", + "shell.report": "报告问题", "shell.search": "搜索页面、连接、节点、组、节点来源和配置文件", "shell.searchUnavailable": "无法打开搜索:搜索功能加载失败。", "shell.shortcut": "Ctrl K", diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json index b71c0442..588cbd01 100644 --- a/src/i18n/locales/zh-TW.json +++ b/src/i18n/locales/zh-TW.json @@ -1827,6 +1827,7 @@ "shell.reloadEngine": "重載 honk", "shell.reloadHelp": "honk 會重新讀取設定檔並重載。暫存的規則不會寫入。", "shell.reloadTitle": "重載 honk?", + "shell.report": "回報問題", "shell.search": "搜尋頁面、連線、節點、群組、節點來源與設定檔", "shell.searchUnavailable": "無法開啟搜尋:搜尋功能載入失敗。", "shell.shortcut": "Ctrl K", diff --git a/src/shell/TopBar.tsx b/src/shell/TopBar.tsx index 1c8f592d..96e9e0fe 100644 --- a/src/shell/TopBar.tsx +++ b/src/shell/TopBar.tsx @@ -2,6 +2,7 @@ import {memo, useRef, useState} from 'react'; import {PhoneWidgets} from './widgets/host'; import {About} from './About'; import {BackendMenuPopover} from './Backend'; +import Bug from '../ui/icons/Bug'; import Checkmark from '../ui/icons/Checkmark'; import Color from '../ui/icons/Color'; import Contrast from '../ui/icons/Contrast'; @@ -13,7 +14,8 @@ import Search from '../ui/icons/Search'; import Translate from '../ui/icons/Translate'; import logo from '../logo.svg'; import {useT, type Lang} from '../i18n'; -import {Button, ChoiceMenu, Divider} from '../ui/ui'; +import {Button, ChoiceMenu, Divider, Link} from '../ui/ui'; +import {issuesUrl} from '../api/problemReport'; import {ReloadConfirm} from '../features/shared/ReloadConfirm'; import type {SettingsContext} from './preferences'; import type {Scheme} from './preferences'; @@ -94,6 +96,9 @@ export const TopBar = memo(function TopBar({
+ + +