Streamline the connections workspace

Rename and remove now live on each sidebar row instead of a header
above the workspace. The pen swaps the row to an inline input (Enter or
blur saves, Escape cancels and returns focus to the pen) and the remove
control targets its own row without switching the open connection. The
row shows a status dot with text; on mobile a bar beside Show
connections shows the open connection and its status.

The per-connection activity timeline and its saved transfer history are
removed. Records from pre-release 0.0.5 builds lose their history field
on first load. A removal dialog closes when another tab removes its
connection, and focus moves to the next row after removing another one.

The README is reorganized without repetition and corrects the TypeScript
version; the 0.0.5 changelog now describes the net change since 0.0.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SchluffeandClaude Opus 5.5 committed 2026-10-19 23:46:12 +02:00
1 parent 4323a8b774
commit f320bfb541
11 files changed
+552 -650

No files matched your search

+4 -20
View File
@@ -1,12 +1,10 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { emptyConnection, updateConnection, HISTORY_LIMIT, type ConnectionActivity } from '../src/lib/connections.ts';
import { emptyConnection, updateConnection } from '../src/lib/connections.ts';
test('renaming and pairing preserve a slot identity and its activity', () => {
test('renaming and pairing preserve a slot identity', () => {
const initial = emptyConnection(2);
const activity: ConnectionActivity = { id: 'transfer', time: 1, direction: 'send', name: 'example.txt', size: 123, result: 'complete' };
const withHistory = updateConnection(initial, { activity });
const renamed = updateConnection(withHistory, { name: ' Work laptop ' });
const renamed = updateConnection(initial, { name: ' Work laptop ' });
const remembering = updateConnection(renamed, { rememberDevice: true });
const paired = updateConnection(remembering, { peerKey: '04' + 'a'.repeat(128) });
assert.equal(initial.name, 'Con 2');
@@ -15,22 +13,8 @@ test('renaming and pairing preserve a slot identity and its activity', () => {
assert.equal(updateConnection(paired, { peerKey: '' }).rememberDevice, true, 'Forgetting a device keeps the opt-in');
assert.equal(paired.id, initial.id);
assert.equal(paired.name, 'Work laptop');
assert.deepEqual(paired.history, [activity]);
assert.equal(initial.history.length, 0);
assert.equal('history' in paired, false);
assert.throws(() => updateConnection(paired, { name: ' ' }));
assert.throws(() => updateConnection(paired, { name: 'a'.repeat(81) }));
assert.throws(() => updateConnection(paired, { peerKey: 'invalid' }));
});
test('history is bounded, ordered, and does not duplicate an event', () => {
let connection = emptyConnection();
for (let i = 0; i < HISTORY_LIMIT + 10; i++) {
connection = updateConnection(connection, { activity: { id: String(i), time: i, direction: 'receive', name: 'file', size: 0, result: 'declined' } });
}
const last = connection.history.at(-1)!;
connection = updateConnection(connection, { activity: last });
assert.equal(connection.history.length, HISTORY_LIMIT);
assert.equal(connection.history[0]!.time, 10);
assert.throws(() => updateConnection(connection, { activity: { ...last, size: -1 } }));
assert.throws(() => updateConnection(connection, { activity: { ...last, direction: 'invalid' as 'send' } }));
});