feat(conversations): add swap button (#32)
Adds a button between the two person typeaheads that swaps sender and receiver, then reloads the conversation view. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,13 @@ function toggleSort() {
|
||||
sortDir = sortDir === 'DESC' ? 'ASC' : 'DESC';
|
||||
applyFilters();
|
||||
}
|
||||
|
||||
function swapPersons() {
|
||||
const tmp = senderId;
|
||||
senderId = receiverId;
|
||||
receiverId = tmp;
|
||||
applyFilters();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mx-auto max-w-5xl px-4 py-10">
|
||||
@@ -80,6 +87,27 @@ function toggleSort() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if senderId && receiverId}
|
||||
<div class="mb-4 flex justify-center">
|
||||
<button
|
||||
data-testid="conv-swap-btn"
|
||||
onclick={swapPersons}
|
||||
class="flex items-center gap-2 rounded-sm border border-brand-sand px-4 py-2 text-xs font-bold tracking-widest text-brand-navy uppercase transition-colors hover:bg-brand-navy hover:text-white"
|
||||
title={m.conv_swap_btn()}
|
||||
>
|
||||
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M7 16V4m0 0L3 8m4-4l4 4M17 8v12m0 0l4-4m-4 4l-4-4"
|
||||
></path>
|
||||
</svg>
|
||||
{m.conv_swap_btn()}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="relative z-10 grid grid-cols-1 items-end gap-6 md:grid-cols-3">
|
||||
<!-- Date From -->
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user