archy/neode-ui/src/views/Mesh.vue

1017 lines
25 KiB
Vue
Raw Normal View History

2026-03-17 00:03:08 +00:00
<script setup lang="ts">
import { ref, computed, nextTick, onMounted, onUnmounted } from 'vue'
import { useMeshStore } from '@/stores/mesh'
import type { MeshPeer } from '@/stores/mesh'
import AnimatedLogo from '@/components/AnimatedLogo.vue'
const mesh = useMeshStore()
// Active chat: either a peer or a channel
const activeChatPeer = ref<MeshPeer | null>(null)
const activeChatChannel = ref<{ index: number; name: string } | null>(null)
const messageText = ref('')
const sendError = ref('')
const broadcasting = ref(false)
const configuring = ref(false)
const chatScrollEl = ref<HTMLElement | null>(null)
let pollInterval: ReturnType<typeof setInterval> | null = null
// The Public channel (always available on Meshcore)
const publicChannel = { index: 0, name: 'Public' }
onMounted(async () => {
await mesh.refreshAll()
pollInterval = setInterval(() => {
mesh.fetchStatus()
mesh.fetchPeers()
mesh.fetchMessages()
}, 5000)
})
onUnmounted(() => {
if (pollInterval) clearInterval(pollInterval)
})
// Active chat name for the header
const activeChatName = computed(() => {
if (activeChatChannel.value) return activeChatChannel.value.name
if (activeChatPeer.value) return activeChatPeer.value.advert_name
return ''
})
const activeChatSub = computed(() => {
if (activeChatChannel.value) return 'Mesh channel'
if (activeChatPeer.value) return truncatePubkey(activeChatPeer.value.pubkey_hex)
return ''
})
const hasActiveChat = computed(() => !!activeChatPeer.value || !!activeChatChannel.value)
// Messages filtered to the active chat
const chatMessages = computed(() => {
if (activeChatChannel.value) {
// Channel messages have negative contact_id = -(channel_index + 1)
const chanId = -(activeChatChannel.value.index + 1)
return mesh.messages.filter(m => m.peer_contact_id === chanId)
}
if (activeChatPeer.value) {
const cid = activeChatPeer.value.contact_id
return mesh.messages.filter(m => m.peer_contact_id === cid)
}
return []
})
// Check if a peer is an Archipelago node (name starts with "Archy-")
function isArchyNode(peer: MeshPeer): boolean {
return peer.advert_name.startsWith('Archy-')
}
// Sort peers: Archy nodes first, then alphabetical
const sortedPeers = computed(() => {
return [...mesh.peers].sort((a, b) => {
const aArchy = isArchyNode(a) ? 0 : 1
const bArchy = isArchyNode(b) ? 0 : 1
if (aArchy !== bArchy) return aArchy - bArchy
return a.advert_name.localeCompare(b.advert_name)
})
})
function openChat(peer: MeshPeer) {
activeChatPeer.value = peer
activeChatChannel.value = null
sendError.value = ''
messageText.value = ''
mesh.markChatRead(peer.contact_id)
nextTick(() => scrollChatToBottom())
}
function openChannelChat(channel: { index: number; name: string }) {
activeChatChannel.value = channel
activeChatPeer.value = null
sendError.value = ''
messageText.value = ''
nextTick(() => scrollChatToBottom())
}
function closeChat() {
activeChatPeer.value = null
activeChatChannel.value = null
mesh.clearViewingChat()
}
async function handleSendMessage() {
if (!activeChatPeer.value || !messageText.value.trim()) return
sendError.value = ''
try {
await mesh.sendMessage(activeChatPeer.value.contact_id, messageText.value)
messageText.value = ''
nextTick(() => scrollChatToBottom())
} catch (err: unknown) {
sendError.value = err instanceof Error ? err.message : 'Send failed'
}
}
function scrollChatToBottom() {
if (chatScrollEl.value) {
chatScrollEl.value.scrollTop = chatScrollEl.value.scrollHeight
}
}
async function handleBroadcast() {
broadcasting.value = true
try { await mesh.broadcastIdentity() } finally { broadcasting.value = false }
}
async function handleToggleEnabled() {
configuring.value = true
try {
const newEnabled = !(mesh.status?.enabled ?? false)
await mesh.configure({ enabled: newEnabled })
} finally { configuring.value = false }
}
function signalBars(rssi: number | null): number {
if (rssi === null) return 0
if (rssi > -60) return 4
if (rssi > -75) return 3
if (rssi > -90) return 2
return 1
}
function timeAgo(iso: string): string {
const diff = Date.now() - new Date(iso).getTime()
const secs = Math.floor(diff / 1000)
if (secs < 60) return `${secs}s ago`
const mins = Math.floor(secs / 60)
if (mins < 60) return `${mins}m ago`
const hours = Math.floor(mins / 60)
return `${hours}h ago`
}
function truncatePubkey(hex: string | null): string {
if (!hex) return ''
return hex.slice(0, 8) + '...' + hex.slice(-6)
}
</script>
<template>
<div class="mesh-view">
<!-- Header -->
<div class="mesh-header">
<div class="mesh-header-left">
<h1 class="mesh-title">Mesh Network</h1>
<p class="mesh-subtitle">
{{ mesh.status?.peer_count ?? 0 }} peer{{ (mesh.status?.peer_count ?? 0) !== 1 ? 's' : '' }}
<span v-if="mesh.status?.device_connected" class="mesh-subtitle-badge">Live</span>
</p>
</div>
<a
href="https://flasher.meshcore.co.uk/"
target="_blank"
rel="noopener noreferrer"
class="glass-button mesh-flasher-btn"
>
Flash Meshcore <span class="mesh-flasher-sep">|</span> Choose Companion USB
</a>
</div>
<!-- Error banner -->
<div v-if="mesh.error" class="mesh-error">{{ mesh.error }}</div>
<!-- Two-column layout (desktop) / single-column (mobile) -->
<div class="mesh-columns">
<!-- LEFT COLUMN: Status + Peers -->
<div class="mesh-left">
<!-- Device Status -->
<div class="glass-card mesh-status-card">
<div class="mesh-status-header">
<div class="mesh-status-indicator" :class="mesh.status?.device_connected ? 'connected' : 'disconnected'" />
<h2 class="mesh-section-title">Device</h2>
</div>
<div v-if="mesh.loading && !mesh.status" class="mesh-loading">Loading...</div>
<div v-else-if="mesh.status" class="mesh-status-grid">
<div class="mesh-stat">
<span class="mesh-stat-label">Status</span>
<span class="mesh-stat-value" :class="mesh.status.device_connected ? 'text-green' : mesh.status.enabled ? 'text-orange' : 'text-muted'">
{{ mesh.status.device_connected ? 'Broadcasting' : mesh.status.enabled ? 'Connecting...' : 'Disabled' }}
</span>
</div>
<div class="mesh-stat">
<span class="mesh-stat-label">Type</span>
<span class="mesh-stat-value">{{ mesh.status.device_type === 'unknown' ? '—' : mesh.status.device_type }}</span>
</div>
<div class="mesh-stat">
<span class="mesh-stat-label">Port</span>
<span class="mesh-stat-value">{{ mesh.status.device_path ?? 'Auto' }}</span>
</div>
<div class="mesh-stat">
<span class="mesh-stat-label">Sent</span>
<span class="mesh-stat-value">{{ mesh.status.messages_sent }}</span>
</div>
<div class="mesh-stat">
<span class="mesh-stat-label">Recv</span>
<span class="mesh-stat-value">{{ mesh.status.messages_received }}</span>
</div>
<div class="mesh-stat">
<span class="mesh-stat-label">Channel</span>
<span class="mesh-stat-value">{{ mesh.status.channel_name }}</span>
</div>
</div>
<!-- Detected USB devices -->
<div v-if="mesh.status?.detected_devices?.length" class="mesh-detected-devices">
<div v-for="dev in mesh.status.detected_devices" :key="dev" class="mesh-device-row">
<div class="mesh-device-indicator" />
<span class="mesh-device-path">{{ dev }}</span>
</div>
</div>
</div>
<!-- Actions row -->
<div class="mesh-actions">
<button class="glass-button mesh-action-btn" :disabled="configuring" @click="handleToggleEnabled">
{{ mesh.status?.enabled ? 'Disable' : 'Enable' }}
</button>
<button class="glass-button mesh-action-btn" :disabled="!mesh.status?.device_connected || broadcasting" @click="handleBroadcast">
{{ broadcasting ? 'Sending...' : 'Broadcast' }}
</button>
<button class="glass-button mesh-action-btn" @click="mesh.refreshAll()">Refresh</button>
</div>
<!-- Peers list (scrollable) -->
<div class="glass-card mesh-peers-card">
<h2 class="mesh-section-title">Peers <span class="mesh-peer-count">{{ mesh.peers.length }}</span></h2>
<div v-if="mesh.peers.length === 0 && !mesh.status?.device_connected" class="mesh-empty">
No peers discovered yet.
</div>
<div v-else class="mesh-peer-list">
<!-- Public channel -->
<div
class="mesh-peer-row is-channel"
:class="{ active: activeChatChannel?.index === 0 }"
@click="openChannelChat(publicChannel)"
>
<div class="mesh-peer-avatar channel">#</div>
<div class="mesh-peer-info">
<div class="mesh-peer-name">Public</div>
<div class="mesh-peer-sub">Mesh channel</div>
</div>
</div>
<div
v-for="peer in sortedPeers" :key="peer.contact_id"
class="mesh-peer-row"
:class="{ active: activeChatPeer?.contact_id === peer.contact_id, 'is-archy': isArchyNode(peer) }"
@click="openChat(peer)"
>
<div class="mesh-peer-avatar" :class="{ archy: isArchyNode(peer) }">
<AnimatedLogo v-if="isArchyNode(peer)" size="sm" />
<template v-else>{{ peer.advert_name.charAt(0).toUpperCase() }}</template>
</div>
<div class="mesh-peer-info">
<div class="mesh-peer-name">
{{ peer.advert_name || `Node #${peer.contact_id}` }}
<span v-if="isArchyNode(peer)" class="mesh-peer-archy-badge">Archy</span>
</div>
<div class="mesh-peer-sub">{{ truncatePubkey(peer.pubkey_hex) }}</div>
</div>
<span v-if="mesh.unreadCounts[peer.contact_id]" class="mesh-unread-badge">
{{ mesh.unreadCounts[peer.contact_id] }}
</span>
<div class="mesh-peer-signal">
<div class="mesh-signal-bars">
<div v-for="i in 4" :key="i" class="mesh-signal-bar" :class="{ active: i <= signalBars(peer.rssi) }" />
</div>
</div>
</div>
</div>
</div>
</div>
<!-- RIGHT COLUMN: Chat panel -->
<div class="mesh-right">
<div class="glass-card mesh-chat-card">
<!-- No chat selected -->
<div v-if="!hasActiveChat" class="mesh-chat-empty">
<div class="mesh-chat-empty-icon">&#x1F4E1;</div>
<p>Select a peer or channel to chat</p>
<p class="mesh-chat-empty-sub">Messages are sent over LoRa mesh radio</p>
</div>
<!-- Chat active -->
<template v-else>
<!-- Chat header -->
<div class="mesh-chat-header">
<button class="mesh-chat-back" @click="closeChat">&larr;</button>
<div class="mesh-chat-header-info">
<div class="mesh-chat-header-name">
{{ activeChatName }}
<span v-if="activeChatPeer && isArchyNode(activeChatPeer)" class="mesh-peer-archy-badge">Archy</span>
<span v-if="activeChatChannel" class="mesh-peer-channel-badge">Channel</span>
</div>
<div class="mesh-chat-header-sub">{{ activeChatSub }}</div>
</div>
<div class="mesh-chat-header-status">
<span v-if="activeChatPeer" class="mesh-chat-header-time">{{ timeAgo(activeChatPeer.last_heard) }}</span>
</div>
</div>
<!-- Messages area -->
<div ref="chatScrollEl" class="mesh-chat-messages">
<div v-if="chatMessages.length === 0" class="mesh-chat-no-messages">
No messages yet. Say hello!
</div>
<div
v-for="msg in chatMessages" :key="msg.id"
class="mesh-chat-bubble-wrapper"
:class="msg.direction"
>
<div class="mesh-chat-bubble" :class="msg.direction">
<div class="mesh-chat-bubble-text">{{ msg.plaintext }}</div>
<div class="mesh-chat-bubble-meta">
<span v-if="msg.encrypted" class="mesh-chat-e2e">E2E</span>
<span v-if="msg.delivered && msg.direction === 'sent'" class="mesh-chat-ack">&#x2713;&#x2713;</span>
<span class="mesh-chat-bubble-time">{{ timeAgo(msg.timestamp) }}</span>
</div>
</div>
</div>
</div>
<!-- Compose bar -->
<div class="mesh-chat-compose">
<div v-if="sendError" class="mesh-chat-send-error">{{ sendError }}</div>
<div class="mesh-chat-compose-row">
<input
v-model="messageText"
class="mesh-chat-input"
placeholder="Type a message..."
maxlength="160"
@keydown.enter.exact.prevent="handleSendMessage"
/>
<button
class="glass-button mesh-chat-send-btn"
:disabled="!messageText.trim() || mesh.sending"
@click="handleSendMessage"
>
{{ mesh.sending ? '...' : 'Send' }}
</button>
</div>
<div class="mesh-chat-compose-meta">
<span>{{ messageText.length }}/160</span>
</div>
</div>
</template>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.mesh-view {
padding: 24px;
max-width: 1200px;
margin: 0 auto;
display: flex;
flex-direction: column;
gap: 16px;
height: 100%;
overflow: hidden;
}
.mesh-header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
flex-shrink: 0;
}
.mesh-header-left { flex: 1; }
.mesh-title {
font-size: 1.5rem;
font-weight: 700;
color: rgba(255, 255, 255, 0.95);
margin: 0;
}
.mesh-subtitle {
color: rgba(255, 255, 255, 0.5);
font-size: 0.85rem;
margin: 2px 0 0;
display: flex;
align-items: center;
gap: 8px;
}
.mesh-subtitle-badge {
font-size: 0.65rem;
font-weight: 600;
color: #4ade80;
background: rgba(74, 222, 128, 0.12);
padding: 1px 6px;
border-radius: 4px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.mesh-flasher-btn {
display: inline-flex;
align-items: center;
gap: 0;
padding: 8px 16px;
font-size: 0.9rem;
text-decoration: none;
white-space: nowrap;
flex-shrink: 0;
}
.mesh-flasher-sep {
margin: 0 8px;
color: rgba(255, 255, 255, 0.2);
}
.mesh-error {
color: #ef4444;
font-size: 0.85rem;
padding: 8px 12px;
background: rgba(239, 68, 68, 0.1);
border-radius: 8px;
border: 1px solid rgba(239, 68, 68, 0.2);
flex-shrink: 0;
}
/* ─── Two-column layout ─── */
.mesh-columns {
display: flex;
gap: 16px;
flex: 1;
min-height: 0;
overflow: hidden;
}
.mesh-left {
width: 380px;
flex-shrink: 0;
display: flex;
flex-direction: column;
gap: 12px;
min-height: 0;
overflow: hidden;
}
.mesh-right {
flex: 1;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
}
/* ─── Status card ─── */
.mesh-status-card { padding: 16px; flex-shrink: 0; }
.mesh-status-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
}
.mesh-status-indicator {
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
}
.mesh-status-indicator.connected {
background: #4ade80;
box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}
.mesh-status-indicator.disconnected {
background: rgba(255, 255, 255, 0.3);
}
.mesh-section-title {
font-size: 0.95rem;
font-weight: 600;
color: rgba(255, 255, 255, 0.9);
margin: 0;
}
.mesh-status-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
.mesh-stat {
display: flex;
flex-direction: column;
gap: 1px;
padding: 8px;
background: rgba(255, 255, 255, 0.05);
border-radius: 6px;
}
.mesh-stat-label {
font-size: 0.65rem;
color: rgba(255, 255, 255, 0.4);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.mesh-stat-value {
font-size: 0.8rem;
color: rgba(255, 255, 255, 0.85);
font-weight: 500;
}
.text-green { color: #4ade80; }
.text-orange { color: #fb923c; }
.text-muted { color: rgba(255, 255, 255, 0.4); }
.mesh-loading, .mesh-empty {
color: rgba(255, 255, 255, 0.4);
font-size: 0.85rem;
text-align: center;
padding: 16px 0;
}
.mesh-detected-devices { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.mesh-device-row {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 8px;
background: rgba(255, 255, 255, 0.04);
border-radius: 6px;
}
.mesh-device-indicator {
width: 6px;
height: 6px;
border-radius: 50%;
background: #4ade80;
box-shadow: 0 0 4px rgba(74, 222, 128, 0.4);
flex-shrink: 0;
}
.mesh-device-path {
font-family: monospace;
font-size: 0.8rem;
color: rgba(255, 255, 255, 0.7);
}
/* ─── Actions ─── */
.mesh-actions {
display: flex;
gap: 8px;
flex-shrink: 0;
}
.mesh-action-btn {
flex: 1;
padding: 8px 0;
font-size: 0.8rem;
}
/* ─── Peers list ─── */
.mesh-peers-card {
padding: 14px;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.mesh-peers-card .mesh-section-title {
margin-bottom: 10px;
flex-shrink: 0;
}
.mesh-peer-list {
display: flex;
flex-direction: column;
gap: 4px;
overflow-y: auto;
flex: 1;
min-height: 0;
}
.mesh-peer-row {
display: flex;
align-items: center;
gap: 10px;
padding: 10px;
border-radius: 8px;
cursor: pointer;
transition: background 0.15s;
}
.mesh-peer-row:hover {
background: rgba(255, 255, 255, 0.06);
}
.mesh-peer-row.active {
background: rgba(251, 146, 60, 0.1);
border: 1px solid rgba(251, 146, 60, 0.2);
}
.mesh-peer-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.08);
display: flex;
align-items: center;
justify-content: center;
font-size: 0.9rem;
color: rgba(255, 255, 255, 0.6);
flex-shrink: 0;
font-weight: 600;
}
.mesh-peer-avatar.archy {
background: rgba(251, 146, 60, 0.15);
padding: 0;
overflow: hidden;
}
.mesh-peer-avatar.archy :deep(> div) {
width: 26px;
height: 26px;
border-radius: 50%;
overflow: hidden;
}
.mesh-peer-avatar.channel {
background: rgba(59, 130, 246, 0.15);
color: #3b82f6;
font-weight: 700;
font-size: 1.1rem;
}
.mesh-peer-channel-badge {
font-size: 0.6rem;
font-weight: 700;
color: #3b82f6;
background: rgba(59, 130, 246, 0.12);
padding: 1px 5px;
border-radius: 3px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.mesh-peer-count {
font-size: 0.75rem;
font-weight: 600;
color: rgba(255, 255, 255, 0.4);
background: rgba(255, 255, 255, 0.08);
padding: 2px 8px;
border-radius: 10px;
margin-left: 6px;
vertical-align: middle;
}
.mesh-peer-row.is-channel {
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
padding-bottom: 12px;
margin-bottom: 4px;
}
.mesh-peer-info {
flex: 1;
min-width: 0;
}
.mesh-peer-name {
font-weight: 600;
font-size: 0.85rem;
color: rgba(255, 255, 255, 0.9);
display: flex;
align-items: center;
gap: 6px;
}
.mesh-peer-archy-badge {
font-size: 0.6rem;
font-weight: 700;
color: #fb923c;
background: rgba(251, 146, 60, 0.12);
padding: 1px 5px;
border-radius: 3px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.mesh-peer-sub {
font-size: 0.7rem;
color: rgba(255, 255, 255, 0.3);
font-family: monospace;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.mesh-peer-signal {
flex-shrink: 0;
}
.mesh-signal-bars {
display: flex;
align-items: flex-end;
gap: 2px;
height: 14px;
}
.mesh-signal-bar {
width: 3px;
border-radius: 1px;
background: rgba(255, 255, 255, 0.12);
}
.mesh-signal-bar:nth-child(1) { height: 3px; }
.mesh-signal-bar:nth-child(2) { height: 6px; }
.mesh-signal-bar:nth-child(3) { height: 10px; }
.mesh-signal-bar:nth-child(4) { height: 14px; }
.mesh-signal-bar.active { background: #4ade80; }
.mesh-unread-badge {
background: #fb923c;
color: #000;
font-size: 0.65rem;
font-weight: 700;
min-width: 18px;
height: 18px;
border-radius: 9px;
display: flex;
align-items: center;
justify-content: center;
padding: 0 5px;
flex-shrink: 0;
}
/* ─── Chat panel ─── */
.mesh-chat-card {
padding: 0;
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
overflow: hidden;
}
.mesh-chat-empty {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: rgba(255, 255, 255, 0.3);
gap: 8px;
padding: 40px;
}
.mesh-chat-empty-icon {
font-size: 3rem;
opacity: 0.4;
}
.mesh-chat-empty p {
margin: 0;
font-size: 0.9rem;
}
.mesh-chat-empty-sub {
font-size: 0.75rem !important;
color: rgba(255, 255, 255, 0.2);
}
/* Chat header */
.mesh-chat-header {
display: flex;
align-items: center;
gap: 10px;
padding: 14px 16px;
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
flex-shrink: 0;
}
.mesh-chat-back {
background: none;
border: none;
color: rgba(255, 255, 255, 0.6);
font-size: 1.2rem;
cursor: pointer;
padding: 4px 8px;
border-radius: 6px;
display: none; /* hidden on desktop, shown on mobile */
}
.mesh-chat-header-info { flex: 1; min-width: 0; }
.mesh-chat-header-name {
font-weight: 600;
font-size: 0.95rem;
color: rgba(255, 255, 255, 0.9);
display: flex;
align-items: center;
gap: 6px;
}
.mesh-chat-header-sub {
font-size: 0.7rem;
color: rgba(255, 255, 255, 0.3);
font-family: monospace;
}
.mesh-chat-header-status {
flex-shrink: 0;
}
.mesh-chat-header-time {
font-size: 0.7rem;
color: rgba(255, 255, 255, 0.3);
}
/* Chat messages */
.mesh-chat-messages {
flex: 1;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 8px;
min-height: 0;
}
.mesh-chat-no-messages {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: rgba(255, 255, 255, 0.25);
font-size: 0.85rem;
}
.mesh-chat-bubble-wrapper {
display: flex;
}
.mesh-chat-bubble-wrapper.sent {
justify-content: flex-end;
}
.mesh-chat-bubble-wrapper.received {
justify-content: flex-start;
}
.mesh-chat-bubble {
max-width: 75%;
padding: 10px 14px;
border-radius: 16px;
word-break: break-word;
}
.mesh-chat-bubble.sent {
background: rgba(251, 146, 60, 0.15);
border: 1px solid rgba(251, 146, 60, 0.2);
border-bottom-right-radius: 4px;
}
.mesh-chat-bubble.received {
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.08);
border-bottom-left-radius: 4px;
}
.mesh-chat-bubble-text {
color: rgba(255, 255, 255, 0.9);
font-size: 0.9rem;
line-height: 1.4;
}
.mesh-chat-bubble-meta {
display: flex;
align-items: center;
gap: 6px;
margin-top: 4px;
justify-content: flex-end;
}
.mesh-chat-bubble-time {
font-size: 0.65rem;
color: rgba(255, 255, 255, 0.3);
}
.mesh-chat-e2e {
font-size: 0.55rem;
font-weight: 700;
color: #4ade80;
padding: 0 3px;
border: 1px solid rgba(74, 222, 128, 0.3);
border-radius: 3px;
}
.mesh-chat-ack {
font-size: 0.7rem;
color: #3b82f6;
}
/* Compose bar */
.mesh-chat-compose {
padding: 12px 16px;
border-top: 1px solid rgba(255, 255, 255, 0.06);
flex-shrink: 0;
}
.mesh-chat-send-error {
color: #ef4444;
font-size: 0.75rem;
margin-bottom: 6px;
}
.mesh-chat-compose-row {
display: flex;
gap: 8px;
}
.mesh-chat-input {
flex: 1;
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 20px;
color: rgba(255, 255, 255, 0.9);
padding: 10px 16px;
font-size: 0.9rem;
font-family: inherit;
outline: none;
}
.mesh-chat-input:focus {
border-color: rgba(251, 146, 60, 0.4);
}
.mesh-chat-input::placeholder {
color: rgba(255, 255, 255, 0.25);
}
.mesh-chat-send-btn {
padding: 10px 20px;
border-radius: 20px;
font-size: 0.85rem;
background: rgba(251, 146, 60, 0.15);
border-color: rgba(251, 146, 60, 0.25);
}
.mesh-chat-send-btn:hover:not(:disabled) {
background: rgba(251, 146, 60, 0.25);
}
.mesh-chat-compose-meta {
font-size: 0.65rem;
color: rgba(255, 255, 255, 0.25);
text-align: right;
margin-top: 4px;
}
/* ─── Mobile: keep single column ─── */
@media (max-width: 768px) {
.mesh-view {
height: auto;
padding: 16px;
}
.mesh-columns {
flex-direction: column;
overflow: visible;
}
.mesh-left {
width: 100%;
overflow: visible;
}
.mesh-right {
min-height: 400px;
}
.mesh-status-grid {
grid-template-columns: repeat(2, 1fr);
}
.mesh-chat-back {
display: block;
}
}
</style>