WIP II improve UX [snapshot task 2]
This commit is contained in:
1 parent
cd66321ea6
commit
b2bab26981
7 files changed
+65
-31
No files matched your search
+13
-4
@@ -4,6 +4,13 @@ import TransferPanel from './components/TransferPanel.vue';
|
||||
|
||||
const mode = ref<'send' | 'receive'>('send');
|
||||
const sessionActive = ref(false);
|
||||
const connected = ref(false);
|
||||
const direction = ref<'send' | 'receive'>('send');
|
||||
const panel = ref<InstanceType<typeof TransferPanel> | null>(null);
|
||||
function navigate(next: 'send' | 'receive') {
|
||||
if (connected.value) { direction.value = next; panel.value?.focusDirection(next); }
|
||||
else if (!sessionActive.value) mode.value = next;
|
||||
}
|
||||
const isLocal = location.protocol === 'file:';
|
||||
const canDownloadApp = import.meta.env.PROD && !isLocal;
|
||||
</script>
|
||||
@@ -20,12 +27,14 @@ const canDownloadApp = import.meta.env.PROD && !isLocal;
|
||||
|
||||
<p v-if="canDownloadApp || isLocal" class="status">For large files in the downloaded local version, use desktop Chrome on the receiving machine and choose “Choose destination & receive to disk”.</p>
|
||||
|
||||
<div class="tabs" role="group" aria-label="Transfer mode">
|
||||
<button :disabled="sessionActive" :class="{ active: mode === 'send' }" :aria-pressed="mode === 'send'" @click="mode = 'send'">Send</button>
|
||||
<button :disabled="sessionActive" :class="{ active: mode === 'receive' }" :aria-pressed="mode === 'receive'" @click="mode = 'receive'">Receive</button>
|
||||
<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 :key="mode" :sending="mode === 'send'" @session-change="sessionActive = $event" />
|
||||
<p v-if="connected" class="status">Connected — either person can send files. Send and Receive jump to those sections without interrupting transfers.</p>
|
||||
<p v-else-if="sessionActive" class="status">Finish connecting and verifying first. Then either person can send and receive.</p>
|
||||
<TransferPanel ref="panel" :key="mode" :sending="mode === 'send'" @session-change="sessionActive = $event" @connected-change="connected = $event; direction = mode" />
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
|
||||
Reference in new issue
Block a user