v0.8.4: a one-line chat header with the search field always there

The name, a group's size and the [GV]/[MS]/[SIM] tag (at the right) share one line, so the header, its picture included, is smaller. Search in chat is a field at the end of the name panel: click in and type; Esc clears it, Enter/Shift+Enter step, Ctrl+Shift+F still jumps there. The panel still opens Get info, except over the field.
This commit is contained in:
2026-11-12 17:19:18 -08:00
parent 1eb80cc075
commit 71987ec387
5 changed files with 117 additions and 71 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "voipms-desktop", "name": "voipms-desktop",
"productName": "bubble", "productName": "bubble",
"version": "0.8.3", "version": "0.8.4",
"description": "Signal-style desktop SMS client for voip.ms", "description": "Signal-style desktop SMS client for voip.ms",
"author": "trav <trav@teafry.me>", "author": "trav <trav@teafry.me>",
"private": true, "private": true,
Binary file not shown.
+35 -41
View File
@@ -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 members = group ? groupMembers(conv.contact).map((n) => senderName(n, contactMap)) : []
const [messages, setMessages] = useState<Message[]>() const [messages, setMessages] = useState<Message[]>()
const [flashId, setFlashId] = useState<number>() const [flashId, setFlashId] = useState<number>()
const [searchOpen, setSearchOpen] = useState(false)
const [q, setQ] = useState('') const [q, setQ] = useState('')
const [hits, setHits] = useState<SearchHit[]>([]) const [hits, setHits] = useState<SearchHit[]>([])
const [hitIdx, setHitIdx] = useState(0) const [hitIdx, setHitIdx] = useState(0)
@@ -199,7 +198,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
// ---- in-chat search ---- // ---- in-chat search ----
useEffect(() => { useEffect(() => {
if (!searchOpen || !q.trim()) { if (!q.trim()) {
setHits([]) setHits([])
return return
} }
@@ -217,7 +216,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
clearTimeout(t) clearTimeout(t)
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [q, searchOpen]) }, [q])
const stepHit = (dir: 1 | -1): void => { const stepHit = (dir: 1 | -1): void => {
if (!hits.length) return if (!hits.length) return
@@ -227,8 +226,8 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
} }
const openSearch = (): void => { const openSearch = (): void => {
setSearchOpen(true) searchInput.current?.focus()
setTimeout(() => searchInput.current?.focus(), 0) searchInput.current?.select()
} }
useEffect(() => { useEffect(() => {
@@ -254,7 +253,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
if (atBottom.current) virtuoso.current?.scrollToIndex({ index: 'LAST', align: 'end' }) 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 isNew = messages !== undefined && messages.length === 0
const initialIndex = jump && messages ? Math.max(0, indexOf(jump.id)) : rows.length - 1 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() onInfo()
}} }}
> >
<Avatar number={conv.contact} contact={contact} size={36} /> <Avatar number={conv.contact} contact={contact} size={28} />
</div> </div>
{/* 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. */}
<div className="chat-title clickable" onClick={onInfo} title="Get info"> <div className="chat-title clickable" onClick={onInfo} title="Get info">
<div className="chat-name">{name}</div> <span className="chat-name">{name}</span>
{(group || smsDids.length > 1) && ( {group && <span className="chat-count">{members.length} people</span>}
<div className="chat-sub">
{group && `${members.length} people`}
{smsDids.length > 1 && ( {smsDids.length > 1 && (
<span className="chat-via"> <span className="chat-via">
{group ? ' · ' : ''}
<Via did={conv.did} gvNumber={gvNumber} tag /> <Via did={conv.did} gvNumber={gvNumber} tag />
</span> </span>
)} )}
</div> <div
)} className="search-box chat-search-box"
</div> title=""
<button className="icon-btn" title="Search in chat (Ctrl+Shift+F)" onClick={openSearch}> onClick={(e) => {
<SearchIcon /> e.stopPropagation()
</button> searchInput.current?.focus()
</header> }}
>
{searchOpen && ( <span className="search-glyph">
<div className="chat-search"> <SearchIcon size={14} />
<SearchIcon size={16} /> </span>
<input <input
ref={searchInput} ref={searchInput}
value={q} value={q}
placeholder={`Search in ${name}`} placeholder="Search in chat"
aria-label="Search in chat (Ctrl+Shift+F)"
onChange={(e) => setQ(e.target.value)} onChange={(e) => setQ(e.target.value)}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter') stepHit(e.shiftKey ? -1 : 1) if (e.key === 'Enter') stepHit(e.shiftKey ? -1 : 1)
else if (e.key === 'Escape') { else if (e.key === 'Escape') {
setSearchOpen(false)
setQ('') setQ('')
e.currentTarget.blur()
} }
}} }}
/> />
<span className="hit-count">{q.trim() ? (hits.length ? `${hitIdx + 1} of ${hits.length}` : 'No results') : ''}</span> {q.trim() && (
<div className="tiles"> <>
<button className="icon-btn small" title="Older (Enter)" disabled={!hits.length} onClick={() => stepHit(1)}> <span className="hit-count">{hits.length ? `${hitIdx + 1} of ${hits.length}` : 'No results'}</span>
<button className="icon-btn inline" title="Older (Enter)" disabled={!hits.length} onClick={() => stepHit(1)}>
<UpIcon /> <UpIcon />
</button> </button>
<button className="icon-btn small" title="Newer (Shift+Enter)" disabled={!hits.length} onClick={() => stepHit(-1)}> <button className="icon-btn inline" title="Newer (Shift+Enter)" disabled={!hits.length} onClick={() => stepHit(-1)}>
<DownIcon /> <DownIcon />
</button> </button>
</div> <button className="icon-btn inline" title="Clear (Esc)" onClick={() => setQ('')}>
<button <CloseIcon size={14} />
className="icon-btn small"
title="Close"
onClick={() => {
setSearchOpen(false)
setQ('')
}}
>
<CloseIcon />
</button> </button>
</div> </>
)} )}
</div>
</div>
</header>
<div className="messages"> <div className="messages">
{messages === undefined ? null : isNew ? ( {messages === undefined ? null : isNew ? (
+60 -9
View File
@@ -3439,31 +3439,34 @@ select {
/* ---------- the chat ---------- */ /* ---------- the chat ---------- */
.chat-header { .chat-header {
border-bottom: 0; border-bottom: 0;
height: 58px; height: 44px;
padding: 0 8px; padding: 0 8px;
gap: 8px; gap: 8px;
} }
/* The chat's name is an info panel (debossed); a group's opens its info, /* The chat's name is an info panel (debossed) that opens Get info, so it
so it pops out on hover and sinks while held (#clickable). */ 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 { .chat-title {
align-self: stretch; align-self: stretch;
margin: 6px 0; margin: 5px 0;
padding: 3px 12px; padding: 0 4px 0 12px;
display: flex; display: flex;
flex-direction: column; flex-direction: row;
justify-content: center; align-items: center;
gap: 8px;
background: var(--deboss); background: var(--deboss);
border: 1px solid var(--deboss-edge); border: 1px solid var(--deboss-edge);
border-top-color: var(--deboss-edge2); border-top-color: var(--deboss-edge2);
border-radius: 8px; border-radius: 8px;
color: var(--panel-text); color: var(--panel-text);
} }
.chat-title.clickable:hover { .chat-title.clickable:hover:not(:has(.chat-search-box:hover)) {
background: var(--deboss-hover); background: var(--deboss-hover);
border-color: var(--btn-edge); border-color: var(--btn-edge);
border-bottom-color: var(--btn-edge2); border-bottom-color: var(--btn-edge2);
} }
.chat-title.clickable:active { .chat-title.clickable:active:not(:has(.chat-search-box:hover)) {
background: var(--deboss-down); background: var(--deboss-down);
border-color: var(--btn-down-edge); border-color: var(--btn-down-edge);
border-top-color: var(--btn-down-edge2); border-top-color: var(--btn-down-edge2);
@@ -3872,4 +3875,52 @@ label.check {
.lightbox-step:disabled { .lightbox-step:disabled {
visibility: hidden; 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;
}
} }
+3 -2
View File
@@ -56,8 +56,9 @@ export function installTooltips(): void {
const el = (e.target as Element).closest?.('[title], [data-tip]') const el = (e.target as Element).closest?.('[title], [data-tip]')
if (!el) return if (!el) return
const text = adopt(el) const text = adopt(el)
if (el === current || !text || !enabled) return if (el === current) return
hide() hide() // also when it's an empty title, there to hush its parent's
if (!text || !enabled) return
timer = window.setTimeout(() => { timer = window.setTimeout(() => {
if (el.isConnected && enabled) show(el, el.getAttribute('data-tip') ?? text, x, y) if (el.isConnected && enabled) show(el, el.getAttribute('data-tip') ?? text, x, y)
}, 600) }, 600)