Skip to content

armgit / plexo

Public Imported from GitHub
0

Speed up downloads by combining multiple network connections in parallel

fix: remaining native title tooltips, and truncated text's tooltip

Claudea5e6cbc12e0b
diff --git a/e2e/ui.spec.ts b/e2e/ui.spec.ts
index 49a08b8..962bdf4 100644
--- a/e2e/ui.spec.ts
+++ b/e2e/ui.spec.ts
@@ -107,22 +107,13 @@ test.describe('UI journeys @smoke', () => {
})
})
-// What a user sets is still set after they reload or restart — checked only through what they see.
-test.describe('network rows explain themselves @smoke', () => {
- test('the last network in use says why it can’t be switched off', async ({ plexo, serve }) => {
- const origin = await serve({ size: 64 * BLOCK, bytesPerSecond: 256 * 1024 })
- await plexo.start(origin.url(), origin.sha256)
- const checkbox = plexo.page.getByRole('checkbox', { name: /^Use /, checked: true })
- await expect(checkbox).toBeDisabled()
-
- // A disabled checkbox gets no hover of its own: what it sits in shows the tooltip.
- await checkbox.locator('..').hover()
- await expect(
- plexo.page.getByText('The last network in use stays on. Pause to stop.')
- ).toBeVisible()
- })
-
- test('a network that becomes the last one in use says so too', async ({ plexo, serve }) => {
+test.describe('tooltips @smoke', () => {
+ // base-ui settles on the first render whether a tooltip's state is its own; one that is
+ // switched on only later, as this one is, must still open.
+ test('a network that becomes the last one in use says why it can’t be switched off', async ({
+ plexo,
+ serve
+ }) => {
test.skip(!LAN_ADDRESS, 'needs a LAN address to act as the second network')
const origin = await serve({ size: 64 * BLOCK, bytesPerSecond: 256 * 1024 })
const id = await plexo.start(origin.url(), origin.sha256, { networks: ['a', 'b'] })
@@ -131,29 +122,15 @@ test.describe('network rows explain themselves @smoke', () => {
await plexo.api.setDownloadNetwork(id, 'b', false)
await expect(checked).toBeDisabled()
+ // A disabled checkbox gets no hover of its own: what it sits in shows the tooltip.
await checked.locator('..').hover()
await expect(
plexo.page.getByText('The last network in use stays on. Pause to stop.')
).toBeVisible()
})
-
- test('a network that failed shows what went wrong', async ({ plexo, serve }) => {
- test.skip(!LAN_ADDRESS, 'needs a LAN address to act as the second network')
- const origin = await serve({ size: 64 * BLOCK, bytesPerSecond: 256 * 1024 })
- // Everything over b is refused for good; a carries the download.
- origin.setRule(({ from, range }) =>
- from !== '127.0.0.1' && range && range.end !== 0 ? { status: 404 } : 'ok'
- )
- await plexo.start(origin.url(), origin.sha256, { networks: ['a', 'b'], connections: 2 })
- await plexo.waitUntil(
- (state) => state.networks.find((network) => network.id === 'b')?.status === 'failed'
- )
-
- await plexo.page.getByText('Failed', { exact: true }).hover()
- await expect(plexo.page.getByText('Unexpected status 404 for range request')).toBeVisible()
- })
})
+// What a user sets is still set after they reload or restart — checked only through what they see.
test.describe('settings @smoke', () => {
test.describe('with an update available', () => {
test.use({ appEnv: { PLEXO_FORCE_UPDATE_VERSION: '9.9.9' } })
diff --git a/src/renderer/src/components/NetworkCard.tsx b/src/renderer/src/components/NetworkCard.tsx
index 2c27f92..8cc8dad 100644
--- a/src/renderer/src/components/NetworkCard.tsx
+++ b/src/renderer/src/components/NetworkCard.tsx
@@ -2,6 +2,7 @@ import type { NetworkInterfaceInfo } from '@shared/types'
import { useNetworkVisuals } from '../hooks/useNetworkVisuals'
import { ColorBadge } from './ColorBadge'
import { NetworkEditPopover } from './NetworkEditPopover'
+import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'
interface NetworkCardProps {
iface: NetworkInterfaceInfo
@@ -42,6 +43,9 @@ export function NetworkCard({
}: NetworkCardProps): React.JSX.Element {
const visual = useNetworkVisuals()(iface.id, iface.kind, iface.displayName)
const hasLatency = latencyMs != null
+ const latencyText = hasLatency
+ ? 'Latency measured'
+ : 'Latency unavailable; downloads may still work'
return (
<div
@@ -101,12 +105,21 @@ export function NetworkCard({
{hasLatency ? `${latencyMs} ms` : '—'}
</div>
</div>
- <div
- title={hasLatency ? 'Latency measured' : 'Latency unavailable; downloads may still work'}
- className={`size-[7px] shrink-0 rounded-full ${
- hasLatency ? 'bg-[var(--color-success)]' : 'bg-[var(--icon-muted)]'
- }`}
- />
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <span
+ role="img"
+ tabIndex={0}
+ aria-label={latencyText}
+ className={`size-[7px] shrink-0 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring/50 ${
+ hasLatency ? 'bg-[var(--color-success)]' : 'bg-[var(--icon-muted)]'
+ }`}
+ />
+ }
+ />
+ <TooltipContent>{latencyText}</TooltipContent>
+ </Tooltip>
</div>
</div>
)
diff --git a/src/renderer/src/components/NetworkRow.tsx b/src/renderer/src/components/NetworkRow.tsx
index 7537651..8307507 100644
--- a/src/renderer/src/components/NetworkRow.tsx
+++ b/src/renderer/src/components/NetworkRow.tsx
@@ -263,23 +263,29 @@ export function NetworkRow({
</span>
)}
{isChunkActive ? (
- <ColorBadge
- bg={visual.bg}
- border={visual.border}
- text={visual.text}
- title={
- chunk.hedge
- ? 'Racing another stream for this chunk, which was running slowly'
- : undefined
- }
- // Height is pinned, not `h-auto`: this badge swaps in and out as a stream
- // goes active, and the cell is only as tall as "Stream #N" (13.2px). Left to
- // size itself the badge came out taller than that and grew the row on every
- // swap. 13px keeps it under, whatever line-height it ends up inheriting.
- className="h-[13px] rounded-[3px] px-[5px] py-px text-[9px] font-semibold tracking-[0.04em]"
- >
- {chunk.hedge ? 'BACKUP' : 'ACTIVE'}
- </ColorBadge>
+ <Tooltip disabled={!chunk.hedge}>
+ <TooltipTrigger
+ render={
+ <ColorBadge
+ bg={visual.bg}
+ border={visual.border}
+ text={visual.text}
+ tabIndex={chunk.hedge ? 0 : undefined}
+ // Height is pinned, not `h-auto`: this badge swaps in and out as a
+ // stream goes active, and the cell is only as tall as "Stream #N"
+ // (13.2px). Left to size itself the badge came out taller than that and
+ // grew the row on every swap. 13px keeps it under, whatever line-height
+ // it ends up inheriting.
+ className="h-[13px] rounded-[3px] px-[5px] py-px text-[9px] font-semibold tracking-[0.04em] outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
+ >
+ {chunk.hedge ? 'BACKUP' : 'ACTIVE'}
+ </ColorBadge>
+ }
+ />
+ <TooltipContent>
+ Racing another stream for this chunk, which was running slowly
+ </TooltipContent>
+ </Tooltip>
) : (
<span
className={`text-[9.5px] ${
diff --git a/src/renderer/src/components/TruncatedText.tsx b/src/renderer/src/components/TruncatedText.tsx
index 73d8fc9..ef31e28 100644
--- a/src/renderer/src/components/TruncatedText.tsx
+++ b/src/renderer/src/components/TruncatedText.tsx
@@ -27,7 +27,7 @@ export function TruncatedText({
}, [node, text])
return (
- <Tooltip open={isTruncated ? undefined : false}>
+ <Tooltip disabled={!isTruncated}>
<TooltipTrigger
render={
<span