diff --git a/package.json b/package.json index 7758b88..2868b93 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "voipms-desktop", "productName": "bubble", - "version": "0.8.3", + "version": "0.8.4", "description": "Signal-style desktop SMS client for voip.ms", "author": "trav ", "private": true, diff --git a/resources/android/VoipMessages.apk b/resources/android/VoipMessages.apk index c11f600..ab3d364 100644 Binary files a/resources/android/VoipMessages.apk and b/resources/android/VoipMessages.apk differ diff --git a/src/renderer/src/components/ChatView.tsx b/src/renderer/src/components/ChatView.tsx index 2cd86db..11a0eb9 100644 --- a/src/renderer/src/components/ChatView.tsx +++ b/src/renderer/src/components/ChatView.tsx @@ -90,7 +90,6 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam const members = group ? groupMembers(conv.contact).map((n) => senderName(n, contactMap)) : [] const [messages, setMessages] = useState() const [flashId, setFlashId] = useState() - const [searchOpen, setSearchOpen] = useState(false) const [q, setQ] = useState('') const [hits, setHits] = useState([]) const [hitIdx, setHitIdx] = useState(0) @@ -199,7 +198,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam // ---- in-chat search ---- useEffect(() => { - if (!searchOpen || !q.trim()) { + if (!q.trim()) { setHits([]) return } @@ -217,7 +216,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam clearTimeout(t) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [q, searchOpen]) + }, [q]) const stepHit = (dir: 1 | -1): void => { if (!hits.length) return @@ -227,8 +226,8 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam } const openSearch = (): void => { - setSearchOpen(true) - setTimeout(() => searchInput.current?.focus(), 0) + searchInput.current?.focus() + searchInput.current?.select() } useEffect(() => { @@ -254,7 +253,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam if (atBottom.current) virtuoso.current?.scrollToIndex({ index: 'LAST', align: 'end' }) }, []) - const mark = searchOpen && q.trim() ? q : highlight + const mark = q.trim() ? q : highlight const isNew = messages !== undefined && messages.length === 0 const initialIndex = jump && messages ? Math.max(0, indexOf(jump.id)) : rows.length - 1 @@ -296,65 +295,60 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam onInfo() }} > - + - {/* The number lives in Get info, not here. */} + {/* One line: the name, the tag of the number it goes through at the + right, then the search field. The number lives in Get info. */}
-
{name}
- {(group || smsDids.length > 1) && ( -
- {group && `${members.length} people`} - {smsDids.length > 1 && ( - - {group ? ' ยท ' : ''} - - - )} -
+ {name} + {group && {members.length} people} + {smsDids.length > 1 && ( + + + )} -
- - - - {searchOpen && ( -
- - setQ(e.target.value)} - onKeyDown={(e) => { - if (e.key === 'Enter') stepHit(e.shiftKey ? -1 : 1) - else if (e.key === 'Escape') { - setSearchOpen(false) - setQ('') - } - }} - /> - {q.trim() ? (hits.length ? `${hitIdx + 1} of ${hits.length}` : 'No results') : ''} -
- - -
- + + + + setQ(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter') stepHit(e.shiftKey ? -1 : 1) + else if (e.key === 'Escape') { + setQ('') + e.currentTarget.blur() + } + }} + /> + {q.trim() && ( + <> + {hits.length ? `${hitIdx + 1} of ${hits.length}` : 'No results'} + + + + + )} +
- )} +
{messages === undefined ? null : isNew ? ( diff --git a/src/renderer/src/styles.css b/src/renderer/src/styles.css index 09e68f6..f826d0e 100644 --- a/src/renderer/src/styles.css +++ b/src/renderer/src/styles.css @@ -3439,31 +3439,34 @@ select { /* ---------- the chat ---------- */ .chat-header { border-bottom: 0; - height: 58px; + height: 44px; padding: 0 8px; gap: 8px; } -/* The chat's name is an info panel (debossed); a group's opens its info, - so it pops out on hover and sinks while held (#clickable). */ +/* The chat's name is an info panel (debossed) that opens Get info, so it + pops out on hover and sinks while held (#clickable) -- except over the + search field at its end, which is a text box of its own. One line: + name, (group size), the number's tag at the right, the search field. */ .chat-title { align-self: stretch; - margin: 6px 0; - padding: 3px 12px; + margin: 5px 0; + padding: 0 4px 0 12px; display: flex; - flex-direction: column; - justify-content: center; + flex-direction: row; + align-items: center; + gap: 8px; background: var(--deboss); border: 1px solid var(--deboss-edge); border-top-color: var(--deboss-edge2); border-radius: 8px; color: var(--panel-text); } -.chat-title.clickable:hover { +.chat-title.clickable:hover:not(:has(.chat-search-box:hover)) { background: var(--deboss-hover); border-color: var(--btn-edge); border-bottom-color: var(--btn-edge2); } -.chat-title.clickable:active { +.chat-title.clickable:active:not(:has(.chat-search-box:hover)) { background: var(--deboss-down); border-color: var(--btn-down-edge); border-top-color: var(--btn-down-edge2); @@ -3872,4 +3875,52 @@ label.check { .lightbox-step:disabled { visibility: hidden; } + +/* ---------- chat header: one line, search always there ---------- */ +.chat-title .chat-name { + font-size: 15px; + min-width: 0; +} +.chat-count { + flex: none; + font-size: 12px; + color: var(--muted); +} +.chat-via { + flex: none; + margin-left: auto; + font-size: 11px; + color: var(--faint); + display: flex; +} +.chat-via .gv-tag { + margin-right: 0; +} +.chat-title > .chat-name + .chat-search-box, +.chat-title > .chat-count + .chat-search-box { + margin-left: auto; +} +.chat-search-box { + flex: 0 1 260px; + min-width: 140px; + height: 26px; + cursor: text; + padding: 0 2px 0 6px; +} +.chat-search-box .search-glyph { + padding-right: 4px; +} +.chat-search-box input { + font-size: 13px; +} +.chat-search-box .hit-count { + flex: none; + font-size: 11px; + color: var(--muted); + margin: 0 2px; +} +.chat-search-box .icon-btn.inline { + width: 22px; + height: 22px; +} } diff --git a/src/renderer/src/tooltips.ts b/src/renderer/src/tooltips.ts index b781478..5f125de 100644 --- a/src/renderer/src/tooltips.ts +++ b/src/renderer/src/tooltips.ts @@ -56,8 +56,9 @@ export function installTooltips(): void { const el = (e.target as Element).closest?.('[title], [data-tip]') if (!el) return const text = adopt(el) - if (el === current || !text || !enabled) return - hide() + if (el === current) return + hide() // also when it's an empty title, there to hush its parent's + if (!text || !enabled) return timer = window.setTimeout(() => { if (el.isConnected && enabled) show(el, el.getAttribute('data-tip') ?? text, x, y) }, 600)