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

+11 -40
View File
@@ -1,11 +1,10 @@
<script setup lang="ts">
import { nextTick, ref, watch } from 'vue';
import TransferPanel from './TransferPanel.vue';
import type { SavedConnection, ConnectionActivity, ConnectionUpdate } from '../lib/connections.ts';
import type { SavedConnection, ConnectionUpdate } from '../lib/connections.ts';
const props = defineProps<{ connection: SavedConnection; loadTrust: (id: string) => Promise<SavedConnection>; invitation?: { code: string } | null }>();
const emit = defineEmits<{
status: [id: string, state: 'ready' | 'connecting' | 'connected'];
activity: [id: string, item: ConnectionActivity];
update: [id: string, change: ConnectionUpdate];
invitationTaken: [];
}>();
@@ -28,48 +27,20 @@ watch(() => props.invitation, async invitation => {
await nextTick();
panel.value?.importCode(invitation.code);
}, { immediate: true });
function sizeLabel(size: number) {
if (size < 1024) return `${size} B`;
const index = Math.min(5, Math.floor(Math.log(size) / Math.log(1024)));
return `${(size / 1024 ** index).toFixed(1)} ${['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'][index]}`;
}
</script>
<template>
<div class="connection-workspace">
<div class="session-column">
<div class="workspace-intro">
<h2>{{ connected ? 'Share files' : 'Start a session' }}</h2>
<p>{{ connected ? 'Your connection is ready.' : 'Exchange connection codes with your peer to start sharing.' }} Each direction sends one file at a time; both people can send on this connection.</p>
</div>
<div class="tabs" role="group" :aria-label="connected ? 'Transfer sections' : 'Connection setup'">
<button :disabled="sessionActive && !connected" :class="{ active: (connected ? direction : mode) === 'send' }" :aria-pressed="(connected ? direction : mode) === 'send'" @click="navigate('send')">Send</button>
<button :disabled="sessionActive && !connected" :class="{ active: (connected ? direction : mode) === 'receive' }" :aria-pressed="(connected ? direction : mode) === 'receive'" @click="navigate('receive')">Receive</button>
</div>
<TransferPanel ref="panel" :key="mode" :sending="mode === 'send'" :connection="connection" :load-trust="() => loadTrust(connection.id)"
@session-change="sessionActive = $event; status()" @connected-change="connected = $event; direction = mode; status()"
@activity="emit('activity', connection.id, $event)" @update="emit('update', connection.id, $event)" />
<div class="workspace-intro">
<h2>{{ connected ? 'Share files' : 'Start a session' }}</h2>
<p>{{ connected ? 'Your connection is ready.' : 'Exchange connection codes with your peer to start sharing.' }} Each direction sends one file at a time; both people can send on this connection.</p>
</div>
<aside class="activity-panel" aria-labelledby="activity-heading">
<div class="activity-heading"><h2 id="activity-heading">Activity</h2><span>{{ connection.history.length }}</span></div>
<div v-if="!connection.history.length" class="empty-activity">
<span class="empty-activity-icon" aria-hidden="true">↔</span>
<h3>A fresh connection</h3>
<p>Files you share here will appear in this timeline.</p>
<p class="activity-note">History stays in this browser. File contents aren’t kept here.</p>
</div>
<ol v-else class="activity-list" aria-label="Recent file results">
<li v-for="item in [...connection.history].reverse()" :key="item.id" class="activity-item">
<span class="activity-icon" aria-hidden="true">{{ item.direction === 'send' ? '↗' : '↙' }}</span>
<div>
<p class="activity-filename">{{ item.name }}</p>
<p class="activity-meta">{{ item.direction === 'send' ? 'Outgoing' : 'Incoming' }} · {{ sizeLabel(item.size) }}</p>
<p class="activity-result">{{ item.result === 'complete' ? 'Transfer complete' : item.result === 'declined' ? 'Declined' : 'Interrupted' }}</p>
<time :datetime="new Date(item.time).toISOString()">{{ new Date(item.time).toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }) }}</time>
</div>
</li>
</ol>
<p v-if="connection.history.length" class="activity-note">Last 50 transfers · Saved in this browser</p>
</aside>
<div class="tabs" role="group" :aria-label="connected ? 'Transfer sections' : 'Connection setup'">
<button :disabled="sessionActive && !connected" :class="{ active: (connected ? direction : mode) === 'send' }" :aria-pressed="(connected ? direction : mode) === 'send'" @click="navigate('send')">Send</button>
<button :disabled="sessionActive && !connected" :class="{ active: (connected ? direction : mode) === 'receive' }" :aria-pressed="(connected ? direction : mode) === 'receive'" @click="navigate('receive')">Receive</button>
</div>
<TransferPanel ref="panel" :key="mode" :sending="mode === 'send'" :connection="connection" :load-trust="() => loadTrust(connection.id)"
@session-change="sessionActive = $event; status()" @connected-change="connected = $event; direction = mode; status()"
@update="emit('update', connection.id, $event)" />
</div>
</template>